dankelley / oce

R package for oceanographic processing
http://dankelley.github.io/oce/
GNU General Public License v3.0
143 stars 42 forks source link

Add isopycnal curves of neutral density to TSplot #1646

Closed gianmarcoingrosso closed 4 years ago

gianmarcoingrosso commented 4 years ago

Hi, I would like to add isopycnal curves of neutral density anomaly (http://www.teos-10.org/preteos10_software/neutral_density.html) to a TS plot (instead of potential density anomaly isopycnal levels, as in the figure attached). Any idea how to do this in R and with the oce package? In particular, I would like to draw the neutral density isopycnal 28.0 and 28.27. Thanks in advantage for your help. Best Gianmarco

Fig2

dankelley commented 4 years ago

If you do as below,

library(oce)
data(ctd)
plotTS(ctd,eos="gsw")

you'll get SA and CT axes, and potential density referred to the surface. Oce does not have the capability to show potential density referred to another pressure level, but that could be added. With that addition, oce would do as TEOS10 does (see https://github.com/TEOS-10/GSW-Matlab/blob/master/Toolbox/gsw_SA_CT_plot.m).

Notice that I have not used the phrase "neutral density" in this reply. To my knowledge, the literature dictates that the density lines are some form of potential density, as opposed to neutral density.

gianmarcoingrosso commented 4 years ago

Thanks for the answer. You are right about literature…but many fundamental studies about the Antarctic oceanography consider neutral density as a master variable for water mass characterization (e.g. Orsi and Wiederwohl, 2009 for the Ross Sea - and my data come from that area – or Azaneu et al., 2014). This is why I would like to add neutral density isopycnals to a tsplot (even if not formally correct…). Anyway, I followed your suggestion and this is the result. I also calculated the neutral density in another way (with Ocean Data View) and I have highlighted the points with neutral density values of 28.00 and 28.27 kg/m3 as below. Maybe this is the best solution that I can achieve at the moment… Probably we need a specific script to calculate the neutral density in R (as has been done for Matlab…see my previous link) and then we can derive neutral density isopycnals. TS_ASal_CTemp

dankelley commented 4 years ago

Your approach seems reasonable. I am not convinced that there is any agreed meaning (that is, literature context) attached to contours of neutral density on a CT-SA diagram.

As for your diagram, can you share your code so that we can see how you're computing neutral densities of 28.00 and 28.27? I don't see how you can be showing those exact values and getting finite-sized blobs on a diagram -- it seems to me that you must be using a range around each, or rounding numbers.

gianmarcoingrosso commented 4 years ago

I have calculated the neutral density with the software ODV (outside R, so I do not have the script to calculate neutral density...) and I have put the results into my R data frame. Then I have done the subset the points with neutral density of 27.9956 < x < 28.0044 (for 28.00) 28.2656 < x < 28.2744 (for 28.27)

dankelley commented 4 years ago

Thanks for the clarification. It seems to me, then, that you have a solution. If you agree, perhaps you can close the issue. (In oce we ask reporters to close issues, as a form of politeness; only in extreme circumstances do we declare an issue to be closed, if the reporter still has concerns.)

I do not know whether ODV is doing neutral density correctly, but that's up to you to determine or trust. One thing I would note, though, is that TEOS-10 does not (seem to) provide a function for computing neutral density. The site you quote (http://www.teos-10.org/preteos10_software/neutral_density.html) is for "pre TEOS-10" software.

Perhaps @richardsc has some further comments about these matters.

gianmarcoingrosso commented 4 years ago

What could be useful is to have the neutral density computation in R (a script or a specific command) in order to not use other software to calculate this variable...but probably this is outside my programming skills. Maybe you can think to add this function into oce. But if you are not convinced on this, and if @richardsc do no have comments, we consider the issue closed.

dankelley commented 4 years ago

I do not think there is an agreed-upon method for computing neutral density. For example, Figure 10 of Klocker et al (2008) shows several schemes from the literature. This demonstrates that (a) there is no single scheme and (b) the differences between the schemes studied by these authors are large in practical terms.

Another point of reference is that the GSW/TEOS10 system does not provide code for computing 'neutral density'. Oce gets its TEOS10 computations from the gsw R package, which in turn uses the C version of the GSW/TEOS10 code. Since the C code lacks a specification of neutral density, oce does not offer that.

I have no idea what ODV is doing, and it is closed source, so there is no way to check. Anyway, it is not definitive. The definitive product is the GSW/TEOS10 system.

  1. Klocker, Andreas, T. Mcdougall, and D. R. Jackett. “A New Method for Forming Approximately Neutral Surfaces.” Ocean Science Discussions 5 (August 1, 2008): 419–70. https://doi.org/10.5194/os-5-155-2009.
gianmarcoingrosso commented 4 years ago

it is more complex than I thought...I don't think I'm gonna be able to resolve this issue in the way I'd like to. Anyway, thank you very much for your help and explanation. it was very useful to understand the problem. If I will find something I will post it here.

dankelley commented 4 years ago

Thanks. I'll close the issue, since the originating query has been addressed. Please bear in mind that you can see all the closed issues on github, and that you can comment on them (the developers will get an email if you do). You can also reopen the issue, if you wish to do so.

I could imagine asking contours of neutral density at some point, but the papers suggesting alternative formulations have so far spanned over 20 years, so my guess is that we may not have an agreed-upon formulation in the immediate future. (Basically, if the TEOS-10/GSW working group proposes an official formula, then oce will likely incorporate it within weeks.)