-
Notifications
You must be signed in to change notification settings - Fork 190
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
What time attribute should Oceananigans use for NetCDF? #1421
Comments
I noticed this change last week but I thought it was intentional. I don't have a strong opinion here. If we're trying to cater to more inexperienced users (of which Oceananigans will probably attract a lot of, since it's always portrayed as user-friendly) then it might make sense to try and guard against this somehow (since the errors you get when trying to do stuff with timedeltas that can't be done aren't very useful). Otherwise I'd say it's up to the user to deal with this, since on the Oceananigans end the change was (imho) for the better. |
Sounds like the consensus is to keep the new time attribute then. So I'll close the issue unless anyone has a strong opinion. What do other models do? If every model outputs time in "seconds" then maybe what Oceananigans.jl does is not too surprising. |
But Oceananigans doesn't really output time in "seconds", does it? The time unit is arbitrary, or depends on user inputs. |
Right, another reason to allow the user to specify the time attribute when using The default But right now it's not configurable by the user so I'll keep this issue open until this is resolved. |
Ah, because of the default |
Mmm yeah, I think settable units with a sensible default makes sense. There are a number of examples that are non-dimensional, so you might say that using Can spatial units be set? |
Are packages like Unitful.jl not mature enough to be used for these purposes? I understand this is a pretty extreme solution for this problem specifically, but It would be pretty cool if Oceananigans could understand units. |
Spatial attributes can be set but Oceananigans.jl assumes meters right now so more unit misattribution. If the time units can be set, then we should be able to set the spatial units.
I think it's mature enough but not I guess we're not sure where to use it (we discussed a bit in #1116). Would be perfect for specifying these kinds of units as long as it's not a heavy dependency. For other simulations, e.g. icy moons, it's nice to use rotation periods. Another place where units are assumed is |
That might work. I think using that might require a new quasi-global property like |
Ah that would be a good place for it. Maybe |
I mean, we can always assume the units are SI unless the user says otherwise, right? I think 90+% of Oceananigans runs are in SI, so it would make sense to assume that while making it easy for anyone to overwrite that with a keyword. That way 90+% of scripts wouldn't need any additional lines of code. |
Yeah if the default model assumes SI, then seems reasonable for the default metadata to assume SI. Unitful.jl looks pretty lightweight so might not be so bad to use it if we think it'll be useful: https://github.com/PainterQubits/Unitful.jl/blob/master/Project.toml |
Agree that SI default makes sense for a code called "Oceananigans". Note that some of the examples are non-dimensional, so an SI default will indeed add code to those examples --- which are likely some of the most-read scripts in the Oceananigans-verse. I also think for accessibility it could make sense to prioritize ease-of-use in a classroom context, where non-dimensional runs are the norm. |
Yeah either way we definitely want to make it easy to switch between dimensional and non-dimensional models so there may be some overlap with #1427. Was thinking for a complete specification we might need a unit for time, length, mass, and one for each tracer. Seems like we might as well go all the way and not just add units for length and time. |
Any movement here? Otherwise we might want to close it. |
Personally, I think things are working well as they are now. We're assuming time is in seconds, but also that positions are in meters and so on. We could create a flat in Ideally we'd solve this issue for Oceananigans as a whole by using |
Ok, lets shelve it for now. Thanks! |
Oceanangans.jl v0.51.0 changed the NetCDF time attribute from
to
so now some packages such as xarray decode the time dimension as a
timedelta
instead of just a plain floating-point number.Old behavior can be reproduced via the
decode_times=False
kwarg forxarray.open_dataset
.I think this is a good change but the unintended consequence surprised some users (cc @suyashbire1) so I'm opening this issue to see if we indeed want this. If we don't then we shouldn't add a time attribute (and provide a way for users to specify one).
@tomchor Maybe you have some thoughts since you've used NetCDF/xarray/Oceananigans.jl quite extensively.
The text was updated successfully, but these errors were encountered: