pyoceans / sea-py

A collaborative effort to organize and distribute Python tools for the Oceanographic Community
https://pyoceans.github.io/sea-py/
Creative Commons Zero v1.0 Universal
53 stars 16 forks source link

OceanPy #40

Closed profxj closed 4 years ago

profxj commented 4 years ago

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 and constants. These have been very useful.

Please advise.

kwilcox commented 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?

ocefpaf commented 4 years ago

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.

daf commented 4 years ago

I do quite like the concept of a Quantity from astropy.units though.

profxj commented 4 years ago

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

ocefpaf commented 4 years ago

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.

ngoldbaum commented 4 years ago

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.

profxj commented 4 years ago

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.

profxj commented 4 years ago

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'.

profxj commented 4 years ago

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?

profxj commented 4 years ago

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.