Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement writing GRIB data to FDB #323

Open
sandorkertesz opened this issue Feb 26, 2024 · 2 comments
Open

Implement writing GRIB data to FDB #323

sandorkertesz opened this issue Feb 26, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sandorkertesz
Copy link
Collaborator

sandorkertesz commented Feb 26, 2024

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:

  • use different method names for each target:
     ds.to_file(filename, append=False, **kwargs)
     ds.to_fdb(fdb_object, **kwargs)
  • add all options to save():
     ds.save(target="file", fileName="data.grib", append=False, **kwargs)
     ds.save(target="fdb", fdb=fdb_object, **kwargs)
  • use a to_target() method:
     ds.to_target("file", fileName, append=True, **kwargs)
     ds.to_target("fdb", fdb_oject, **kwargs)

### Organisation

ECMWF
@sandorkertesz sandorkertesz added the enhancement New feature or request label Feb 26, 2024
@sandorkertesz sandorkertesz self-assigned this Feb 26, 2024
@tlmquintino
Copy link
Member

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

@tlmquintino
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants