You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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 thesource
argument changes the validargs
andkwargs
.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 becomesfrom_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:source
in the current implementation relies on the user reading the documentation to find all validsource
values, but function names work well with autocomplete to help users quickly find the functionality they needNote that I'm not suggesting to remove the
from_source
function, but rather create convenience functions which essentially callfrom_source
with thesource
argument pre-populated.Describe alternatives you've considered
No response
Additional context
No response
Organisation
ECMWF
The text was updated successfully, but these errors were encountered: