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

filter_time_range() should return sorted results #261

Open
sgdecker opened this issue Jan 6, 2019 · 0 comments
Open

filter_time_range() should return sorted results #261

sgdecker opened this issue Jan 6, 2019 · 0 comments

Comments

@sgdecker
Copy link

sgdecker commented Jan 6, 2019

This code

from datetime import datetime, timedelta
from siphon.catalog import TDSCatalog
yesterday = date.utcnow() - timedelta(days=1)
start_time = yesterday.replace(hour=12, minute=0, second=0, microsecond=0)
end_time = start_time + timedelta(hours=6)
cat = TDSCatalog('http://thredds.ucar.edu/thredds/catalog/satellite/SFC-T/SUPER-NATIONAL_1km/'
                 '{dt:%Y%m%d}/catalog.xml'.format(dt=yesterday))
datasets = cat.datasets.filter_time_range(start_time, end_time)
print(datasets)

outputs

[SUPER-NATIONAL_1km_SFC-T_20190105_1800.gini, SUPER-NATIONAL_1km_SFC-T_20190105_1700.gini, SUPER-NATIONAL_1km_SFC-T_20190105_1600.gini, SUPER-NATIONAL_1km_SFC-T_20190105_1500.gini, SUPER-NATIONAL_1km_SFC-T_20190105_1400.gini, SUPER-NATIONAL_1km_SFC-T_20190105_1300.gini, SUPER-NATIONAL_1km_SFC-T_20190105_1200.gini]

It would be more natural to me if this list were in time-sorted order (first to last rather than vice versa).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant