pyglider.ncprocess#

Routines that are used for common processing of netcdf files after they have been converted to standard timeseries.

Functions#

pyglider.ncprocess.extract_timeseries_profiles(inname, outdir, deploymentyaml, force=False)#

Extract and save each profile from a timeseries netCDF.

Parameters:
innamestr or Path

netcdf file to break into profiles

outdirstr or Path

directory to place profiles

deploymentyamlstr or Path

location of deployment yaml file for the netCDF file. This should be the same yaml file that was used to make the timeseries file.

forcebool, default False

Force an overwite even if profile netcdf already exists

pyglider.ncprocess.make_gridfiles(inname, outdir, deploymentyaml, *, fnamesuffix='', depth_bins=None, dz=1, starttime='1970-01-01', maskfunction=None, max_gap=100)#

Turn a timeseries netCDF file into a vertically gridded netCDF.

Parameters:
innamestr or Path

netcdf file to break into profiles

outdirstr or Path

directory to place profiles

deploymentyamlstr or Path

location of deployment yaml file for the netCDF file. This should be the same yaml file that was used to make the timeseries file.

depth_binsarray, default = None

User-defined depth bins, for instance np.arange(0, 1000.1, 1). If not None, these are the depth bins into which the data will be gridded. If None, dz is used to generate bins between 0 and 1100m

dzfloat, default = 1

Vertical grid spacing in meters.

maskfunctioncallable or None, optional

Function applied to the dataset before gridding, usually to choose what data will be set to NaN based on quality flags.

max_gapint, default = 100

Maximum number of consecutive NaN values to fill when interpolating. This is used to prevent interpolation across large gaps in the data.

——-
outnamestr

Name of gridded netCDF file. The gridded netCDF file has coordinates of ‘depth’ and ‘profile’, so each variable is gridded in depth bins and by profile number. Each profile has a time, latitude, and longitude. If deploymentyaml is a list, data is parsed for deployment information, with subsequent files overwriting previous files.

Note:
By default, the arithmetic mean is used to bin all variables, except for those with
an average_method attribute inherited from the timeseries. This attribute is specified
in the YAML configuration file when the timeseries is created. For example, if a variable
has average_method: geometric mean, the geometric mean is used when gridding that variable.
Variables with average_method: QC_protocol are treated as discrete quality flags rather than
continuous data, and the maximum flag within each bin is used for gridding (e.g., if any
value in a bin is QC3, the gridded bin is assigned QC3).