diff --git a/README.md b/README.md index 232888d..27acaeb 100644 --- a/README.md +++ b/README.md @@ -15,29 +15,29 @@ naming conventions you can: >>> import xarray as xr >>> import cf2cdm ->>> ds = xr.open_dataset('tests/sample-data/era5-levels-members.grib', engine='cfgrib') +>>> ds = xr.open_dataset('tests/sample-data/era5-levels-members.zarr') >>> cf2cdm.translate_coords(ds, cf2cdm.ECMWF) -Dimensions: (time: 4, number: 10, level: 2, latitude: 61, longitude: 120) +Dimensions: (number: 10, time: 4, level: 2, latitude: 61, longitude: 120) Coordinates: - * time (time) datetime64[ns] 2017-01-01 ... 2017-01-02T12:00:00 step timedelta64[ns] ... + * time (time) datetime64[ns] 2017-01-01 ... 2017-01-02T12:00:00 valid_time (time) datetime64[ns] ... * latitude (latitude) float64 90.0 87.0 84.0 81.0 ... -84.0 -87.0 -90.0 * longitude (longitude) float64 0.0 3.0 6.0 9.0 ... 348.0 351.0 354.0 357.0 * level (level) float64 850.0 500.0 * number (number) int64 0 1 2 3 4 5 6 7 8 9 Data variables: - z (number, time, level, latitude, longitude) float32 ... t (number, time, level, latitude, longitude) float32 ... + z (number, time, level, latitude, longitude) float32 ... Attributes: - GRIB_edition: 1 + Conventions: CF-1.7 GRIB_centre: ecmf GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts + GRIB_edition: 1 GRIB_subCentre: 0 - Conventions: CF-1.7 - institution: European Centre for Medium-Range Weather Forecasts history: ... + institution: European Centre for Medium-Range Weather Forecasts ``` @@ -48,27 +48,27 @@ To translate to the Common Data Model of the Climate Data Store use: >>> import cf2cdm >>> cf2cdm.translate_coords(ds, cf2cdm.CDS) -Dimensions: (forecast_reference_time: 4, realization: 10, +Dimensions: (realization: 10, forecast_reference_time: 4, plev: 2, lat: 61, lon: 120) Coordinates: - * forecast_reference_time (forecast_reference_time) datetime64[ns] 2017-01... leadtime timedelta64[ns] ... + * forecast_reference_time (forecast_reference_time) datetime64[ns] 2017-01... time (forecast_reference_time) datetime64[ns] ... * lat (lat) float64 -90.0 -87.0 -84.0 ... 84.0 87.0 90.0 * lon (lon) float64 0.0 3.0 6.0 9.0 ... 351.0 354.0 357.0 * plev (plev) float64 8.5e+04 5e+04 * realization (realization) int64 0 1 2 3 4 5 6 7 8 9 Data variables: - z (realization, forecast_reference_time, plev, lat, lon) float32 ... t (realization, forecast_reference_time, plev, lat, lon) float32 ... + z (realization, forecast_reference_time, plev, lat, lon) float32 ... Attributes: - GRIB_edition: 1 + Conventions: CF-1.7 GRIB_centre: ecmf GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts + GRIB_edition: 1 GRIB_subCentre: 0 - Conventions: CF-1.7 - institution: European Centre for Medium-Range Weather Forecasts history: ... + institution: European Centre for Medium-Range Weather Forecasts ``` diff --git a/ci/environment-ci.yml b/ci/environment-ci.yml index 12f6016..3c23072 100644 --- a/ci/environment-ci.yml +++ b/ci/environment-ci.yml @@ -15,4 +15,4 @@ dependencies: - pip: - sphinx-autoapi # DO NOT EDIT ABOVE THIS LINE, ADD DEPENDENCIES BELOW -- cfgrib +- zarr diff --git a/tests/sample-data/era5-levels-members.grib b/tests/sample-data/era5-levels-members.grib deleted file mode 100644 index 9ad18de..0000000 Binary files a/tests/sample-data/era5-levels-members.grib and /dev/null differ diff --git a/tests/sample-data/era5-levels-members.zarr/.zattrs b/tests/sample-data/era5-levels-members.zarr/.zattrs new file mode 100644 index 0000000..b6ffc42 --- /dev/null +++ b/tests/sample-data/era5-levels-members.zarr/.zattrs @@ -0,0 +1,9 @@ +{ + "Conventions": "CF-1.7", + "GRIB_centre": "ecmf", + "GRIB_centreDescription": "European Centre for Medium-Range Weather Forecasts", + "GRIB_edition": 1, + "GRIB_subCentre": 0, + "history": "2023-10-15T20:41 GRIB to CDM+CF via cfgrib-0.9.10.4/ecCodes-2.32.0 with {\"source\": \"tests/sample-data/era5-levels-members.grib\", \"filter_by_keys\": {}, \"encode_cf\": [\"parameter\", \"time\", \"geography\", \"vertical\"]}", + "institution": "European Centre for Medium-Range Weather Forecasts" +} \ No newline at end of file diff --git a/tests/sample-data/era5-levels-members.zarr/.zgroup b/tests/sample-data/era5-levels-members.zarr/.zgroup new file mode 100644 index 0000000..3b7daf2 --- /dev/null +++ b/tests/sample-data/era5-levels-members.zarr/.zgroup @@ -0,0 +1,3 @@ +{ + "zarr_format": 2 +} \ No newline at end of file diff --git a/tests/sample-data/era5-levels-members.zarr/.zmetadata b/tests/sample-data/era5-levels-members.zarr/.zmetadata new file mode 100644 index 0000000..a2f93b8 --- /dev/null +++ b/tests/sample-data/era5-levels-members.zarr/.zmetadata @@ -0,0 +1,342 @@ +{ + "metadata": { + ".zattrs": { + "Conventions": "CF-1.7", + "GRIB_centre": "ecmf", + "GRIB_centreDescription": "European Centre for Medium-Range Weather Forecasts", + "GRIB_edition": 1, + "GRIB_subCentre": 0, + "history": "2023-10-15T20:41 GRIB to CDM+CF via cfgrib-0.9.10.4/ecCodes-2.32.0 with {\"source\": \"tests/sample-data/era5-levels-members.grib\", \"filter_by_keys\": {}, \"encode_cf\": [\"parameter\", \"time\", \"geography\", \"vertical\"]}", + "institution": "European Centre for Medium-Range Weather Forecasts" + }, + ".zgroup": { + "zarr_format": 2 + }, + "isobaricInhPa/.zarray": { + "chunks": [ + 2 + ], + "compressor": { + "blocksize": 0, + "clevel": 5, + "cname": "lz4", + "id": "blosc", + "shuffle": 1 + }, + "dtype": " None: