download_query_gemini

ndmapper.services.download_query_gemini(query, dirname='')[source] [edit on github]

Perform a user-specified Gemini science archive query and save the files returned to a specified directory.

Any existing files with the same names are overwritten, since there’s no way to avoid downloading them all as part of the query anyway. However, only files that pass their checksum comparison (or have no checksum, which shouldn’t happen) get written to disk. In the event that one or more files are corrupt, the caller can therefore re-try the query, omitting any files that were fetched successfully the first time if the query supports it.

The downloaded tar file is stored in memory while processing its contents, which should be optimal as long as the archive isn’t unreasonably large (to do: consider adding an option to write it to a temporary file).

Parameters:

query : str

The query URL (or just the path component) to request from the server.

dirname : str, optional

The (absolute or relative) directory path in which to place the files.