Replies: 10 comments
-
I need a MOD09GA CMR search client. I was going to try to implement a CLI interface to this tool. As per Contributing.md I am writing here to I assume Shall we define an interface here, and then I can program to that interface? Program name: Maybe something like: earthaccess (search ((--csv | --json) (--collection | --granule)) | download) [--keyword KEY --concept-id ID --bbox xmin ymin xmax ymax --output-folder --etc...] |
Beta Was this translation helpful? Give feedback.
-
I tend to prefer higher abstractions in general but argparse it's fine. I like the options you described in the example, they capture well what config.json {
"params": {["all the search parameters"]},
"lastRun": {
"total_downloaded": 124445,
"start_range": "1998-10-03T00:00:00",
"end_date": "2022-10-03T00:00:00",
"last_updated": "2022-10-03T00:00:00"
},
} |
Beta Was this translation helpful? Give feedback.
-
actually... the config file could be just for searching and the stats on returned items and downloaded granules from the last run could be dumped into another file, again this is just an idea just for having some observability on what we have done with our downloads. |
Beta Was this translation helpful? Give feedback.
-
I'd definitely prefer |
Beta Was this translation helpful? Give feedback.
-
And copying over @andypbarrett's message from Slack:
Notably, ASF also provides a Python bulk download script to get your search results, which is handy and well used. Another take on that is ASF's Vertex at https://search.asf.alaska.edu, which lets you "export Python" from a search. The exported code provides you a way to get your same search results via the which gives you a Python code block like: import asf_search as asf
options = {
'intersectsWith': 'POINT(-140.4916 59.9632)',
'dataset': 'SENTINEL-1',
'processingLevel': 'SLC',
'flightDirection': 'Ascending',
'beamSwath': 'IW',
'maxResults': 250
}
results = asf.search(**options)
print(results) I think implementing a feature like this in Earthdata Search that uses Earthaccess should be pretty straight forward, and a general download script could be just scriptify-ing that or providing a config file to pass to an So it'd be nice to ether target or keep this in mind when developing the CLI tool |
Beta Was this translation helpful? Give feedback.
-
As for a config file, I don't generally like only driving off a config/ini file, so I like this example:
but it'd be nice to set it up so you could also use a config/ini file to pass in the options. Argparse and I'm sure click and others support setting that up |
Beta Was this translation helpful? Give feedback.
-
I also prefer |
Beta Was this translation helpful? Give feedback.
-
I think for the python snippet from Earthdata Search, combining search and download into a single retrieve option would be better option. I suspect most users will want to access the data in some way rather than just getting search results. That does raise the question of whether a user wants to
If downloading, results is a list of filepaths. If it is streaming, it is a list of fileobjects. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure I agree, though I'm not opposed to a A code snippet similar to our README, would be more than sufficient IMO: import earthaccess
results = earthaccess.search_data(
short_name='SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205',
cloud_hosted=True,
bounding_box=(-10, 20, 10, 50),
temporal=("1999-02", "2019-03"),
count=10
)
# Download the data
files = earthaccess.download(results)
# OR stream data directly to xarray
import xarray as xr
ds = xr.open_mfdataset(earthaccess.open(results))
# OR get a list of URLs
data_links = [granule.data_links(access="external") for granule in results] |
Beta Was this translation helpful? Give feedback.
-
💯 I think the script should line up with the Earthdata search user experience, i.e. first I search, then I look at my results, then I perhaps revise my search, then I download. Perhaps the script could even have a review stage where the data to be downloaded is presented to the user and they're offered the option to continue Y/n, giving them the opportunity to revise the search if they haven't already. |
Beta Was this translation helpful? Give feedback.
-
It would be handy to use the library in a stand-alone mode with a command line interface (CLI), this way we can cover more use cases. The idea is to support most if not all of the current features including search and access.
Beta Was this translation helpful? Give feedback.
All reactions