Skip to content

Commit

Permalink
Fix README and add dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamici committed Oct 15, 2023
1 parent cd0d205 commit a2edab3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ naming conventions you can:

```python

>>> import xarray as xr
>>> import cf2cdm
>>> ds = xr.open_dataset('era5-levels-members.grib', engine='cfgrib')
>>> ds = xr.open_dataset('tests/sample-data/era5-levels-members.grib', engine='cfgrib')
>>> cf2cdm.translate_coords(ds, cf2cdm.ECMWF)
<xarray.Dataset>
Dimensions: (number: 10, time: 4, level: 2, latitude: 61, longitude: 120)
Dimensions: (time: 4, number: 10, level: 2, latitude: 61, longitude: 120)
Coordinates:
* number (number) int64 0 1 2 3 4 5 6 7 8 9
* time (time) datetime64[ns] 2017-01-01 ... 2017-01-02T12:00:00
step timedelta64[ns] ...
* level (level) float64 850.0 500.0
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
valid_time (time) datetime64[ns] ...
* 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 ...
Expand All @@ -37,6 +38,7 @@ Attributes:
Conventions: CF-1.7
institution: European Centre for Medium-Range Weather Forecasts
history: ...

```

To translate to the Common Data Model of the Climate Data Store use:
Expand All @@ -46,16 +48,16 @@ To translate to the Common Data Model of the Climate Data Store use:
>>> import cf2cdm
>>> cf2cdm.translate_coords(ds, cf2cdm.CDS)
<xarray.Dataset>
Dimensions: (realization: 10, forecast_reference_time: 4,
Dimensions: (forecast_reference_time: 4, realization: 10,
plev: 2, lat: 61, lon: 120)
Coordinates:
* realization (realization) int64 0 1 2 3 4 5 6 7 8 9
* forecast_reference_time (forecast_reference_time) datetime64[ns] 2017-01...
leadtime timedelta64[ns] ...
* plev (plev) float64 8.5e+04 5e+04
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
time (forecast_reference_time) datetime64[ns] ...
* 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 ...
Expand All @@ -67,6 +69,7 @@ Attributes:
Conventions: CF-1.7
institution: European Centre for Medium-Range Weather Forecasts
history: ...

```

## License
Expand Down
1 change: 1 addition & 0 deletions ci/environment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ dependencies:
- pip:
- sphinx-autoapi
# DO NOT EDIT ABOVE THIS LINE, ADD DEPENDENCIES BELOW
- cfgrib
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ channels:
# - package1
# - package2
# DO NOT EDIT ABOVE THIS LINE, ADD DEPENDENCIES BELOW AS SHOWN IN THE EXAMPLE
dependencies:
- xarray

0 comments on commit a2edab3

Please sign in to comment.