# New Python package for Neutral Surfaces

**URL:** <https://forum.access-hive.org.au/t/new-python-package-for-neutral-surfaces/250>\
**Category:** Ocean\
**Tags:** python\
**Created:** [7 December 2022 22:53 UTC](https://forum.access-hive.org.au/t/new-python-package-for-neutral-surfaces/250 "2022-12-07T22:53:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![geoffstanley](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/geoffstanley/32/263_2.png) [@geoffstanley](https://forum.access-hive.org.au/u/geoffstanley)\
**Post date:** [7 December 2022 22:53 UTC](https://forum.access-hive.org.au/t/new-python-package-for-neutral-surfaces/250/1 "2022-12-07T22:53:13Z")

</div>

Hi there good people,

I’m pleased to release [neutralocean](https://github.com/geoffstanley/neutralocean) to the world. It’s a Python package to calculate neutral surfaces in the ocean. Currently, the main job is to compute ω-surfaces, which solve a global optimization problem to reduce the neutrality error by typically 1-2 orders of magnitude compared to potential density surfaces.

So if you ever calculate isopycnals using potential density, specific volume anomaly, Jackett & McDougall’s 1997 γⁿ neutral density, or others, bear in mind that these are often not terribly accurate in terms of being aligned with the directions in which the ocean mixes rapidly (“isopycnal” or “epineutral” mixing), and being orthogonal to the directions in which the ocean mixes very weakly (“diapycnal” or “dianeutral” mixing). Consider using ω-surfaces for such analyses.

Also, if you think you need a 3D density variables (like the above), sometimes these analysis can actually be done using 2D surfaces (like ω-surfaces), perhaps 1 of them, perhaps 2 of them very slightly apart (to get layer thickness and potential vorticity), or perhaps a whole set of them.

And feel free to reach out to me with questions.

Geoff

P.S. There’s also a [MATLAB version](https://github.com/geoffstanley/neutral-surfaces), which can calculate geostrophic streamfunctions and some other advanced neutral surfaces, but only works on rectilinear grids.

---

<div class="post-metadata">

**Author:** ![geoffstanley](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/geoffstanley/32/263_2.png) [@geoffstanley](https://forum.access-hive.org.au/u/geoffstanley)\
**Post date:** [7 December 2022 22:53 UTC](https://forum.access-hive.org.au/t/new-python-package-for-neutral-surfaces/250/2 "2022-12-07T22:53:50Z")

</div>

Here’s a few recent resources if you want to learn more about neutral surfaces:  
Watch: [One World Mathematics of Climate - April 5 2022 seminar](https://youtu.be/91RL0J1xwiw)

---

<div class="post-metadata">

**Author:** ![geoffstanley](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/geoffstanley/32/263_2.png) [@geoffstanley](https://forum.access-hive.org.au/u/geoffstanley)\
**Post date:** [7 December 2022 22:54 UTC](https://forum.access-hive.org.au/t/new-python-package-for-neutral-surfaces/250/3 "2022-12-07T22:54:22Z")

</div>

Read (background in Sections 1, 2): [https://doi.org/10.1016/j.ocemod.2019.01.008](https://doi.org/10.1016/j.ocemod.2019.01.008)  
Read (for ω-surfaces especially): [https://doi.org/10.1029/2020MS002436](https://doi.org/10.1029/2020MS002436)

(it only lets me put 2 links per post…)

---

<div class="post-metadata">

**Author:** ![Aidan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aidan/32/42_2.png) [@Aidan](https://forum.access-hive.org.au/u/Aidan)\
**Post date:** [7 December 2022 23:27 UTC](https://forum.access-hive.org.au/t/new-python-package-for-neutral-surfaces/250/4 "2022-12-07T23:27:43Z")

</div>

Cool. And a `conda` package on `conda-forge`. Nice!

You, or a CLEX person, should request it be [installed in the CLEX supported anaconda environment](http://climate-cms.wikis.unsw.edu.au/Conda#Requesting_new_packages) to make it easily available to folks using NCI.

---

<div class="post-metadata">

**Author:** ![geoffstanley](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/geoffstanley/32/263_2.png) [@geoffstanley](https://forum.access-hive.org.au/u/geoffstanley)\
**Post date:** [8 December 2022 00:06 UTC](https://forum.access-hive.org.au/t/new-python-package-for-neutral-surfaces/250/5 "2022-12-08T00:06:10Z")

</div>

Awesome, thanks for the suggestion Aidan! I’ve just emailed `cws_help@nci.org.au` now.

Yeah, getting it onto `conda-forge` took a bit of brainpower! So many steps, so many instructions to read…
