Skip to content

Commit

Permalink
cutout: apply chunks after loading cutout
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianHofmann committed Oct 19, 2023
1 parent be66fc0 commit 104d252
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions atlite/cutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def __init__(self, path, **cutoutparams):
# Three cases. First, cutout exists -> take the data.
# Second, data is given -> take it. Third, else -> build a new cutout
if path.is_file():
data = xr.open_dataset(str(path), chunks=chunks)
data = xr.open_dataset(str(path))
data = data.chunk(chunks)
data.attrs.update(storable_chunks)
if cutoutparams:
warn(
Expand Down Expand Up @@ -403,7 +404,8 @@ def grid(self):
span = (coords[self.shape[1] + 1] - coords[0]) / 2
cells = [box(*c) for c in np.hstack((coords - span, coords + span))]
return gpd.GeoDataFrame(
{"x": coords[:, 0], "y": coords[:, 1], "geometry": cells}, crs=self.crs
{"x": coords[:, 0], "y": coords[:, 1], "geometry": cells},
crs=self.crs,
)

def sel(self, path=None, bounds=None, buffer=0, **kwargs):
Expand Down

0 comments on commit 104d252

Please sign in to comment.