From e3669ff095b644a88397fd423a893b5d6510b3cb Mon Sep 17 00:00:00 2001 From: Pete Pokrandt Date: Fri, 1 Dec 2017 15:30:49 -0600 Subject: [PATCH 1/2] Change line 44 to include 0123 for day instead of 012. Change email --- siphon/catalog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siphon/catalog.py b/siphon/catalog.py index 2ef9eb4f8..4f158c5f3 100644 --- a/siphon/catalog.py +++ b/siphon/catalog.py @@ -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\d{4})(?P[01]\d)(?P[012]\d)_' + default_regex = re.compile(r'(?P\d{4})(?P[01]\d)(?P[0123]\d)_' r'(?P[012]\d)(?P[0-5]\d)') def _get_datasets_with_times(self, regex): From 107815502e1f1293de23f52dae91ed63b48d8fdd Mon Sep 17 00:00:00 2001 From: Ryan May Date: Mon, 4 Dec 2017 16:43:17 -0700 Subject: [PATCH 2/2] Add test for regex fix in #172 --- siphon/tests/test_catalog.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/siphon/tests/test_catalog.py b/siphon/tests/test_catalog.py index 0d850299f..e1418c657 100644 --- a/siphon/tests/test_catalog.py +++ b/siphon/tests/test_catalog.py @@ -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."""