Skip to content

Commit 24e2c10

Browse files
authored
Bugfix/list of river numbers (#31)
* get many rivids at once from aws * update dependency list min versions
1 parent 22c681c commit 24e2c10

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

environment.yaml

+11-12
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ channels:
33
- conda-forge
44
dependencies:
55
- python>=3
6-
- dask
6+
- dask >=2024
77
- fastparquet
8-
- requests
9-
- pandas
10-
- plotly>=5
11-
- jinja2
12-
- shapely>=2
13-
- scipy>=1
14-
- s3fs
15-
- numpy>=1
16-
- hydrostats
178
- HydroErr
18-
- xarray
19-
- zarr
9+
- hydrostats
10+
- numpy >=1
11+
- pandas >=1
12+
- plotly >=5
13+
- requests
14+
- s3fs >=2024
15+
- scipy >=1
16+
- shapely >=2
17+
- xarray >=2024
18+
- zarr

geoglows/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
'bias', 'plots', 'data', 'analyze', 'streams', 'tables',
1212
'METADATA_TABLE_PATH'
1313
]
14-
__version__ = '1.0.3'
14+
__version__ = '1.0.4'
1515
__author__ = 'Riley Hales'
1616
__license__ = 'BSD 3-Clause Clear License'

geoglows/data.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def from_aws(*args, **kwargs):
4747
warnings.warn('forecast_records are not available from the AWS Open Data Program.')
4848
return from_rest(*args, **kwargs)
4949

50+
reach_id = kwargs.get('reach_id', '')
5051
reach_id = args[0] if len(args) > 0 else None
51-
reach_id = kwargs.get('reach_id', '') if not reach_id else reach_id
5252

5353
s3 = s3fs.S3FileSystem(anon=True, client_kwargs=dict(region_name=ODP_S3_BUCKET_REGION))
5454
if kwargs.get('date', '') and not product_name == 'dates':
@@ -71,10 +71,11 @@ def from_aws(*args, **kwargs):
7171
df = xr.open_zarr(s3store).sel(rivid=reach_id).to_dataframe().round(2).reset_index()
7272

7373
# rename columns to match the REST API
74-
if isinstance(reach_id, list):
75-
df = df.pivot(columns='ensemble', index=['time', 'rivid'], values='Qout')
76-
else:
74+
if isinstance(reach_id, int):
7775
df = df.pivot(index='time', columns='ensemble', values='Qout')
76+
else:
77+
df = df.pivot(index=['time', 'rivid'], columns='ensemble', values='Qout')
78+
df.index.names = ['time', 'LINKNO']
7879
df = df[sorted(df.columns)]
7980
df.columns = [f'ensemble_{str(x).zfill(2)}' for x in df.columns]
8081

requirements.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
dask
1+
dask>=2024
22
fastparquet
33
requests
4-
pandas
4+
pandas>=1
55
plotly>=5
66
scipy>=1
7-
s3fs
7+
s3fs>=2024
88
numpy>=1
99
hydrostats
1010
HydroErr
11-
xarray
11+
xarray>=2024
1212
zarr

0 commit comments

Comments
 (0)