-
Notifications
You must be signed in to change notification settings - Fork 262
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
Ncdump reports times like "2015-03-12 12:19:60.000000" #1928
Comments
What should it look like? |
Sorry, I would say it should look like
The current representation with "00:49:60.000000" is an invalid specification of time. Consider:
|
There appears to be a second issue not mentioned yet:
Am I missing something? |
This current problem, printing 60 seconds, was previously reported in e-support WSC-538180. There is some analysis in those messages, identifying a problem with roundoff error. |
The reason is the same, but in this case the problem can be solved properly. |
The analysis in the cited support thread is correct:
But apparently the proposed fix was never implemented. |
Actually 59.999999986030161 rounds to 60.0000000 not 59.9999999 (because the next digit in the unrounded double is 8 which exceeds 5 so standard rules dictate rounding up). In other words, |
I guess I was not clear. Do we want rounding or do we want truncation at the nth digit |
I vote for rounding. |
In order to check for rounding, I will need to define a constant |
I'm not sure I understood the previous question, and I think there may be a better solution. Please see
This seems to work fine, and I'm unsure whether you would consider this truncation (because of casting to |
AFAIK libdispatch/nctime.c does not appear to use udunits. |
I just noticed that PR #1864 Was this intentional? |
Ncdump reports times like "2015-03-12 12:19:60.000000" Unidata#1928 Imposes a microsecond accuracy on dumped time representation
@DennisHeimbigner, It is not a side effect, but rather a fix. I have filed a pull request that enforces a microsecond accuracy of time dump. |
Fixed in #1937 |
Thank you! Indeed, it is kind-of a dirty fix. I can, probably, construct a case when it fails. The core reason is floating-point data behind the time variable. That is why in Silam we use integers for time output. I believe the ultimate way would be to use two separate times for two different use cases:
That is definitely a major work, but having it done properly one does not have to deal with time-rounding issues anymore. Half-solution would be to use a double-precision-based time for seconds (currently it is for days, if i got it right), then any not-too-distant time with whole seconds can be represented exactly. Any thoughts on that would be appreciated. |
The libdispatch/nctime code came from somewhere else. Perhaps there is a newer package |
These times are difficult to read for human, and are perfectly capable of breaking many time-parsing routines..
The issue is reproducible with the latest master as of now (08da640) .
Way to reproduce:
$ cat timedump.ncd
$ ncgen -o timedump.nc timedump.ncd
$ ncdump -t timedump.nc
The output is
Thank you!
The text was updated successfully, but these errors were encountered: