Closed profxj closed 4 years ago
Hi @profxj! In general the python ocean community uses https://github.com/SciTools/cf-units for units and unit conversions. It is a dependency of many of the projects and tools. Does that package solve your needs?
Hi @profxj, while having things in a single package may be handy, keeping a tidy code base and contributing to upstream may improve code quality a lot.
Like @kwilcox mentioned cf-units
is "the oceanographic" standard and, if the units you need are not there, you may contribute to udunits2
so the units will make into cf-units "automatically."
I'm closing this b/c it is not an issue we can address here (it is an open ended question) but feel ask more here even with the issue closed.
Just took a look at https://github.com/SciTools/cf-units
it's fine but is much less developed than what is in astropy
.
And I'll admit I got myself up and running before you responded. Here is my sandbox: https://github.com/profxj/oceanpy/tree/units
and here it is in action a bit (with constants
and
forces
):
https://nbviewer.jupyter.org/github/profxj/ocea200/blob/hw4/hw/4/HWSET_4.ipynb
I do quite like the concept of a Quantity from astropy.units though.
Indeed that is nice. Note that we should be using unyt
instead of astropy
. See https://pypi.org/project/unyt/
That is a "factored out" version for all communities and not specific to astronomy. Back in 2018 @pelson and I had a meeting with @ngoldbaum to join forces but nothing was outlined. The problem is that the Earth Sciences is "locked" with udunits2
. However, nothing prevents us from adding more oceanographic units to unyt
.
Hi, lead developer of unyt
here!
I'd love to have some oceanographers kick the tires and let me know what functionality you're missing. Please feel free to open issues with feature requests or bug reports after you've given it a try.
Ok, I could be persuaded to head to unyt
, especially since @ngoldbaum is such a cool dude! :)
And what is this community doing about constants
?
I'll add that what is in my oceanpy
already has the astronomy factored out.
Was easy.
And while I have the mic, I want to emphasize how valuable astropy
has been to the astronomical community (especially the observers).
Having to deal with 5+ repositories just doesn't work for the 'average joe or jane'.
Let me go one step further and suggest a meeting of the minds, i.e. a Zoom chat given our wide physical separation. Not sure where anyone on this thread lives, but I bet early California time will work.
How about this Friday November 1 at 8am PDT?
Ok, @ngoldbaum convinced me to use unyt
.
This branch does so and includes a few custom Oceanography constants
added to the unyt
name space:
https://github.com/profxj/oceanpy/blob/forces3/oceanpy/constants/oceandata2019.py
And here is a simple calculation too. https://github.com/profxj/oceanpy/blob/forces3/docs/nb/Forces.ipynb
I should still love to have a broader discussion on what might best benefit the Oceanography community. But apparently that may need to wait a bit.
I am interested in help to develop code for Oceanography similar to what exists in the Astronomy community (especially astropy). It appears to me the best place to do this is in the
python-oceans
repo, but I post this here to ask for guidance.The first thing I'd be likely to do is port the units package from
astropy
andconstants
. These have been very useful.Please advise.