# New python package for water mass transformation calculation

**URL:** <https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084>\
**Category:** Ocean\
**Tags:** python, cosima-recipes\
**Created:** [7 May 2024 23:46 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084 "2024-05-07T23:46:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![adele-morrison](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/adele-morrison/32/90_2.png) [@adele-morrison](https://forum.access-hive.org.au/u/adele-morrison)\
**Post date:** [7 May 2024 23:46 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/1 "2024-05-07T23:46:45Z")

</div>

Henri Drake and friends (including @janzika) have developed a new python package for Water Mass Transformation Budgets, called `xwmb`.

The preprint describing it is [here](https://essopenarchive.org/doi/full/10.22541/essoar.171284935.57181910/v1). And the code is [here](https://github.com/hdrake/xwmb/tree/main), including an example notebook and even an example MOM6 diag\_table to output the correct diagnostics.

Henri says it is “designed to be readily adapted to output from other models such as MOM5, ROMS, MITgcm, Oceananigans, etc. If you are interested in using it for anything, I would be happy to help you get it up and running with your model output.”

Would there be any interest in having @janzika or Henri present this in a weekly COSIMA meeting?

Here’s an example application:

 ![Screenshot 2024-05-06 at 5.52.52 PM](https://us1.discourse-cdn.com/flex020/uploads/access1/original/2X/3/38f4a1c965575442ace9a3126ba6bfc91fe852d2.jpeg)

---

<div class="post-metadata">

**Author:** ![janzika](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/janzika/32/207_2.png) [@janzika](https://forum.access-hive.org.au/u/janzika)\
**Post date:** [8 May 2024 03:30 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/2 "2024-05-08T03:30:52Z")

</div>

Thanks for the plug Adele! I confess I am not actually a developer of the software package. My contribution was really to the theory in the paper. But from what I have played with it is a great package and initiative that welcomes contributors and users.

---

<div class="post-metadata">

**Author:** ![edoddridge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/edoddridge/32/108_2.png) [@edoddridge](https://forum.access-hive.org.au/u/edoddridge)\
**Post date:** [8 May 2024 05:06 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/3 "2024-05-08T05:06:57Z")

</div>

I’m keen to hear more about it at a weekly meeting.

@adele-morrison - looks like you are already in touch with Henri about this. Do you want to ask him? Alternatively, I’m happy to reach out.

---

<div class="post-metadata">

**Author:** ![taimoorsohail](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/taimoorsohail/32/201_2.png) [@taimoorsohail](https://forum.access-hive.org.au/u/taimoorsohail)\
**Post date:** [23 May 2024 00:46 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/4 "2024-05-23T00:46:16Z")

</div>

An immediate possible application of this could be producing transports (mass and tracer) aligned along and across isobaths around Antarctica using the `sectionate` function. If it’s significantly faster than existing methods, that could be a big plus.

---

<div class="post-metadata">

**Author:** ![taimoorsohail](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/taimoorsohail/32/201_2.png) [@taimoorsohail](https://forum.access-hive.org.au/u/taimoorsohail)\
**Post date:** [1 July 2024 05:06 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/5 "2024-07-01T05:06:54Z")

</div>

Hi everyone,

I think this package could be very useful to calculate along- and across section transports, eventually possibly replacing some of the COSIMA recipes (e.g.: [cosima-recipes/DocumentedExamples/Cross-contour\_transport.ipynb at main · COSIMA/cosima-recipes · GitHub](https://github.com/COSIMA/cosima-recipes/blob/main/DocumentedExamples/Cross-contour_transport.ipynb))

I know Henri is working on getting this on conda. It is available to download via pip. Is it possible for the CLEX CMS team to add this package to conda-unstable in the meantime, as I think it would be very helpful for Antarctic margins research especially? @dale.roberts

---

<div class="post-metadata">

**Author:** ![dale.roberts](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@dale.roberts](https://forum.access-hive.org.au/u/dale.roberts)\
**Post date:** [1 July 2024 05:46 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/6 "2024-07-01T05:46:49Z")

</div>

Hi @taimoorsohail. I’m afraid we only add packages that are available on certain conda channels. That being said, we recently published a blog post detailing how to install this exact package in a virtual environment on top of the conda/analysis3 environments: [Building custom python environments on top of conda/analysis3 — CLEX CMS Blog](https://coecms.github.io/posts/2024-06-05-mixing-python-envs.html). This was based on an example we gave another user who wanted `xwmb` installed. Once its on conda-forge, we’ll install it into the analysis3-unstable environment.

Edit: URL updated

---

<div class="post-metadata">

**Author:** ![Paola-CMS](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paola-cms/32/57_2.png) [@Paola-CMS](https://forum.access-hive.org.au/u/Paola-CMS)\
**Post date:** [13 November 2024 03:20 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/7 "2024-11-13T03:20:44Z")

</div>

New address for the CMS blogs: [CLEX CMS Blog — CLEX CMS Blog](https://coecms.github.io/index.html)

---

<div class="post-metadata">

**Author:** ![cbull](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/cbull/32/2203_2.png) [@cbull](https://forum.access-hive.org.au/u/cbull)\
**Post date:** [24 February 2026 11:48 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/8 "2026-02-24T11:48:08Z")

</div>

For those at OSM26 this workshop is on this week:

Wednesday, 25 February 2026  
13:00 - 15:00  
M5 (SEC)

> Water Mass Transformation (WMT) theory provides conceptual tools that in principle enable innovative analyses of numerical ocean models; in practice, however, these methods can be challenging to implement and interpret, and therefore remain under-utilized.

> Our aim is to demonstrate the feasibility of diagnosing all terms in the water mass budget and to exemplify their usefulness for scientific inquiry and model development by quantitatively relating water mass changes, overturning circulations, boundary fluxes, and interior mixing.

> This workshop will feature a broad introduction to classical WMT theory and provide hands-on tutorials of “xwmb”: a stack of xarray-enabled Python packages for evaluating WMT budgets in finite volume ocean models. Participants with varying degrees of knowledge of WMT theory and Python are welcome.

> ##### Moderators

> - [Graeme MacGilchrist](https://agu.confex.com/agu/osm26/meetingapp.cgi/Person/2201102)
> - University of St Andrews
> 
> - [Henri F Drake](https://agu.confex.com/agu/osm26/meetingapp.cgi/Person/223178)
> - University of California Irvine
> 
> ##### Presenter
> 
> - [Nelson Poumaere](https://agu.confex.com/agu/osm26/meetingapp.cgi/Person/1814325)
> - University of St. Andrews

source: [xwmb: Efficient and accurate water mass budgets in ocean models](https://agu.confex.com/agu/osm26/meetingapp.cgi/Session/272627)

---

<div class="post-metadata">

**Author:** ![hdrake](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/hdrake/32/3748_2.png) [@hdrake](https://forum.access-hive.org.au/u/hdrake)\
**Post date:** [24 February 2026 12:35 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/9 "2026-02-24T12:35:57Z")

</div>

Hey @cbull , thanks for plugging the workshop!

I took the opportunity to finally distribute `xwmb` and several of its dependent packges that I maintain (such as `sectionate` mentioned above) on conda-forge.

Happy to assist anyone interested in using the suite of packages to streamline existing recipes or make new ones!

---

<div class="post-metadata">

**Author:** ![navidcy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/navidcy/32/101_2.png) [@navidcy](https://forum.access-hive.org.au/u/navidcy)\
**Post date:** [24 November 2026 00:03 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/10 "2026-11-24T00:03:37Z")

</div>

I think this is a great suggestion!

---

<div class="post-metadata">

**Author:** ![nmalan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/nmalan/32/1174_2.png) [@nmalan](https://forum.access-hive.org.au/u/nmalan)\
**Post date:** [24 November 2026 01:19 UTC](https://forum.access-hive.org.au/t/new-python-package-for-water-mass-transformation-calculation/2084/11 "2026-11-24T01:19:49Z")

</div>

I’ve implemented it for cross-contour transport in [Cross-contour transport: use sectionate/regionate by nmalan · Pull Request #730 · COSIMA/cosima-recipes · GitHub](https://github.com/COSIMA/cosima-recipes/pull/730)

First pass seems to work well!
