Skip to content

Commit

Permalink
more doc
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Mar 28, 2024
1 parent 7c24b8f commit d5c1a77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion anemoi/datasets/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ def _subset(self, **kwargs):
return Rename(self, rename)._subset(**kwargs)

if "statistics" in kwargs:
from ..data import open_dataset
from .statistics import Statistics

statistics = kwargs.pop("statistics")
return Statistics(self, statistics)._subset(**kwargs)

return Statistics(self, open_dataset(statistics))._subset(**kwargs)

if "thinning" in kwargs:
from .masked import Thinning
Expand Down
5 changes: 4 additions & 1 deletion anemoi/datasets/data/masked.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def tree(self):

class Cropping(Masked):
def __init__(self, forward, area):
self.area = area
from ..data import open_dataset

area = area if isinstance(area, (list, tuple)) else open_dataset(area)

if isinstance(area, Dataset):
north = np.amax(area.latitudes)
Expand All @@ -95,6 +97,7 @@ def __init__(self, forward, area):
west = np.amin(area.longitudes)
area = (north, west, south, east)

self.area = area
mask = cropping_mask(forward.latitudes, forward.longitudes, *area)

super().__init__(forward, mask)
Expand Down

0 comments on commit d5c1a77

Please sign in to comment.