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

Consider adding convenience functions for loading data #162

Open
JamesVarndell opened this issue Aug 29, 2023 · 0 comments
Open

Consider adding convenience functions for loading data #162

JamesVarndell opened this issue Aug 29, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@JamesVarndell
Copy link
Collaborator

JamesVarndell commented Aug 29, 2023

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

At present, data is loaded into earthkit-data using the from_source(source, *args, **kwargs) function. This function is heavily overloaded, as the value of the source argument changes the valid args and kwargs.

For example, when loading a file, the call signature is essentially from_source(source, file_name) - but when loading data from the CDS, the signature becomes from_source(source, dataset, request).

This makes the function impossible to document in a standard way because the valid arguments change depending on the source. Given the wide (and increasing) range of valid source arguments, users will have to scan through a lot of documentation to find the arguments that apply to their particular source.

Describe the solution you'd like

I would like to see a from_{source_name} function for each source type, e.g. from_file, from_cds, from_url, from_fdb. The benefits of this approach are:

  • much easier to document - each function only takes one set of arguments
  • easier to quickly find functionality in modern text editors and Jupyter-notebooks - depending on string arguments for source in the current implementation relies on the user reading the documentation to find all valid source values, but function names work well with autocomplete to help users quickly find the functionality they need
  • easier to read - especially for sources like the CDS which take a longer list of arguments

Note that I'm not suggesting to remove the from_source function, but rather create convenience functions which essentially call from_source with the source argument pre-populated.

Describe alternatives you've considered

No response

Additional context

No response

Organisation

ECMWF

@JamesVarndell JamesVarndell added the enhancement New feature or request label Aug 29, 2023
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

1 participant