Package: bgcArgoDMQC
Argo Canada BGC Quality Controlgeneral descriptionApythonlibrary of functions for quality controlling dissolved oxygen data.
Heavily based on theSOCCOM BGC Argo QC methodsprogram inmatlab, uses eitherNCEPorWorld Ocean Atlasdata to
calculate oxygen gains
(Johnson et al. 2015).installationThe recommended install is through the conda-forge channel, via the command:condainstall-cconda-forgebgcArgoDMQCThe package is also available through the python package indexhttps://pypi.org/project/bgcArgoDMQC/, install with:pipinstallbgcArgoDMQCdependenciesMust run onpython3.4or higher, not supported onpython2.x(usespathlib, introduced in python version 3.4)TEOS-10 packagegswnetCDF4module for.ncfilespandasis requiredseaborncmoceanis recommended for nicer plots, but not requiredsetupThis package uses locally saved data, as it is designed for QC operators that will likely want to manipulate or export files. This includes accessing WOA and NCEP data. Therefore, the user must tell the package where to look for data. This can either be done inline using the functionbgc.set_dirs(...), or permanently using the following code:frombgcArgoDMQC.configureimportconfigureargo_dir='/path/to/my/argo/data/'woa_dir='/path/to/woa/data/'ncep_dir='/my/ncep/path/configure(argo_path=argo_dir,woa_path=woa_dir,ncep_path=ncep_dir)Other items likeoperator_nameandoperator_orcidcan be set in this matter as well to a.configfile saved where the package exists on your machine. All required Argo and reference data can be downloaded using theiocomponent of the package, see documentation for more details. All data paths should be structured as they are found. For example, the Argo path should follow the dac structure, so in this example, a profile might be found in'/path/to/my/argo/data/dac/meds/4900869/profiles/BR4900869_024.nc'.basic functionalityThis section will show the two main components of DOXY DMQC, visually inspecting the data, and calculating the gain relative to a reference dataset. There are many more visualizations that are possible, refer to docs for full plotting reference.# import packageimportbgcArgoDMQCasbgc# define a WMO number you want to look atwmo=4900869# load into a synthetic profile objectsyn=bgc.sprof(wmo)# look at the current state of QC flags for T, S, and DOg1=syn.plot(kind='qcprofiles',varlist=['TEMP','PSAL','DOXY'])We can see above that most T/S points are good, with a few obvious outliers in red. The oxygen data also look all good. This is an old float, but for current floats the QC flag for unadjusted oxygen should be 3 (probably bad).Since this is an older float, there are no in-air measurements made by the optode. Therefore we will calcualte the gain by comparing surface values to WOA data.# calculate the gainsgains=syn.calc_gains(ref='WOA')Therefkeyword argument sets the reference dataset. In this case we set it to WOA data. By defaultrefis set to'NCEP', but in this case that would return allNaNvalues since there is no in-air data for this float.Visualize the gains in a single line:# plot gains over time, show source datag3=syn.plot('gain',ref='WOA')I find this plot particularly useful, as sometimes it is a good indicator to go back and inspect certain profiles. We see a couple large spikes in the suface float data. Are those spikes real, or should we go back and have a closer look at those profiles? This could change our mean gain a little, and perhaps we would flag some data as bad that we didn't notice before.future developmentsimproved netcdf exportinggain calculation with drift, surface carryover for in-air gainsexpanded capabilities for DMQC on other BGC variablesdata access via internet (through a package like argopy or argopandas)