diff --git a/anemoi/datasets/data/grids.py b/anemoi/datasets/data/grids.py index b586bb158..4f3c8c2da 100644 --- a/anemoi/datasets/data/grids.py +++ b/anemoi/datasets/data/grids.py @@ -101,6 +101,10 @@ def check_same_grid(self, d1, d2): # We don't check the grid, because we want to be able to combine pass + def check_same_resolution(self, d1, d2): + # We don't check the resolution, because we want to be able to combine + pass + class ConcatGrids(Grids): # TODO: select the statistics of the most global grid? @@ -125,7 +129,7 @@ def tree(self): class CutoutGrids(Grids): def __init__(self, datasets, axis): - from anemoi.grids import cutout_mask + from anemoi.datasets.grids import cutout_mask super().__init__(datasets, axis) assert len(datasets) == 2, "CutoutGrids requires two datasets" @@ -140,7 +144,7 @@ def __init__(self, datasets, axis): self.lam.longitudes, self.globe.latitudes, self.globe.longitudes, - plot="cutout", + # plot="cutout", ) assert len(self.mask) == self.globe.shape[3], ( len(self.mask), diff --git a/anemoi/datasets/data/subset.py b/anemoi/datasets/data/subset.py index 5c180751b..cf4547f82 100644 --- a/anemoi/datasets/data/subset.py +++ b/anemoi/datasets/data/subset.py @@ -29,6 +29,7 @@ class Subset(Forwards): def __init__(self, dataset, indices, reason): while isinstance(dataset, Subset): indices = [dataset.indices[i] for i in indices] + reason = {**reason, **dataset.reason} dataset = dataset.dataset self.dataset = dataset diff --git a/docs/using/grids.rst b/docs/using/grids.rst index adddbfba9..6131eb4fd 100644 --- a/docs/using/grids.rst +++ b/docs/using/grids.rst @@ -23,6 +23,16 @@ So for 2D fields, the thinning will apply to both the latitude and longitude dimensions. For 1D fields, such as reduced Gaussian grids, the thinning will apply to the only dimension. +The following example shows the effect of thinning a dataset with a 1 degree +resolution: + +.. image:: thinning-before.png + +Thinning the dataset with ``thinning=4`` will result in the following dataset: + +.. image:: thinning-after.png + + ****** area ****** diff --git a/docs/using/thinning-after.png b/docs/using/thinning-after.png new file mode 100644 index 000000000..35f2c9aa6 Binary files /dev/null and b/docs/using/thinning-after.png differ diff --git a/docs/using/thinning-before.png b/docs/using/thinning-before.png new file mode 100644 index 000000000..b372f9a06 Binary files /dev/null and b/docs/using/thinning-before.png differ diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 000000000..e33609d25 --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1 @@ +*.png