Skip to content

Commit

Permalink
improvements from Pey Lian's review
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed May 16, 2024
1 parent 770e738 commit ba5ca92
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jdaviz/configs/cubeviz/plugins/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


@data_parser_registry("cubeviz-data-parser")
def parse_data(app, file_obj, data_type=None, data_label=None, parent=None, cache=True):
def parse_data(app, file_obj, data_type=None, data_label=None, parent=None, cache=False):
"""
Attempts to parse a data file and auto-populate available viewers in
cubeviz.
Expand Down
21 changes: 18 additions & 3 deletions jdaviz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,23 @@ def download_uri_to_path(possible_uri, cache=False, local_path=None):
Retrieve data from a URI (or a URL). Return the input if it
cannot be parsed as a URI.
If ``possible_uri`` is a MAST URI, the file will be retrieved via
astroquery's `~astroquery.mast.Observations.download_file`.
If ``possible_uri`` is a URL, it will be retrieved via astropy with
`~astropy.utils.data.download_file`.
Parameters
----------
possible_uri : str or other
cache: bool, optional
Cache file after download. Default is False.
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: bool or "update", optional
Cache file after download. Default is False. If ``possible_uri`` is a
URL, ``cache`` may be a boolean or ``"update"``, see documentation for
`~astropy.utils.data.download_file` for details.
local_path : str, optional
Save the downloaded file to this path. Default is to
save the file with its remote filename in the current
Expand Down Expand Up @@ -437,5 +448,9 @@ def download_uri_to_path(possible_uri, cache=False, local_path=None):
elif parsed_uri.scheme.lower() in ['http', 'https', 'ftp']:
return download_file(possible_uri, cache=cache)

else:
raise ValueError(f"URI {possible_uri} with scheme {parsed_uri.scheme} is not "
f"currently supported.")

# assume this isn't a URI after all:
return possible_uri

0 comments on commit ba5ca92

Please sign in to comment.