Manipulate Rockland Scientific's Q-files
Project description
q2netcdf
Note: The package requires Python 3.10+, but the standalone
mergeqfilesscript is compatible with Python 3.7+ for deployment on legacy systems (e.g., MicroRider instruments).
Python tools for manipulating Rockland Scientific's Q-files as generated by the ISDP data logger.
Features
- Q-file to NetCDF Conversion: Convert binary Q-files to CF-1.8 compliant NetCDF format
- Header Parsing: Extract metadata, sensor configurations, and timing information
- Data Extraction: Read scalar channels and frequency spectra from binary records
- File Manipulation: Merge, reduce, and inspect Q-files
- Configuration Generation: Create syntactically correct
isdp.cfgfiles - Format Support: Handles Q-file versions 1.2 and 1.3
- Sensor Mapping: Built-in support for 200+ sensor identifier codes
Command-Line Tools
q2netcdf- Translate Q-files into CF-1.8 compliant NetCDF filesQFile- Dump header and data records from Q-filesQHeader- Display header record informationQReduce- Reduce Q-file size by removing recordsmergeqfiles- Merge multiple Q-files (designed for MicroRider/Slocum Glider integration)mkISDPcfg- Generate syntactically correctisdp.cfgconfiguration files
Quick Start
# Display Q-file header information
QHeader data.q
# Convert Q-file to NetCDF
q2netcdf data.q --nc output.nc
# Dump all records from Q-file
QFile data.q --logLevel INFO
Installation
Using pipx (Recommended)
The command-line scripts in this package may be installed using pipx:
python3 -m pipx install git+https://github.com/mousebrains/q2netcdf
To update to the latest version:
python3 -m pipx install --force git+https://github.com/mousebrains/q2netcdf
From Source
git clone git@github.com:mousebrains/q2netcdf.git
cd q2netcdf
pip install -e .
For Development
git clone git@github.com:mousebrains/q2netcdf.git
cd q2netcdf
pip install -e ".[dev]"
pytest # Run tests
Installation on the MicroRider
For deployment on Rockland Scientific MicroRider instruments:
- Transfer src/q2netcdf/mergeqfiles.py and src/q2netcdf/mergeqfiles.cfg to the MicroRider's data directory.
- Dismount the data directory on your host computer.
- Connect to the MicroRider via a serial connection using your favorite terminal emulator at 115,200 baud.
ls datato verify the files are present. This will cause the MicroRider to unmount data from being read-only to the MicroRider and then remount it as read-write. This will typically cause the serial connection to drop then be reestablished. You might have to restart your terminal emulator's connection.mv data/mergeqfiles.py /usr/local/bin/mergeqfilesto install the script as mergeqfiles.- Test with
mergeqfiles --helpto make sure the installation was successful. - You can disconnect the MicroRider's serial connection.
- You should now run a simulation on the Slocum glider to verify Q-files are being uploaded to the science computer's storage as .mri files.
- Diagnostic information is written into the data/mergeqfiles.log file on the MicroRider.
- You can modify data/mergeqfiles.cfg to adjust the information included in the .mri file sent to the glider.
This is designed for integration with TWR's Slocum Glider uRider proglet.
Usage Examples
Converting Q-files to NetCDF
q2netcdf data.q --nc output.nc
Inspecting Q-file Headers
# Show full header with channel and spectra names
QHeader data.q
# Show condensed header
QHeader data.q --nothing
# Show only configuration
QHeader data.q --channels --spectra --frequencies
Examining Q-file Data Records
# Dump all records
QFile data.q
# Limit number of records displayed
QFile data.q --n 10
Merging Q-files
mergeqfiles -o merged.q file1.q file2.q file3.q
Generating ISDP Configuration Files
mkISDPcfg --help
File Format
Q-files are binary files containing oceanographic data from Rockland Scientific instruments. The format is documented in Rockland Technical Note TN-054.
Q-file Structure
- Header Record (0x1729): File version, timestamp, channel/spectra identifiers, frequencies, configuration
- Data Records (0x1657): Timestamped measurements with scalar channels and frequency spectra
Supported Versions
- v1.2: Original format with full metadata in each data record
- v1.3: Optimized format with reduced redundancy
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Development Setup
git clone git@github.com:mousebrains/q2netcdf.git
cd q2netcdf
pip install -e ".[dev]"
pytest # Run tests
ruff check src/ tests/ # Lint
mypy src/ # Type check
To run a module for testing python3 -m src.q2netcdf.QHeader --help
Additional Documentation
- CHANGELOG.md - Version history and changes
- CONTRIBUTING.md - Contributor guidelines and development setup
- SECURITY.md - Security policy and vulnerability reporting
- QFILE_FORMAT.md - Q-file binary format specification
- CLAUDE.md - AI assistant guidance for working with this codebase
License
See LICENSE file for details.
Author
Pat Welch Email: pat@mousebrains.com
Acknowledgments
Developed for use with Rockland Scientific oceanographic instruments and the ISDP data logger.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file q2netcdf-0.5.0.tar.gz.
File metadata
- Download URL: q2netcdf-0.5.0.tar.gz
- Upload date:
- Size: 113.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
317eccf0a537df22de10fc1c9911b36e118278628a8eb1121758888c2aa49ad0
|
|
| MD5 |
95a63eaedf523b008dea7ebc83d30710
|
|
| BLAKE2b-256 |
3ab5fbbfca1128986048c8f11d5bfd668dfac8683db47e9e053d1aeb98700ac3
|
Provenance
The following attestation bundles were made for q2netcdf-0.5.0.tar.gz:
Publisher:
publish-to-pypi.yml on mousebrains/q2netcdf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
q2netcdf-0.5.0.tar.gz -
Subject digest:
317eccf0a537df22de10fc1c9911b36e118278628a8eb1121758888c2aa49ad0 - Sigstore transparency entry: 1155146971
- Sigstore integration time:
-
Permalink:
mousebrains/q2netcdf@ec7fb689a36499116b2361b99c2f9413fd8fd3bf -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/mousebrains
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ec7fb689a36499116b2361b99c2f9413fd8fd3bf -
Trigger Event:
release
-
Statement type:
File details
Details for the file q2netcdf-0.5.0-py3-none-any.whl.
File metadata
- Download URL: q2netcdf-0.5.0-py3-none-any.whl
- Upload date:
- Size: 52.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
362c79ba67f4865376bc11d6118fde8e5ab79b9f351f38cdd0cfed9bf34a3cf2
|
|
| MD5 |
c0c37d2070015349cf7e63686b39f8e1
|
|
| BLAKE2b-256 |
cb9e810459acd7ffa92170ec32b641f76d534c8464558dc2bddae943df4763e8
|
Provenance
The following attestation bundles were made for q2netcdf-0.5.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on mousebrains/q2netcdf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
q2netcdf-0.5.0-py3-none-any.whl -
Subject digest:
362c79ba67f4865376bc11d6118fde8e5ab79b9f351f38cdd0cfed9bf34a3cf2 - Sigstore transparency entry: 1155146975
- Sigstore integration time:
-
Permalink:
mousebrains/q2netcdf@ec7fb689a36499116b2361b99c2f9413fd8fd3bf -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/mousebrains
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ec7fb689a36499116b2361b99c2f9413fd8fd3bf -
Trigger Event:
release
-
Statement type: