Open rupesh2 opened 1 year ago
Thank you for the report! Looking at our API docs, I see we don't have any documentation of what the DataGranule
API looks like. I think we should resolve that as part of addressing this issue.
Looking at the code, I think we could also use type annotation for the possible values of access
, maybe an Enum
or union of Literal
strings...? Then our documentation-generator should be able to also document the valid values. I think. Not sure how this works in MkDocs :)
Hi @MattF-NSIDC , I found this documentation about data_links here: https://nsidc.github.io/earthaccess/user-reference/granules/granules/#earthaccess.results.DataGranule.data_links
Thanks for reporting this @rupesh2 and yes, I think the data_links
method should be more flexible as there are other type of URLs, for a user it should be as simple as this:
granules = earthaccess.search_data(...)
opendap_links = [g.data_links(type="OPeNDAP") for g in granules]
The link types earthaccess
currently use:
GET DATA
: HTTP access to the granule, can be one or many filesGET DATA VIA DIRECT ACCES
: The same as in GET DATA
but for S3 buckets, requires credentials to access the assetsGET RELATED VISUALIZATION
: Browse images from the granule if there are any, not exposed to the APIFor OPeNDAP I think the links are under USE SERVICE API
and then the subtype says OPENDAP DATA
, maybe there is a need for a dictionary that maps what we mean (as users) to where the the links will be in UMM... or like @MattF-NSIDC mentioned an Enum
. And of course these valid values should be exposed in the docstring.
@rupesh2 good find! I even searched for it and didn't get any results. Must have made a typo without realizing it. Thanks :)
I still think we need to explicitly type valid values here instead of Optional[str]
, and hopefully that results in clearer API documentation being generated too :)
@MattF-NSIDC I had to dig into a little to find that documentation link :) . Agree with you on need for clearer API documentation. @betolink great suggestions! Like you pointed out, it would be great if common UMM elements could be supported but in a user-friendly way.
Thank you for the great module. I see that
granule.data_links(access="direct")
will list alls3
links andgranule.data_links(access="external")
will list allhttps
links to the granules in the dataset. I could not find a way to retrieve OPenDAP URLs for a dataset. I am looking at the GEDI L4A granule, which has OPeNDAP links as follows:Thank you for your help!