@@ -1221,11 +1221,11 @@ def _concat_inner_guards(da, da_global, mxg):
12211221 if mxg <= 0 :
12221222 return da
12231223
1224- if len (da .regions ) > 1 :
1224+ if len (da .bout . _regions ) > 1 :
12251225 raise ValueError ("da passed should have only one region" )
1226- region = list (da .regions .values ())[0 ]
1226+ region = list (da .bout . _regions .values ())[0 ]
12271227
1228- if region .connection_inner_x not in da_global .regions :
1228+ if region .connection_inner_x not in da_global .bout . _regions :
12291229 # No connection, or plotting restricted set of regions not including this
12301230 # connection
12311231 return da
@@ -1236,9 +1236,9 @@ def _concat_inner_guards(da, da_global, mxg):
12361236 ycoord = da_global .metadata ["bout_ydim" ]
12371237
12381238 da_inner = da_global .bout .from_region (region .connection_inner_x , with_guards = 0 )
1239- if len (da_inner .regions ) > 1 :
1239+ if len (da_inner .bout . _regions ) > 1 :
12401240 raise ValueError ("da_inner should have only one region" )
1241- region_inner = list (da_inner .regions .values ())[0 ]
1241+ region_inner = list (da_inner .bout . _regions .values ())[0 ]
12421242
12431243 if (
12441244 myg_da > 0
@@ -1276,7 +1276,7 @@ def _concat_inner_guards(da, da_global, mxg):
12761276 da_inner_lower = da_inner_lower .isel (
12771277 ** {xcoord : slice (- mxg , None ), ycoord : slice (- myg_da , None )}
12781278 )
1279- save_regions = da_inner .regions
1279+ save_regions = da_inner .bout . _regions
12801280 da_inner = xr .concat ((da_inner_lower , da_inner ), ycoord , join = "exact" )
12811281 # xr.concat takes attributes from the first variable, but we need da_inner's
12821282 # regions
@@ -1314,7 +1314,7 @@ def _concat_inner_guards(da, da_global, mxg):
13141314 da_inner [xcoord ].data [...] = new_xcoord .data
13151315 da_inner [ycoord ].data [...] = new_ycoord .data
13161316
1317- save_regions = da .regions
1317+ save_regions = da .bout . _regions
13181318 da = xr .concat ((da_inner , da ), xcoord , join = "exact" )
13191319 # xr.concat takes attributes from the first variable (for xarray>=0.15.0, keeps attrs
13201320 # that are the same in all objects for xarray<0.15.0)
@@ -1332,11 +1332,11 @@ def _concat_outer_guards(da, da_global, mxg):
13321332 if mxg <= 0 :
13331333 return da
13341334
1335- if len (da .regions ) > 1 :
1335+ if len (da .bout . _regions ) > 1 :
13361336 raise ValueError ("da passed should have only one region" )
1337- region = list (da .regions .values ())[0 ]
1337+ region = list (da .bout . _regions .values ())[0 ]
13381338
1339- if region .connection_outer_x not in da_global .regions :
1339+ if region .connection_outer_x not in da_global .bout . _regions :
13401340 # No connection, or plotting restricted set of regions not including this
13411341 # connection
13421342 return da
@@ -1347,9 +1347,9 @@ def _concat_outer_guards(da, da_global, mxg):
13471347 ycoord = da_global .metadata ["bout_ydim" ]
13481348
13491349 da_outer = da_global .bout .from_region (region .connection_outer_x , with_guards = 0 )
1350- if len (da_outer .regions ) > 1 :
1350+ if len (da_outer .bout . _regions ) > 1 :
13511351 raise ValueError ("da_outer should have only one region" )
1352- region_outer = list (da_outer .regions .values ())[0 ]
1352+ region_outer = list (da_outer .bout . _regions .values ())[0 ]
13531353
13541354 if (
13551355 myg_da > 0
@@ -1387,7 +1387,7 @@ def _concat_outer_guards(da, da_global, mxg):
13871387 da_outer_lower = da_outer_lower .isel (
13881388 ** {xcoord : slice (- mxg , None ), ycoord : slice (- myg_da , None )}
13891389 )
1390- save_regions = da_outer .regions
1390+ save_regions = da_outer .bout . _regions
13911391 da_outer = xr .concat ((da_outer_lower , da_outer ), ycoord , join = "exact" )
13921392 # xr.concat takes attributes from the first variable, but we need da_outer's
13931393 # regions
@@ -1425,7 +1425,7 @@ def _concat_outer_guards(da, da_global, mxg):
14251425 da_outer [xcoord ].data [...] = new_xcoord .data
14261426 da_outer [ycoord ].data [...] = new_ycoord .data
14271427
1428- save_regions = da .regions
1428+ save_regions = da .bout . _regions
14291429 da = xr .concat ((da , da_outer ), xcoord , join = "exact" )
14301430 # xarray<0.15.0 only keeps attrs that are the same on all variables passed to concat
14311431 da .attrs ["regions" ] = save_regions
@@ -1442,11 +1442,11 @@ def _concat_lower_guards(da, da_global, mxg, myg):
14421442 if myg <= 0 :
14431443 return da
14441444
1445- if len (da .regions ) > 1 :
1445+ if len (da .bout . _regions ) > 1 :
14461446 raise ValueError ("da passed should have only one region" )
1447- region = list (da .regions .values ())[0 ]
1447+ region = list (da .bout . _regions .values ())[0 ]
14481448
1449- if region .connection_lower_y not in da_global .regions :
1449+ if region .connection_lower_y not in da_global .bout . _regions :
14501450 # No connection, or plotting restricted set of regions not including this
14511451 # connection
14521452 return da
@@ -1525,7 +1525,7 @@ def _concat_lower_guards(da, da_global, mxg, myg):
15251525 da_lower [xcoord ].data [...] = new_xcoord .data
15261526 da_lower [ycoord ].data [...] = new_ycoord .data
15271527
1528- save_regions = da .regions
1528+ save_regions = da .bout . _regions
15291529 da = xr .concat ((da_lower , da ), ycoord , join = "exact" )
15301530 # xr.concat takes attributes from the first variable (for xarray>=0.15.0, keeps attrs
15311531 # that are the same in all objects for xarray<0.15.0)
@@ -1543,11 +1543,11 @@ def _concat_upper_guards(da, da_global, mxg, myg):
15431543 if myg <= 0 :
15441544 return da
15451545
1546- if len (da .regions ) > 1 :
1546+ if len (da .bout . _regions ) > 1 :
15471547 raise ValueError ("da passed should have only one region" )
1548- region = list (da .regions .values ())[0 ]
1548+ region = list (da .bout . _regions .values ())[0 ]
15491549
1550- if region .connection_upper_y not in da_global .regions :
1550+ if region .connection_upper_y not in da_global .bout . _regions :
15511551 # No connection, or plotting restricted set of regions not including this
15521552 # connection
15531553 return da
@@ -1625,7 +1625,7 @@ def _concat_upper_guards(da, da_global, mxg, myg):
16251625 da_upper [xcoord ].data [...] = new_xcoord .data
16261626 da_upper [ycoord ].data [...] = new_ycoord .data
16271627
1628- save_regions = da .regions
1628+ save_regions = da .bout . _regions
16291629 da = xr .concat ((da , da_upper ), ycoord , join = "exact" )
16301630 # xarray<0.15.0 only keeps attrs that are the same on all variables passed to concat
16311631 da .attrs ["regions" ] = save_regions
@@ -1637,7 +1637,7 @@ def _from_region(ds_or_da, name, with_guards):
16371637 # ensure we do not modify the input
16381638 ds_or_da = ds_or_da .copy (deep = True )
16391639
1640- region = ds_or_da .regions [name ]
1640+ region = ds_or_da .bout . _regions [name ]
16411641 xcoord = ds_or_da .metadata ["bout_xdim" ]
16421642 ycoord = ds_or_da .metadata ["bout_ydim" ]
16431643
@@ -1669,7 +1669,7 @@ def _from_region(ds_or_da, name, with_guards):
16691669
16701670 # If the result (which only has a single region) is passed to from_region a
16711671 # second time, don't want to slice anything.
1672- single_region = list (result .regions .values ())[0 ]
1672+ single_region = list (result .bout . _regions .values ())[0 ]
16731673 single_region .xinner_ind = None
16741674 single_region .xouter_ind = None
16751675 single_region .ylower_ind = None
0 commit comments