-
Notifications
You must be signed in to change notification settings - Fork 84
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
search_data
& search_datasets
documentation parameter list is incomplete
#345
Comments
search_data
documentation includes cloud_hosted
parameter in example, but not in parameter listsearch_data
documentation parameter list is incomplete
I am currently working on updating the |
Hi, i have the same difficulties. I wanted to download AST L1T data and download it with a filter based on cloud coverage. Is it possible to print a dataframe with the dates and specifications such as Day/ night and cloud coverage? Thanks in advance |
Hey @paolodep36, thanks for posting your question! Is there a specific parameter you're expecting to see in the docs for
|
More confusion that I think comes from this docs problem: #478 In this case the undocumented parameter was |
More pain for our users: #504 (comment) I'm going to pin this. |
search_data
documentation parameter list is incompletesearch_data
& search_datasets
documentation parameter list is incomplete
I'm listing the parameters for Missing parameters from
Parameters in
Parameters in
|
Parameters for From
From
|
We shouldn't have to (or rather, I don't want us to ;) ) maintain parameter lists in the docstring. I'd love to hack on how we can get our autodoc tool to pick them up, but it may require some architectural changes! |
Having this automated would be great. I do wonder how information about what a keyword is/does get's into this workflow. |
Automating this might be quite tricky, but I'm not sure it's the route we should take. I believe we should avoid any attempt to exhaustively list supported keyword arguments within the docstring. In fact, I'm going to make a potentially controversial suggestion: we should consider deprecating Instead, we should encourage direct use of Short of such a potentially controversial change, something that might at least help users with the existing approach would be to provide type hints. In this case, my proposal would be to define a For example, something along the following lines: from typing_extentions import Union, Unpack
class SearchDatasetsKwargs(TypedDict, total=False):
"""Keyword arguments for finding collections via `earthaccess.search_datasets`.
Attributes:
short_name: value to pass to [earthaccess.DataCollections.short_name][]
...
"""
short_name: str
cloud_hosted: bool
provider: str
# ... and so on (one for each method that sets a query parameter)
class SearchDataKwargs(TypedDict, total=False):
"""Keyword arguments for finding granules via `earthaccess.search_data`.'
Attributes:
short_name: value to pass to [earthaccess.DataGranules.short_name][]
...
temporal: tuple of arguments to pass to [earthaccess.DataGranules.temporal][]
...
"""
short_name: str
cloud_hosted: bool
provider: str
temporal: tuple[...]
# ... and so on (one for each method that sets a query parameter)
def search_datasets(**kwargs: Unpack[SearchDatasetsKwargs]) -> List[DataCollection]:
...
def search_data(**kwargs: Unpack[SearchDataKwargs]) -> List[DataGranule]:
... This would at least give users of IDEs some help with auto-completion. Of course, this still requires a bit of maintenance effort, because whenever a new method for setting a query parameter is added, an attribute of the same name should be to the corresponding |
search_data
includes undocumented parametercloud_hosted
in its example.downloadable
parameter is not documented.Currently,
kwargs
are passed fromsearch_data
to aDataGranules
object'sparameters
method, which also acceptskwargs
. The possible keys are fixed by the methods onDataGranules
, and populated dynamically by matching keys to method names.earthaccess/earthaccess/api.py
Lines 116 to 119 in ff0c59a
The same technique is used for both data & dataset search functions.
However, the interface is untyped and the documentation is generated from a hand-maintained docstring. I feel we should move towards fully typing the interface and generating the docs from the annotations. Python's type system feels like a toy at times like this. How do we ensure that a
DataGranules
method exists for each parameter on thesearch_data
interface? Maybe we should instead collect the parameter methods in a dict? Just thinking out loud.The text was updated successfully, but these errors were encountered: