Skip to content

Commit 71167d4

Browse files
authored
Merge pull request #221 from ecmwf/prepare-for-release
Prepare for the release (changelog, README, copyright, etc)
2 parents bdf28a3 + 4164628 commit 71167d4

18 files changed

+91
-597
lines changed

CHANGELOG.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ Changelog for cfgrib
55
0.9.9.0 (unreleased)
66
--------------------
77

8+
- Depend on the ECMWF `eccodes python package <https://pypi.org/project/eccodes>`_ to access
9+
the low level ecCodes C-library, dropping all other GRIB decoding options.
10+
See: `#95 <https://github.com/ecmwf/cfgrib/issues/95>`_,
11+
`#14 <https://github.com/ecmwf/cfgrib/issues/14>`_.
12+
`#204 <https://github.com/ecmwf/cfgrib/issues/204>`_,
13+
`#147 <https://github.com/ecmwf/cfgrib/issues/147>`_ and
14+
`#141 <https://github.com/ecmwf/cfgrib/issues/141>`_.
815
- Many performance improvements during the generation of the index and during data access.
9-
See: `#142 <https://github.com/ecmwf/cfgrib/issues/142>`_.
16+
See: `#142 <https://github.com/ecmwf/cfgrib/issues/142>`_ and
17+
`#197 <https://github.com/ecmwf/cfgrib/issues/197>`_.
1018
- ``filter_by_keys`` now can select on all keys known to *ecCodes* without the need to
11-
add non default ones to ``read_keys`` explicitely.
19+
add non default ones to ``read_keys`` explicitly.
1220
See: `#187 <https://github.com/ecmwf/cfgrib/issues/187>`_.
1321
- Fixed issue where could not load a GRIB message that has only one grid point.
1422
See: `#199 <https://github.com/ecmwf/cfgrib/issues/199>`_.

README.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,30 @@ The high level API is designed to support a GRIB engine for `xarray <http://xarr
1111
and it is inspired by `netCDF4-python <http://unidata.github.io/netcdf4-python/>`_
1212
and `h5netcdf <https://github.com/shoyer/h5netcdf>`_.
1313
Low level access and decoding is performed via the
14-
`ECMWF ecCodes library <https://software.ecmwf.int/wiki/display/ECC/>`_.
14+
`ECMWF ecCodes library <https://software.ecmwf.int/wiki/display/ECC/>`_ and
15+
the `eccodes python package <https://pypi.org/project/eccodes>`_.
1516

1617
Features with development status **Beta**:
1718

1819
- enables the ``engine='cfgrib'`` option to read GRIB files with *xarray*,
1920
- reads most GRIB 1 and 2 files including heterogeneous ones with ``cfgrib.open_datasets``,
20-
- supports all modern versions of Python 3.9, 3.8, 3.7, 3.6 and PyPy3,
21+
- supports all modern versions of Python 3.9, 3.8, 3.7 and PyPy3,
2122
- the 0.9.6.x series with support for Python 2 will stay active and receive critical bugfixes,
22-
- works on *Linux*, *MacOS* and *Windows*, the *ecCodes* C-library is the only binary dependency,
23+
- works wherever *eccodes-python* does: *Linux*, *MacOS* and *Windows*
2324
- conda-forge package on all supported platforms,
2425
- reads the data lazily and efficiently in terms of both memory usage and disk access,
25-
- allows larger-than-memory and distributed processing via *dask*,
26+
- allows larger-than-memory and distributed processing via *xarray* and *dask*,
2627
- supports translating coordinates to different data models and naming conventions,
2728
- supports writing the index of a GRIB file to disk, to save a full-file scan on open.
2829

2930
Work in progress:
3031

31-
- **Alpha** install a ``cfgrib`` utility that can convert a GRIB file ``to_netcdf``
32+
- **Beta** install a ``cfgrib`` utility that can convert a GRIB file ``to_netcdf``
3233
with a optional conversion to a specific coordinates data model,
3334
see `#40 <https://github.com/ecmwf/cfgrib/issues/40>`_.
34-
- **Alpha** support writing carefully-crafted ``xarray.Dataset``'s to a GRIB1 or GRIB2 file,
35-
see the *Advanced write usage* section below and
36-
`#18 <https://github.com/ecmwf/cfgrib/issues/18>`_.
35+
- **Alpha/Broken** support writing carefully-crafted ``xarray.Dataset``'s to a GRIB1 or GRIB2 file,
36+
see the *Advanced write usage* section below, `#18 <https://github.com/ecmwf/cfgrib/issues/18>`_
37+
and `#156 <https://github.com/ecmwf/cfgrib/issues/156>`_.
3738

