-
Notifications
You must be signed in to change notification settings - Fork 264
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
OverflowError: date value out of range in num2date #659
Comments
num2date can't handle dates before 0001-01-01. The first element in your times array (-657073) is before that date using the standard (mixed Julian/Gregorian) calendar. It works if you used |
Stand by - I think this may actually be a bug in how negative times are treated (I don't think the correct date is before 0001-01-01). |
fix in pull request #660 Can you confirm that the correct date for -657073 is 0001-01-01? |
Just checked using https://erddap.marine.ie/erddap/convert/time.html?n=-657073&units=days+since+1800-01-01T00%3A00%3A00Z and this is correct. I'll merge this tomorrow if there are no comments. |
fix for issue #659 (datetime used when it shouldn't be for negative times)
Thank you for your prompt response. Please go ahead with the merge. I do not have any comments. |
if your start_date is '2019-09-08' and end_date is '2019-09-01' ,then use those date in computition, the error "OverflowError: date value out of range in num2date " will be appeared. |
Hi,
I am trying to convert this object using num2date. However I get OverflowError: date value out of range
What could possibly cause this behaviour and how it can be fixed. Thanks.
<type 'netCDF4._netCDF4.Variable'>
float64 time(time)
units: days since 1800-01-01 00:00:0.0
long_name: Time
actual_range: [-657073. -656739.]
delta_t: 0000-01-00 00:00:00
avg_period: 0030-00-00 00:00:00
prev_avg_period: 0000-00-07 00:00:00
ltm_range: [ 58804. 69730.]
standard_name: time
axis: T
unlimited dimensions: time
current shape = (12,)
filling off
times = f.variables['time']
times[:]
array([-657073., -657042., -657014., -656983., -656953., -656922.,
-656892., -656861., -656830., -656800., -656769., -656739.])
times.units
u'days since 1800-01-01 00:00:0.0'
netCDF4.version
'1.2.7'
The text was updated successfully, but these errors were encountered: