Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change line 44 to include 0123 for day instead of 012 #173

Merged
merged 2 commits into from
Dec 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion siphon/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __getitem__(self, item):
class DatasetCollection(IndexableMapping):
"""Extend ``IndexableMapping`` to allow datetime-based filter queries."""

default_regex = re.compile(r'(?P<year>\d{4})(?P<month>[01]\d)(?P<day>[012]\d)_'
default_regex = re.compile(r'(?P<year>\d{4})(?P<month>[01]\d)(?P<day>[0123]\d)_'
r'(?P<hour>[012]\d)(?P<minute>[0-5]\d)')

def _get_datasets_with_times(self, regex):
Expand Down
10 changes: 10 additions & 0 deletions siphon/tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ def test_datasets_nearest_time():
assert nearest.title == 'NAM_CONUS_20km_noaaport_20150528_1800.grib1'


@recorder.use_cassette('top_level_20km_rap_catalog')
def test_datasets_nearest_time_30():
"""Test getting dataset by time; check for a day in the 30s (#gh-173)."""
url = ('http://thredds.ucar.edu/thredds/catalog/grib/NCEP/NAM/'
'CONUS_20km/noaaport/catalog.xml')
cat = TDSCatalog(url)
nearest = cat.catalog_refs.filter_time_nearest(datetime(2015, 5, 30, 11))
assert nearest.title == 'NAM_CONUS_20km_noaaport_20150530_1200.grib1'


@recorder.use_cassette('top_level_20km_rap_catalog')
def test_datasets_nearest_time_raises():
"""Test getting dataset by time using filenames."""
Expand Down