-
Notifications
You must be signed in to change notification settings - Fork 284
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
Gracefully handle long time intervals #2354
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# (C) British Crown Copyright 2013 - 2017, Met Office | ||
# (C) British Crown Copyright 2013 - 2018, Met Office | ||
# | ||
# This file is part of Iris. | ||
# | ||
|
@@ -323,5 +323,30 @@ def test_convert_unknown_units(self): | |
with self.assertRaisesRegexp(UnitConversionError, emsg): | ||
coord.convert_units('degrees') | ||
|
||
|
||
class Test___str__(tests.IrisTest): | ||
|
||
def test_short_time_interval(self): | ||
coord = DimCoord([5], standard_name='time', | ||
units='days since 1970-01-01') | ||
expected = ("DimCoord([1970-01-06 00:00:00], standard_name='time', " | ||
"calendar='gregorian')") | ||
result = coord.__str__() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of interest - why not use the built-in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To catch up an offline conversation – the reason is that in this test class I'm testing the literal |
||
self.assertEqual(expected, result) | ||
|
||
def test_long_time_interval(self): | ||
coord = DimCoord([5], standard_name='time', | ||
units='years since 1970-01-01') | ||
expected = "DimCoord([5], standard_name='time', calendar='gregorian')" | ||
result = coord.__str__() | ||
self.assertEqual(expected, result) | ||
|
||
def test_non_time_unit(self): | ||
coord = DimCoord([1.]) | ||
expected = repr(coord) | ||
result = coord.__str__() | ||
self.assertEqual(expected, result) | ||
|
||
|
||
if __name__ == '__main__': | ||
tests.main() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,5 @@ netcdf4 | |
numpy | ||
scipy | ||
# pyke (not pip installable) #conda: pyke | ||
cf_units | ||
cf_units>=1.2 | ||
dask>=0.17.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes Iris have a hard dependency on cf_units >= 1.2. We need to update the requirements to reflect that (or not have such a hard dependency)