3839
Limitations:
3940

@@ -58,14 +59,14 @@ Python package from *PyPI* with::
5859
Binary dependencies
5960
-------------------
6061

61-
The Python module depends on the `eccodes python package <https://pypi.org/project/eccodes/>`_
62+
*cfgrib* depends on the `eccodes python package <https://pypi.org/project/eccodes>`_
6263
to access the ECMWF *ecCodes* binary library,
6364
when not using *conda* please follow the *System dependencies* section there.
6465

6566
You may run a simple selfcheck command to ensure that your system is set up correctly::
6667

6768
$ python -m cfgrib selfcheck
68-
Found: ecCodes v2.19.0.
69+
Found: ecCodes v2.20.0.
6970
Your system is ready.
7071

7172

@@ -82,9 +83,9 @@ Read-only *xarray* GRIB engine
8283
------------------------------
8384

8485
Most of *cfgrib* users want to open a GRIB file as a ``xarray.Dataset`` and
85-
need to have *xarray>=0.12.0* installed::
86+
need to have *xarray* installed::
8687

87-
$ pip install xarray>=0.12.0
88+
$ pip install xarray
8889

8990
In a Python interpreter try:
9091

@@ -827,7 +828,7 @@ See also the list of `contributors <https://github.com/ecmwf/cfgrib/contributors
827828
License
828829
=======
829830

830-
Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
831+
Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
831832

832833
Licensed under the Apache License, Version 2.0 (the "License");
833834
you may not use this file except in compliance with the License.

cf2cdm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
2+
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

cf2cdm/cfcoords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
2+
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

cf2cdm/cfunits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
2+
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

cf2cdm/datamodels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
2+
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

cfgrib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
2+
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

cfgrib/__main__.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
2+
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -61,11 +61,46 @@ def to_netcdf(inpaths, outpath, cdm, engine):
6161
ds = xr.open_dataset(inpaths[0], engine=engine) # type: ignore
6262
else:
6363
ds = xr.open_mfdataset(inpaths, engine=engine, combine="by_coords") # type: ignore
64+
6465
if cdm:
6566
coord_model = getattr(cf2cdm, cdm)
6667
ds = cf2cdm.translate_coords(ds, coord_model=coord_model)
68+
6769
ds.to_netcdf(outpath)
6870

6971

72+
@cfgrib_cli.command("dump")
73+
@click.argument("inpaths", nargs=-1)
74+
@click.option("--variable", "-v", default=None)
75+
@click.option("--cdm", "-c", default=None)
76+
@click.option("--engine", "-e", default="cfgrib")
77+
def dump(inpaths, variable, cdm, engine):
78+
# type: (T.List[str], str, str, str) -> None
79+
import xarray as xr
80+
81+
import cf2cdm
82+
83+
# NOTE: noop if no input argument
84+
if len(inpaths) == 0:
85+
return
86+
87+
if len(inpaths) == 1:
88+
# avoid to depend on dask when passing only one file
89+
ds = xr.open_dataset(inpaths[0], engine=engine) # type: ignore
90+
else:
91+
ds = xr.open_mfdataset(inpaths, engine=engine, combine="by_coords") # type: ignore
92+
93+
if cdm:
94+
coord_model = getattr(cf2cdm, cdm)
95+
ds = cf2cdm.translate_coords(ds, coord_model=coord_model)
96+
97+
if variable:
98+
ds_or_da = ds[variable]
99+
else:
100+
ds_or_da = ds
101+
102+
print(ds_or_da)
103+
104+
70105
if __name__ == "__main__": # pragma: no cover
71106
cfgrib_cli()

cfgrib/cfmessage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
2+
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

cfgrib/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017-2020 European Centre for Medium-Range Weather Forecasts (ECMWF).
2+
# Copyright 2017-2021 European Centre for Medium-Range Weather Forecasts (ECMWF).
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)