ArgoCanada / argoFloats

Tools for analyzing collections of oceanographic Argo floats
https://argocanada.github.io/argoFloats/index.html
17 stars 7 forks source link

Update QC markdown #180

Closed j-harbin closed 4 years ago

j-harbin commented 4 years ago

I will do this once we finalize showQCTests(), however, I wanted to make an issue to keep it on my radar.

j-harbin commented 4 years ago

This has been completed in commit 98160b0bc60f2b15664a32aefc08f2989f751847 of the develop branch. The useAdjustedDiagram.png has also been added to docs/articles for when we merge to master and update the website. Please provide any feedback you see fit and if it gets the "OK", I will close this issue.

j-harbin commented 4 years ago

Hi Team,

I have tweaked the figure sizes/margins etc. in commit ed6f87d4dcc2285c976a36a4455b901e2441b1cc of the develop branch. Whenever you get a chance, could you consider the following:

A) Do you think the figure sizes are too large (that is only an easy fix) B) Why you think in the applyQC() example, the isopycnal lines do not cover the entire graph, as shown below:

Screen Shot 2020-07-30 at 8 46 51 AM

dankelley commented 4 years ago

As for (b), that's an oce thing. It doesn't try to extend isopycnals beyond S=50 because that is not in the "oceanic" range. That can be changed, of course, but I am not actually even sure that the algorithm used to compute density is documented to be valid in that range (I would have to check in some manuals that are locked up in my locked-down office).

I'm going to rebuild and read the vignette. I should be done by 0930h, and if you want, we could ms/t then.

j-harbin commented 4 years ago

That sounds great.

j-harbin commented 4 years ago

Add

 D <- data.frame(T = A[['temperature']], TF=A[['temperatureFlag']], S=A[['salinity']], SF=A[['salinityFlag']], P=A[['pressure']], PF=A[['pressureFlag']])

to QC vignette

j-harbin commented 4 years ago

Tweaks discussed with @dankelley in vtft have been completed in commit 1516a7b0379969e5d30136be784f058ec5a47bed of the develop branch. Whenever you get a chance, please take a look at provide feedback or directly edit yourself.

Thanks :)

j-harbin commented 4 years ago

HI @dankelley ,

I've taken some time to go over the QC markdown and made changes as I saw fit (commit 69f25b54e7897e2606c3cb7e981fabff1f5c86bf of the develop branch). I think at this point it may be a good idea when you get a chance to read it over and see if you like the overall flow. Some changes that I will note:

  1. In the QC section, I made it more "story" like and elaborated on output of code as opposed to showing a plot and moving on to the next function

  2. There is a FIXME in the QC section, which I hope is self explanatory. I more or less want to elaborate on the action required when the Density Inversion Test fails, and if that is what we see when we actually analyze the flags of the data. I was thinking we could look at this data together.

  3. In the useAdusted section, I added a profile plot to the example. One could argue that this may be redundant as we do show the significant difference in profiles using a linear regression, however, I argue it is important to show because it is good for the "story" approach, and it also shows the importance of both the use of our package AND basic R functions

  4. I took your advice and changed exercise 4 (FYI: Chlorophyll A raw vs adjusted is quite interesting)

j-harbin commented 4 years ago

@dankelley, I was going to send an email, but I figure it's better to have documentation via Github to be able to track in the future. Right now, if you go to https://github.com/ArgoCanada/argoFloats/blob/develop/sandbox/jlh/26_potentialDensity/potentialDensity.R , you'll be able to see I'm working on code for exercise 3 in the qc markdown that analyzes potential density of a specific float.

Note: I'm really liking this idea for an exercise in the qc markdown because it is demonstrating the connection between argoFloats, basic R functions, and oce.

What is interesting, however, is according to the Argo Quality Control Manual for CTD and Trajectory Data [1], the Density Inversion Test considers potential density with the reference point being the mid-point between Pi and the next valid pressure level. I see in oce, there are a variety of functions for potential density, however, I see ones that reference the surface, 2000 dbar, 4000 dbar, but none for the mid-point between two pressure levels.

My main question is, does this function exist within oce, and if not, how should I go about this?

[1] Wong, Annie, Robert Keeley, Thierry Carval, and Argo Data Management Team. “Argo Quality Control Manual for CTD and Trajectory Data,” January 1, 2020. https://archimer.ifremer.fr/doc/00228/33951/.

dankelley commented 4 years ago

NOTE: I hope @richardsc can have a look at this to check my reasoning.

Here's how to get pot density at 1000 dbar for some data at 900 dbar. (We need lon and lat for the gsw method ... I imagine the argo is using the old unesco method but I don't know for sure.)

S <- 35 # measured
T <- 5 # measured
p <- 900 # measured
p_ref <- 1000
lon <- -60
lat <- 40

# Unesco EOS
swRho(S, swTheta(S, T, p, p_ref), p_ref)

# gsw
SA <- gsw_SA_from_SP(S, p, lon, lat)
gsw_pot_rho_t_exact(SA, T, p, p_ref=p_ref)

The output is

[1] 1032.257
[1] 1032.261

They agree to 0.004 kg/m^3.

richardsc commented 4 years ago

@dankelley that reasoning looks right to me.

j-harbin commented 4 years ago

As discussed in a vftf with @dankelley, this issue (as described by its title...other discussions should be raised in separate issues if needed) has been completed.