A package for processing and analyzing CTD data.
Project description
CTDFjorder
CTDFjorder is a Python package for processing and analyzing CTD (Conductivity, Temperature, Depth) data. Documentation: Read the docs
Features
- Read RSK (.rsk) and Castaway (.csv) files and extract CTD data
- Process CTD data, including removing non-positive samples and cleaning data
- Calculate derived quantities such as absolute salinity, density, and overturns
- Determine mixed layer depth (MLD) using different methods
- Generate plots for visualizing CTD profiles and derived quantities
- Command-line interface (CLI) for easy processing and merging of RSK files
Installation
It's recommended that you create a new environment just for CTDFjorder. This can be done in conda with the following command.
conda create --name ctdfjorder -c conda-forge python=3.11
conda activate ctdfjorder
To install CTDFjorder you can use pip:
pip install ctdfjorder
Usage
CTDFjorder provides a command-line interface (CLI) for processing and analyzing CTD data. Here are the available commands:
Process a single RSK file
ctdfjorder-cli process <file>
This command processes a single RSK file specified by <file>
. It performs various steps like adding filename to the CTD data table, saving data to a CSV file, adding location information, removing non-positive samples, etc.
Merge all RSK files in the current folder
ctdfjorder-cli merge
This command merges all RSK files found in the current folder. It adds filename and location information to the data table and saves the data to a CSV file.
Run the default processing pipeline
ctdfjorder-cli default
This command runs the default processing pipeline on all RSK files found in the current folder. It performs the same steps as the process
command for each RSK file.
Configuration
CTDFjorder looks for a master sheet Excel file named "FjordPhyto MASTER SHEET.xlsx" in the current working directory. This file is used for estimating location information when it's not available in the RSK files. You can change this by modifying the CTDFjorder.master_sheet_path field to the name of your own spreadsheet.
Examples
Here are a few examples of how to use CTDFjorder:
- Process a single RSK file:
ctdfjorder-cli process path/to/rskfile.rsk
- Merge all RSK files in the current folder:
ctdfjorder-cli merge
- Run the default processing pipeline on all RSK files in the current folder:
ctdfjorder-cli default
- Write your own script:
import CTDFjorder
import os
for file in get_rsk_filenames_in_dir(os.getcwd()):
try:
my_data = CTD(file)
my_data.add_filename_to_table()
my_data.save_to_csv("output.csv")
my_data.add_location_to_table()
my_data.remove_non_positive_samples()
my_data.clean("practicalsalinity", 'salinitydiff')
my_data.add_absolute_salinity()
my_data.add_density()
my_data.add_overturns()
my_data.add_mld(1)
my_data.add_mld(5)
my_data.save_to_csv("outputclean.csv")
my_data.plot_depth_density_salinity_mld_scatter()
my_data.plot_depth_temperature_scatter()
my_data.plot_depth_salinity_density_mld_line()
except Exception as e:
print(f"Error processing file: '{file}' {e}")
continue
Contributing
Contributions to CTDFjorder are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
License
CTDFjorder is released under the MIT License.
Acknowledgments
CTDFjorder was developed by Nikolas Yanek-Chrones for the Fjord Phyto project. The gsw library was used for certain dervied calculations.
Citations
McDougall, T. J., & Barker, P. M. (2011). Getting started with TEOS-10 and the Gibbs Seawater (GSW) Oceanographic Toolbox. SCOR/IAPSO WG127.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ctdfjorder-0.1.0.tar.gz
.
File metadata
- Download URL: ctdfjorder-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9fd9f3d3e3116ef0e9c098b290fccc88b37f9625a3f0ec67340d6edb1333785 |
|
MD5 | 24c5c79e34b23a324bc702a3be8eb3d6 |
|
BLAKE2b-256 | cbddffe6d90bd14c4d46f77024c939015851aad948e7650a8b6b54acf245d802 |
File details
Details for the file ctdfjorder-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ctdfjorder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e58ed261f670e9aaeb4b5c010a664a11e790bbbbf303bd724462ed2282596c5 |
|
MD5 | 42cc8ff508b46191b62d65e4585573c1 |
|
BLAKE2b-256 | 29b1c116aa7efa2d96c9f206ac6b75f4b46c31c768c2435122874f870401bab5 |