Skip to content

Commit

Permalink
remove shapely dependency, default data source to aws
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyhales committed Apr 9, 2024
1 parent 42365c3 commit 9cdac31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 12 additions & 0 deletions geoglows/_plots/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
annual_averages as plotly_annual_averages
)

__all__ = [
'forecast',
'forecast_stats',
'forecast_ensembles',
'retrospective',
'daily_averages',
'monthly_averages',
'annual_averages',
'daily_variance',
'flow_duration_curve',
]


def forecast(df: pd.DataFrame, *,
plot_type: str = 'plotly',
Expand Down
5 changes: 2 additions & 3 deletions geoglows/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def from_aws(*args, **kwargs):
df = xr.open_zarr(s3store).sel(rivid=reach_id).to_dataframe().round(2).reset_index()

# rename columns to match the REST API
if type(reach_id) is list:
if isinstance(reach_id, list):
df = df.pivot(columns='ensemble', index=['time', 'rivid'], values='Qout')
else:
df = df.pivot(index='time', columns='ensemble', values='Qout')
Expand Down Expand Up @@ -149,13 +149,12 @@ def from_rest(*args, **kwargs):
raise ValueError(f'Unsupported return format requested: {return_format}')

def main(*args, **kwargs):
source = kwargs.get('data_source', 'rest')
source = kwargs.get('data_source', 'aws')
assert source in ('rest', 'aws'), ValueError(f'Unrecognized data source requested: {source}')
if source == 'rest':
return from_rest(*args, **kwargs)
else:
return from_aws(*args, **kwargs)

return main


Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ fastparquet
requests
pandas
plotly>=5
shapely>=2
scipy>=1
s3fs
numpy>=1
Expand Down

0 comments on commit 9cdac31

Please sign in to comment.