-
Notifications
You must be signed in to change notification settings - Fork 0
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
Handle more second subdivisions #18
Comments
So far, the smallest time units is milliseconds as internally that is the precision of the time stamp. We follow the approach of the I am wondering if in your use-case, sub-millisecond precision is important? As far as I can see, we could:
|
Hi, Thanks for your thoughts.
At least for my use case it is not important, but it may be important for others. Netcdf files are produced that way by at least one package and maybe other tools. It would just be nice to be able to read them into Julia without too much fiddling.
Fine for me, and probably the easiest way until someone complains about missing time resolution. 🤷
I guess that may be where it comes from, quite often the times in numpy are listed as
Python's
That would mean:
|
Hi there, Anyway, regardless of the internal representation, it would be nice if
The prefixes can be found in https://docs.unidata.ucar.edu/udunits/current/udunits2-prefixes.xml. The easiest way would be to round to the nearest millisecond then. |
Here are some experiments that I did a while ago: The idea is to just wrap the time as-is in a struct and use units and time origin as type parameters. Time units and origin would be flexible and we can use the type specialization of the julia compiler. |
The current master is a big internal change relative to the previous version (see https://juliageo.org/CFTime.jl/latest/#Internal-API) I tried to keep the API compatible. In my tests, the performance is also ok (in particular when comparing to python as we have the flexibility python's cftime with the performance of numpy).
|
Ahh ok, best not to push it through quickly then. I've started putting breaking changes in another I can just comment out some tests in Rasters for now to take the pressure off, but we could also release the patch on a branch off the last released version |
OK, I made a separate branch from 0.1.3 with the zero function (zero_fun no pun intended :-)) Version 0.1.4: |
But the benchmarks here look pretty good to me. At JuliaEO you mentioned some type instability? |
Yes, if previously you had: struct MyStuct
dt::DateTimeStandard
end you must use now: struct MyStuct{T1,T2}
dt::DateTimeStandard{T1,T2}
end to make the field |
Describe the bug
Some netcdf files produced by python's
xarray
have time unitsnanoseconds since <datetime>
.Those are not yet handled by NCDataset via CFTime (JuliaGeo/NCDatasets.jl#192).
Supporting additional second subdivisions in
timedecode()
would be appreciated, such asmicrosecond
andnanosecond
. This would also be consistent with python's handling, see JuliaGeo/NCDatasets.jl#181 (comment).To Reproduce
Expected behavior
Same result as with
seconds
:Environment
The text was updated successfully, but these errors were encountered: