aodn / public-schema

Shared schema specifications for data exchange (WFS, CSV, etc...)
GNU General Public License v3.0
1 stars 0 forks source link

Add sample volume to pivoted products #46

Closed clairedavies closed 2 years ago

clairedavies commented 2 years ago

Add a SampleVolume_m3 column to the BGC zooplankton and CPR zooplankton and phytoplankton products. The volume information is in the raw data files.

The BGC phytoplankton product does not have a single volume per sample as different taxa may be counted at different volume resolutions. We will access this information from the raw CSV on S3 and create a function in planktonr to access it.

mhidas commented 2 years ago

It looks to me like it isn't just BGC phyto that has different sample volumes for different taxa. E.g for bgc_zoop_raw:

SELECT trip_code,
       array_agg(DISTINCT sampvol_m3 ORDER BY sampvol_m3) AS volumes
FROM bgc_zoop_raw
GROUP BY trip_code
HAVING count(DISTINCT sampvol_m3) > 1
ORDER BY trip_code
LIMIT 10;
trip_code volumes
DAR20130916 {0.0622,0.1244}
DAR20140117_1950 {0.0679,0.1357}
DAR20140906_0030 {0.0679,0.1018}
ESP20101013 {0.3818,0.509}
ESP20130725 {0.1273,0.4454}
IIOE20190519 {0.9897,1.6967}
KAI20100112 {0.707,1.4139}
KAI20110223 {5.6556,11.3112}
KAI20140122 {0.707,0.9897}
MAI20090421 {22.8486,23.0748}

In total there are 158 trips which have at least two different sample volues.

clairedavies commented 2 years ago

Oh yes, I forgot about adult counts - that would be right. So the same solution for BGC zooplankton as for BGC phytoplankton.

leonardolaiolo commented 2 years ago

SQL changes fix only CPR products. BGC products have multiple volumes per trip code.