ctdam.parser.seabird_data_files module¶
- class ctdam.parser.seabird_data_files.SeabirdDataFile(path_to_file, only_header=False)[source]¶
Bases:
objectThe base class for all Sea-Bird data files, which are .cnv, .btl, and .bl . One instance of this class, or its children, represents one data text file. The different information bits of such a file are structured into individual lists or dictionaries.
- event_name[source]¶
The streamlined data event name, consisting of cruise and station name
- Type:
str
- read_file()[source]¶
Reads and structures all the different information present in the file.
Lists and Dictionaries are the data structures of choice. Uses basic prefix checking to distinguish different header information.
- reading_start_time()[source]¶
Extracts the Cast start time from the metadata header.
- Return type:
datetime|None
- read_event_information(regex_string='(?P<c>[a-z]{1,3}\\\\d{1,3})(-|_|\\\\/)?(?P<cn>1|2)?(-|_)(?P<s>\\\\d{1,4})(-|_)(?P<e>\\\\d{1,2})', leading_zeroes=False)[source]¶
Save the event metadata of the cast inside self.station .
Additionally save cruise information inside self.cruise, if possible. The data sources are file name and custom metadata header, in this order.
- class ctdam.parser.seabird_data_files.CnvFile(path_to_file, only_header=False)[source]¶
Bases:
SeabirdDataFileA representation of a cnv-file as used by SeaBird.
- class ctdam.parser.seabird_data_files.HexFile(path_to_file, path_to_xmlcon='', *args, **kwargs)[source]¶
Bases:
SeabirdDataFileA representation of a .hex file as used by SeaBird.
When no corresponding .xmlcon file given, a search algorithm is used to determine the matching .xmlcon automatically.
- parse_hex(hex)[source]¶
Parse the individual hex information bits using sbe.odf
- Parameters:
hex (
Path|str) – The path to the target hex file- Return type:
Dataset
- get_corresponding_xmlcon(path_to_xmlcon='')[source]¶
Finds the best matching .xmlcon file inside the same directory.
The logics works as follows:
if an .xmlcon of the same name exists, take that
else, find all .xmlcons of the same cruise inside the given directory and use the one used by the previous .hex file, sorted by file name.
- Return type:
XMLCONFile|None
- class ctdam.parser.seabird_data_files.BottleLogFile(path_to_file)[source]¶
Bases:
SeabirdDataFileBottle Log file (.bl) representation, that extracts the three different data types from the file: reset time and the table with bottle IDs and corresponding data ranges.
- class ctdam.parser.seabird_data_files.BottleFile(path_to_file)[source]¶
Bases:
SeabirdDataFileClass that represents a Sea-Bird Bottle File (.btl) .
- create_dataframe()[source]¶
Creates a dataframe out of the .btl file. Handles the double data header correctly.
- adding_timestamp_column()[source]¶
Creates a timestamp column that holds both, Date and Time information.
- selecting_rows(df=None, statistic_of_interest=['avg'])[source]¶
Creates a dataframe with the given row identifier, using the statistics column. A single string or a list of strings can be processed.
- Parameters:
df (pandas.Dataframe :) – the files Pandas representation (Default value = self.df)
statistic_of_interest (
list|str) – collection of values of the ‘statistics’ column in self.df