Skip to content

Commit

Permalink
correct getting date list from aws (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhales authored Apr 10, 2024
1 parent bfb32ed commit 22c681c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion geoglows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
'bias', 'plots', 'data', 'analyze', 'streams', 'tables',
'METADATA_TABLE_PATH'
]
__version__ = '1.0.2'
__version__ = '1.0.3'
__author__ = 'Riley Hales'
__license__ = 'BSD 3-Clause Clear License'
6 changes: 4 additions & 2 deletions geoglows/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ def from_aws(*args, **kwargs):
else:
raise ValueError('Date must be YYYYMMDD or YYYYMMDDHH format. Use dates() to view available data.')
else:
dates = sorted([x.split('/')[-1] for x in s3.ls(ODP_FORECAST_S3_BUCKET_URI)])
dates = sorted([x.split('/')[-1] for x in s3.ls(ODP_FORECAST_S3_BUCKET_URI)], reverse=True)
dates = [x.split('.')[0] for x in dates if x.endswith('.zarr')] # ignore the index.html file
dates = [x.replace('00.zarr', '') for x in dates]
if product_name == 'dates':
return dates
return pd.DataFrame(dict(dates=dates))
date = dates[-1]
s3store = s3fs.S3Map(root=f'{ODP_FORECAST_S3_BUCKET_URI}/{date}', s3=s3, check=False)

Expand Down

0 comments on commit 22c681c

Please sign in to comment.