ecmwf / earthkit-data

A format-agnostic Python interface for geospatial data
Apache License 2.0
47 stars 9 forks source link

Implement writing GRIB data to FDB #323

Open sandorkertesz opened 4 months ago

sandorkertesz commented 4 months ago

Is your feature request related to a problem? Please describe.

We can already write earthkit-data GRIB data into an FDB as the https://earthkit-data.readthedocs.io/en/latest/examples/grib_fdb_write.html example demonstrates. The task is now to simplify this process and allow users to do it by simply calling a method on a FieldList.

Currently, a FieldList can only write into a file and the API consists of the save() and write() methods:

def save(self, filename, append=False, **kwargs):
      r"""Write all the fields into a file."""

def write(self, f, **kwargs):
     r"""Write all the fields to a file object."""

write() can also be called on a Field.

Now, the primary task is to extend this public API to allow for using a target in save(). It is not clear how to do it. Some possible solutions:

Organisation

ECMWF

tlmquintino commented 4 months ago

I quite like the .to_target(..) option as it is symmetric with the .from_source(..)

tlmquintino commented 4 months ago

I always found that the .save(..) methods were not in line with the rest of the methods naming / vocabulary.