seabirdfilehandler.parameter module

- class seabirdfilehandler.parameter.Parameters(data, metadata, only_header=False)[source]
Bases:
UserDict
A collection of all the parameters in a CnvFile.
Allows for a much cleaner handling of parameter data and their metadata. Will be heavily expanded.
- Parameters:
data (list) – The raw data as extraced by DataFile
metadata (list) – The raw metadata as extraced by DataFile
- create_full_ndarray(data_table=[])[source]
Builds a numpy array representing the data table in a cnv file.
- Parameters:
data_table (list :) –
- The data to work with
(Default value = [])
- Return type:
A numpy array of the same shape as the cnv files data table
- create_parameter_instances(metadata={})[source]
Differentiates the individual parameter columns into separate parameter instances.
- Parameters:
metadata (dict[str, dict] :) –
- The structured metadata dictionary
(Default value = {})
- Return type:
A dictionary of parameter instances
- differentiate_table_description()[source]
The original method that structures data table metadata.
Needs heavy refactoring.
- add_parameter(parameter)[source]
Adds one parameter instance to the collection.
- Parameters:
parameter (Parameter :) – The new parameter
- create_parameter(data, metadata={}, name='')[source]
Creates a new parameter instance with the given data and metadata.
The input data is either a numpy array or a single value. The single value will be broadcasted to the shape of the data table. A use-case would be the addition of an ‘event’ or ‘cast’ column.
- Parameters:
data (np.ndarray | int | float | str :) – Data to use or expand
metadata (dict :) –
- Metadata for the new parameter
(Default value = {})
name (str :) –
- Name to use for missing metadata values
(Default value = “”)
- Return type:
The new parameter instance
- add_default_metadata(name, metadata={}, list_of_keys=['shortname', 'longinfo', 'name', 'metainfo', 'unit'])[source]
Fills up missing metadata points with a default value.
- Parameters:
name (str :) – The value to use as default
metadata (dict :) –
- The present metadata
(Default value = {})
list_of_keys (list :) – The expected metadata keys
- Return type:
The full metadata dictionary
- get_pandas_dataframe()[source]
Returns a pandas DataFrame of the current parameter data.
- Return type:
DataFrame
- class seabirdfilehandler.parameter.Parameter(data, metadata)[source]
Bases:
object
A representation of one parameter in a cnv file.
Consists of the values of the parameter as well as the metadata.
- get_pandas_series()[source]
Returns a pandas Series of the current parameter data.
- Return type:
Series