Skip to content

Commit

Permalink
Fix date list (#38)
Browse files Browse the repository at this point in the history
* correct bug getting date list

* increment version number
  • Loading branch information
rileyhales authored May 30, 2024
1 parent 14ca779 commit 52c8ea9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
author = 'Riley Hales, PhD'

# The full version, including alpha/beta/rc tags
release = '1.6.2'
release = '1.6.3'
master_doc = 'index'

# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion geoglows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
'bias', 'plots', 'data', 'analyze', 'streams', 'tables', 'streamflow',
'get_metadata_table_path', 'set_metadata_table_path',
]
__version__ = '1.6.2'
__version__ = '1.6.3'
__author__ = 'Riley Hales'
__license__ = 'BSD 3-Clause Clear License'
12 changes: 2 additions & 10 deletions geoglows/_download_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,14 @@


def _forecast(function):
def _river_id_is_iterable(river_id):
return bool(
isinstance(river_id, list) or
isinstance(river_id, tuple) or
isinstance(river_id, set) or
isinstance(river_id, np.ndarray)
)

def from_aws(*args, **kwargs):
product_name = function.__name__.replace("_", "").lower()
if product_name == 'forecastrecords':
warnings.warn('forecast_records are not available from the AWS Open Data Program.')
return from_rest(*args, **kwargs)

river_id = args[0] if len(args) > 0 else kwargs.get('river_id', None)
if river_id is None:
if river_id is None and product_name != 'dates':
raise ValueError('River ID must be provided to retrieve forecast data.')

return_format = kwargs.get('format', 'df')
Expand Down Expand Up @@ -126,7 +118,7 @@ def from_rest(*args, **kwargs):
product_name = function.__name__.replace("_", "").lower()

river_id = args[0] if len(args) > 0 else kwargs.get('river_id', None)
if river_id is None:
if river_id is None and product_name != 'dates':
raise ValueError('River ID must be provided to retrieve forecast data.')
if not isinstance(river_id, (int, np.int64, )):
raise ValueError('Multiple river_ids are not available via REST API. Provide a single 9 digit integer.')
Expand Down
5 changes: 4 additions & 1 deletion geoglows/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import xarray as xr

from ._constants import get_metadata_table_path
from ._download_decorators import _forecast, _retrospective
from ._download_decorators import _forecast, _retrospective, DEFAULT_REST_ENDPOINT, DEFAULT_REST_ENDPOINT_VERSION

from .analyze import (
daily_averages as calc_daily_averages,
Expand All @@ -27,6 +27,9 @@
'return_periods',

'metadata_tables',

'DEFAULT_REST_ENDPOINT',
'DEFAULT_REST_ENDPOINT_VERSION',
]


Expand Down

0 comments on commit 52c8ea9

Please sign in to comment.