include density in Earth Diagnostics
it would be very useful to include the possibility to calculate potential density with respect to different reference pressures from NEMO output.
These variables are useful for diagnosing water masses among many other things. Those commonly used are 3:
sigma0 -----> potential density anomaly with reference pressure of 0 dbar (surface)
sigma2 -----> potential density anomaly with reference pressure of 2000 dbar
sigma4 -----> potential density anomaly with reference pressure of 4000 dbar
the first one is actually available in NEMO but because it wasn't included in the CMIP data requests it was not saved for all experiments.
First possibility I have been generating these variables using octave with a set of scripts in matlab code. These are based on the Thermodynamic Equation of Seawater - 2010 (http://www.teos-10.org/) which is what NEMO uses internally.
The same scripts are also available in python (apparently):
Second possibility To use CDFTOOLS however, I haven't been able to generate anything with the default implementation available at BSC. Moreover, I couldn't find a detailed explanation of what's inside these functions. It might be that they are still based on the previous equation of state (EOS-80).
The functions to calculate the three variables above, for TEOS-10 are:
The input to the TEOS-10 functions are conservative temperature (bightetao) and absolute salinity (so)
The functions to calculate the three variables above, for CDFTOOLS are: cdfsig0 cdfsigi (specifying the reference depth)
the input to the cdftools functions are described generically as "temperature" and "salinity" which leaves me with the doubt if it refers to potential (thetao) or conservative temperature (bigthetao)