Skip to main content

A python library for quality control of BGC-Argo data

Project description

Argo Canada BGC Quality Control

Anaconda-Server Badge Build Status Documentation Status codecov

general description

A python library of functions for quality controlling dissolved oxygen data. Heavily based on the SOCCOM BGC Argo QC methods program in matlab, uses either NCEP or World Ocean Atlas data to calculate oxygen gains (Johnson et al. 2015).

installation

The recommended install is through the conda-forge channel, via the command:

conda install -c conda-forge bgcArgoDMQC

The package is also available through the python package index https://pypi.org/project/bgcArgoDMQC/, install with:

pip install bgcArgoDMQC

dependencies

  • Must run on python3.4 or higher, not supported on python2.x (uses pathlib, introduced in python version 3.4)
  • TEOS-10 package gsw
  • netCDF4 module for .nc files
  • pandas is required
  • seaborn
  • cmocean is recommended for nicer plots, but not required

setup

This 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 function bgc.set_dirs(...), or permanently using the following code:

from bgcArgoDMQC.configure import configure

argo_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 like operator_name and operator_orcid can be set in this matter as well to a .config file saved where the package exists on your machine. All required Argo and reference data can be downloaded using the io component 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 functionality

This 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 package
import bgcArgoDMQC as bgc

# define a WMO number you want to look at
wmo = 4900869
# load into a synthetic profile object
syn = bgc.sprof(wmo)
# look at the current state of QC flags for T, S, and DO
g1 = syn.plot(kind='qcprofiles', varlist=['TEMP', 'PSAL', 'DOXY'])

png

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 gains
gains = syn.calc_gains(ref='WOA')

The ref keyword argument sets the reference dataset. In this case we set it to WOA data. By default ref is set to 'NCEP', but in this case that would return all NaN values since there is no in-air data for this float.

Visualize the gains in a single line:

# plot gains over time, show source data
g3 = syn.plot('gain', ref='WOA')

png

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 developments

  • improved netcdf exporting
  • gain calculation with drift, surface carryover for in-air gains
  • expanded capabilities for DMQC on other BGC variables
  • data access via internet (through a package like argopy or argopandas)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bgcArgoDMQC-0.2.13.tar.gz (56.6 MB view details)

Uploaded Source

Built Distribution

bgcArgoDMQC-0.2.13-py3-none-any.whl (56.6 MB view details)

Uploaded Python 3

File details

Details for the file bgcArgoDMQC-0.2.13.tar.gz.

File metadata

  • Download URL: bgcArgoDMQC-0.2.13.tar.gz
  • Upload date:
  • Size: 56.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for bgcArgoDMQC-0.2.13.tar.gz
Algorithm Hash digest
SHA256 d107d761e9284f6a2ec0f38f41addee70d122fd87302f92e4d73e9e9715f3383
MD5 a1012d8c644f3b4852818ff3da7c4510
BLAKE2b-256 65ef299721b9173370f5a5197d1b322ce0fd99b4522c812c2787189202152ae5

See more details on using hashes here.

File details

Details for the file bgcArgoDMQC-0.2.13-py3-none-any.whl.

File metadata

File hashes

Hashes for bgcArgoDMQC-0.2.13-py3-none-any.whl
Algorithm Hash digest
SHA256 a1696b6143cb046fb88d1e3e3f43e4db1004b85521b4b14e454734013f42f3d0
MD5 f93a4dc9e615d8a3f8a9b77838446ddf
BLAKE2b-256 6bbf71bbd67b5fc42e534bae5c7a2640f4a57b77b17763152334a755b1cdd519

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page