NetCDF IO

The NetCDF implementation of the medsrtqc.core.Profile gives developers and users access to more than 2 million profiles available on the Argo GDAC for testing purposes. You can also run production QC tests on NetCDF files if generating them in advance simplifies the workflow. Most users will only ever use read_nc_profile().

medsrtqc.nc.read_nc_profile(*src, mode='r')

Load a medsrtqc.Profile backed by a NetCDF file. For details on the underlying data structure, see NetCDFProfile.

Parameters:

src – One or more URLs, filename, bytes, or existing ``netCDF4.Dataset``s. If more than one is passed, the first data set will mask variables available in subsequent data sets. This is useful for combining BGC and core files.

>>> from medsrtqc.nc import read_nc_profile
>>> from medsrtqc.resources import resource_path
>>> profile = read_nc_profile(resource_path('BR2902746_001.nc'))
>>> profile['TEMP']
medsrtqc.nc.load(src, mode='r')

Load a netCDF4.Dataset from a filename, url, bytes, or existing netCDF4.Dataset. This is applied to anywhere a NetCDF file must be specified.

Parameters:
  • src – A URL, filename, bytes, or existing netCDF4.Dataset

  • mode – Use 'r+' to allow updates.

class medsrtqc.nc.NetCDFProfile(*dataset)

A medsrtqc.core.Profile implementation backed by a netCDF4.Dataset representation of an Argo profile NetCDF file. The NetCDF files should be single-cycle NetCDFs; however, you can pass more than one to include variables from multiple files (e.g., a core and a BGC file). When this is the case, the variables from the first file mask those of subsequent files. These objects are normally created from read_nc_profile().