Skip to content

Commit

Permalink
add warning if user is accessing data outside NSIDC bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
rwegener2 committed Nov 2, 2023
1 parent 11625ec commit 0f18d56
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions icepyx/core/validate_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,16 @@ def tracks(track):
warnings.warn("Listed Reference Ground Track is not available")

return track_list

def check_s3bucket(path):
"""
Check if the given path is an s3 path. Raise a warning if the data being referenced is not
in the NSIDC bucket
"""
split_path = path.split('/')
if split_path[0] == 's3:' and split_path[2] != 'nsidc-cumulus-prod-protected':
warnings.warn(
's3 data being read from outside the NSIDC data bucket. Icepyx can '
'read this data, but available data lists may not be accurate.', stacklevel=2
)
return path
2 changes: 1 addition & 1 deletion icepyx/core/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(

# Set the product and version from either the input args or the file
if path:
self._path = path
self._path = val.check_s3bucket(path)
self._product = is2ref.extract_product(self._path, auth=self.auth)
self._version = is2ref.extract_version(self._path, auth=self.auth)
elif product:
Expand Down

0 comments on commit 0f18d56

Please sign in to comment.