NOAA-GFDL / xwmt

Python package for water mass transformation analysis that leverages xarray functionality
https://xwmt.readthedocs.io/
MIT License
7 stars 5 forks source link

Improve modularity of code base? #7

Open gmacgilchrist opened 2 years ago

gmacgilchrist commented 2 years ago

As far as I can see, almost all of the relevant code for the calculation of SMWT is contained within the swmt class (with the exception of a few calculations loaded from the compute module). For me, this makes the organization of the code a bit confusing and difficult to follow. It also seems to make testing out different parts of the code challenging (as evidenced by a number of repeated functions in the compute module). Furthermore, I think having things arranged in this way will make further developments harder (for example when requiring a density calculation for 3D WMT, and thus having to repeat it all within a new class).

I'm not sure of the best way to arrange things, and that is open to discussion. In the first instance, I could imagine having separate modules for different aspects of the calculation, in particular the thermodynamic calculations (density, alpha, beta, density tendency), the processing calculations (i.e. deriving hldot given various inputs), and the wmt calculations (where the tendencies are integrated, or the transformation maps derived).