ctdam.parser.custom_xarray_accessors module¶
- class ctdam.parser.custom_xarray_accessors.ProcessingAccessor(ds)[source]¶
Bases:
object- module(name, arguments={})[source]¶
Apply processing module to the dataset.
- Parameters:
name (
str) – The name of the module, needs to be in ‘available_modules’arguments (
dict) – The arguments to run the module with
- workflow(modules=['loop_removal', 'wildedit_geomar', 'wfilter', 'alignctd', 'celltm', 'binavg'], other_settings={})[source]¶
Run a full processing workflow on the dataset
- Parameters:
modules (
dict|list) – The individual modules to runother_settings (
dict) – Additional processing workflow settings
- class ctdam.parser.custom_xarray_accessors.InputAccessor(ds)[source]¶
Bases:
object- parameter(name, data)[source]¶
Create a new parameter inside of this dataset.
Will take care of the naming and attribute metadata. Will create an additional quality flag column for the parameter.
- Parameters:
name (
str) – The name of the parameterdata (
ndarray) – The data of the new parameter
- bottles(file_path='', bl_file=None, bottle_capacity=25)[source]¶
Add bottle closing information to the dataset.
Given a corresponding .bl file, the indices of the individual bottle closing times will be added as a new ‘bottle_info’ column to the dataset.
- Parameters:
file_path (
Path|str) – The path to the .bl filebl_file (
BottleLogFile|None) – An instance of BottleLogFile with the target .bl filebottle_capacity (
int) – The number of water bottles attached to the rosette. Used in global bottle ID calculcation.
- processing_metadata(module, key='', value='')[source]¶
Adds provenance metadata to the dataset.
Each data editing information will find its way in here. Its inspired by Sea-Birds line-by-line processing module information metadata storage. Each module will be stored with one line of general information, followed by the individual modules run parameters.
- Parameters:
module (
str) – The name of the processing modulekey (
str) – The name of the parametervalue (
str) – The value corresponding to the parameter
- class ctdam.parser.custom_xarray_accessors.DataRetrievalAccessor(ds)[source]¶
Bases:
object- spans(name, bad_flag=-9.99e-29)[source]¶
Returns the data limits of the given parameter.
- Parameters:
name (
str|DataArray) – The parameterbad_flag (
float) – The bad flag value to ignore
- Return type:
Tuple
- sensor_strand(strand='primary')[source]¶
Selects one of two sensor strands.
The data of the other strand will be dropped.
- Parameters:
strand – The name of the strand, ‘primary’ or ‘secondary’
- Return type:
Dataset
- flattened_ds(ds=None, suffix_map={'primary': '', 'secondary': '2'})[source]¶
Turn (scan, sensor) variables into separate (scan,) variables.
- Parameters:
ds – The target dataset, default is self._ds
suffix_map – Internal name to sensor number mapping
- Return type:
Dataset
- class ctdam.parser.custom_xarray_accessors.ExportAccessor(ds)[source]¶
Bases:
object- to_cnv(file_path='', reduced_header=False, bad_flag=-9.99e-29)[source]¶
Write to Sea-Bird-compliant .cnv format.
- Parameters:
file_path (
Path|str) – The path to the new file.reduced_header (
bool) – Whether to use a reduced metadata header.bad_flag – The value to consider as bad flag.
- to_btl(output_path='', bl_path='', output_statistics='all', bottle_capacity=25)[source]¶
Creates a custom bottle file or seabird bottle file, given a .cnv and .bl file. SeaBirdBtlFile is the default output. To get the OwnBtlFile instead use “arguments={“output_format”: “own”,}”
OwnBtlFile: The resulting file strongly adheres to the format of a regular .btl file. Specifically, the header is the same, only the data table features a different format. Its a 11-character wide tsv, as a cnv data table. In contrast to a .btl, only average values are used.
In general, this custom bottle file (.obtl) can be generated at any time during the CTD processing. This improves over the standard Sea-Bird variant that allows this only during .cnv creation using Datcnv. With the .obtl file one can ensure the very same data quality from a .cnv file inside a bottle file.
SeaBirdBtlFile: Default Case that returns a .btl using a .cnv and a .bl file
- Parameters:
output_path (
Path|str) – The path to store the .btl file tobl_path (
Path|str) – The source path of the .bl fileoutput_statistics (
Literal['avg','all']) – The type of output to producebottle_capacity (
int) – The number of bottles attached at the rosette
- class ctdam.parser.custom_xarray_accessors.QCAccessor(ds)[source]¶
Bases:
object- set_flag(var, flag_value, where)[source]¶
Flag values matching a boolean mask, leaving data untouched.
- edit_value(var, new_value, where, flag_value=4)[source]¶
Correct/despike a value and flag it in the same call.