download_uri_to_path#
- jdaviz.utils.download_uri_to_path(possible_uri, cache=None, local_path='.', timeout=None, dryrun=False)[source]#
Retrieve data from a URI (or a URL). Return the input if it cannot be parsed as a URI.
If
possible_uriis a MAST URI, the file will be retrieved via astroquery’sdownload_file. Ifpossible_uriis a URL, it will be retrieved via astropy withdownload_file.- Parameters:
- possible_uristr or other
This input will be returned without changes if it is not a string, or if it is a local file path to an existing file. Otherwise, it will be parsed as a URI. Local file URIs beginning with
file://are not supported by this method – nor are they necessary, since string paths without the scheme work fine! Cloud FITS are not yet supported.- cache: None, bool, or ``”update”``, optional
Cache file after download. If
possible_uriis a URL,cachemay be a boolean or"update", see documentation fordownload_filefor details. If cache is None, the file is cached and a warning is raised suggesting to setcacheexplicitly in the future.- local_pathstr, optional
Save the downloaded file to this path. Default is to save the file with its remote filename in the current working directory. This is only used if data is requested from
astroquery.mast.- timeoutfloat, optional
If downloading from a remote URI, set the timeout limit for remote requests in seconds (passed to
download_fileortimeout).- dryrunbool
Set to
Trueto skip downloading data from MAST. This is only used for debugging.
- Returns:
- possible_uristr or other
If
possible_uricannot be retrieved as a URI, returns the input argument unchanged. Ifpossible_urican be retrieved as a URI, returns the local path to the downloaded file.