
COPS: Cloud Optical Array Probe (OAP) Processing Software
COPS is a Python-based Cloud Optical array probe Processing Software (COPS), which is developed initially following the processing steps in the MATLAB version of UIOOPS, but most functions have been updated or rewritten. It is developed to process the Optical Array Probe datasets.
Current Developers & Contributors
Yongjie Huang (huangynj@gmail.com; Yongjie.Huang@ou.edu)
If you want to contribute to this software, feel free to Fork and Pull Request. Please see CONTRIBUTING.md for more detailed guidelines.
Project Status
COPS is actively maintained. The current version, 1.0.0rc1, is a release candidate for COPS v1.0. The optional ML products are experimental: their models were trained and evaluated on synthetic data only, and independent validation on natural clouds remains open.
Supported probes
COPS reads data from these optical array probes (OAPs):
2DC (Two Dimension Cloud particle imaging probe)
2DP (Two Dimension Precipitation particle imaging probe)
2DS (both 2D-S (Type 32) and Fast 2D-S (Type 48) format, 2D-Stereo, SPEC Inc.)
CIP (Cloud Imaging Probe, DMT), including grayscale CIP
PIP (Precipitation Imaging Probe, DMT)
HVPS (High Volume Precipitation Spectrometer, SPEC Inc.), including HVPS-4
Installation
It is recommended to use mamba or conda to install this package.
Clone the repository, then choose the base or ML environment below. Run these
commands from the repository root. conda can be used in place of mamba.
git clone https://github.com/CLOUD2SKit/COPS.git
cd COPS
For base processing and the GUI:
mamba env create -f environment.yml
mamba activate cops
python -m pip install -e '.[gui]'
For ML sizing and classification, including the GUI:
mamba env create -f environment-ml.yml
mamba activate cops-ml
The ML environment installs the local checkout with its ml and gui extras.
It uses Python 3.12 and scikit-learn 1.8.0, matching the fitted RF/HGB
models. COPS checks the version required by each model bundle before loading
tree models. The ML dependencies also include joblib>=1.3 and
threadpoolctl>=3.2; NumPy and SciPy requirements are resolved by the installer.
In an existing Python 3.11 or newer environment, install the ML extra directly:
python -m pip install -e '.[ml]'
Use '.[all]' to install the GUI, development tools, and ML dependencies together;
this extra also requires Python 3.11 or newer. Base processing can be installed
with python -m pip install -e .. ML processing is optional; see
Optional ML sizing and classification.
To install a tagged release without cloning, for example with the GUI:
python -m pip install "cops[gui] @ git+https://github.com/CLOUD2SKit/COPS.git@v1.0.0rc1"
COPS is not on PyPI, because it depends on a Git URL (see below).
Supported environments
Base processing and the GUI need Python 3.8 or newer. The test workflow runs Python 3.8 to 3.13 on Ubuntu.
ML sizing and classification need Python 3.11 or newer. The ML test workflow runs Python 3.11 to 3.13 on Ubuntu.
The release candidate was also checked on macOS (Apple silicon) with Python 3.12. Windows has not been tested.
NRC-SPIFpy dependency
Raw probe data are decoded with the COPS fork of NRC-SPIFpy, which COPS installs from GitHub at a pinned commit. Its Fast 2D-S decoder is compiled with Cython when a C compiler is available. Without one, installation still succeeds and a pure-Python decoder, which gives the same results but is slower, is used instead.
Quick start
Download a raw file from the synthetic data record into
notebooks/ICCP2024_probe_raw_data/, which already holds the matching probe
configurations. Then run from the repository root:
import cops
data = "notebooks/ICCP2024_probe_raw_data"
config = f"{data}/ICCP2024.2DS.ini"
if __name__ == "__main__":
# Raw probe file -> SPIF NetCDF (Level-0, the "core" group)
cops.io.decode_OAP_raw_data([f"{data}/base100101000000.2DS_ice_v01"], "2DS",
project_name="ICCP2024", out_dir="output",
config_path=config)
spif = "output/base100101000000.2DS_ice_v01.nc"
# Append Level-1 (per particle) and Level-2 (size distributions) to the same file
cops.analysis.process_spif_image_append_level1_data(spif, config_path=config)
cops.analysis.process_spif_level1_append_level2_data(spif, config_path=config)
print(cops.io.read_spif_group(spif, group="2DS-V/level-2"))
Run it as a script: the __main__ guard is needed because COPS uses worker
processes. Open the result in the desktop browser (requires the gui extra):
cops-browser output/base100101000000.2DS_ice_v01.nc
For other probes, use the matching configuration from the same folder, or start
from the templates in cops/probe_config/.
Outputs
COPS writes NetCDF files in the
Single Particle Image Format (SPIF).
Each probe channel is one group (for example 2DS-V and 2DS-H), and each
processing step adds a subgroup:
Subgroup |
Contents |
Dimension |
|---|---|---|
|
Decoded particle images and timing |
|
|
Per-particle geometry, habit, reject codes, bulk properties, phase and optional ML outputs |
|
|
Size distributions, concentrations and water contents |
|
An existing level-1 or level-2 subgroup is not rewritten. To reprocess with
different settings, write to a new output file. Since 1.0.0rc1, Level-1 stores
particle_mass, particle_massbl and particle_mass_liquid as float64.
Optional ML sizing and classification
COPS has two optional ML products. Each uses kNN, RF or HGB models, with separate models for entire-in and center-in edge particles. Both are disabled by default and configured independently in the probe configuration, and both need the ML environment above and a trusted local model bundle. Fitted bundles are not included in this repository or installed with the package.
ML sizing (
[ml_sizing]) corrects the COPS diameterD_sand writesD_s_knn,D_s_rforD_s_hgb. Withdiameter_choice8-11, the selected ML diameter drives the bulk products and size distributions. See ML sizing.ML classification (
[ml_classification]) stores synthetic source-category scores (drops, columns, ice) and a derived liquid/ice phase. The ML phase is used for bulk products only whenphase_methodisml_knn,ml_rforml_hgb. See configuration, bundle export and limitations.
Model bundles
The fitted v1 bundles, trained on the synthetic Jeju workshop data (see
Synthetic data), are archived on Zenodo:
DOI: 10.5281/zenodo.24547769. Each archive
unzips to one bundle directory; set that directory as ml_bundle_path in the
sizing or classification section of the probe configuration. The sizing bundle
also serves entire-in-only sizing with ml_population_mode = entire_only.
Archive |
Product |
SHA-256 |
|---|---|---|
|
Sizing, entire-in + edge |
|
|
Classification, entire-in + edge |
|
The RF/HGB models are joblib pickles, and loading a pickle can execute code. Before unzipping, check each archive against the checksums listed here, not only against a checksum file downloaded with it:
shasum -a 256 cops_ml_*.zip # Linux: sha256sum cops_ml_*.zip
COPS then verifies every model file against the SHA-256 in its bundle manifest
when loading. RF/HGB models load only with scikit-learn 1.8.0; kNN models are
portable .npz files without a scikit-learn requirement.
Logging
COPS reports pipeline status and warnings through Python’s standard logging
module. By default, package messages at INFO and above are written to the
console with their severity and module name. Existing handlers attached to the
cops logger are respected, and the root logger is never reconfigured.
import os
# Set these before importing COPS.
os.environ["COPS_SHOW_BANNER"] = "0" # Optional; the banner is on by default.
os.environ["COPS_LOG_LEVEL"] = "DEBUG"
import cops
COPS_LOG_LEVEL accepts standard Python logging levels:
unset or
INFO: showINFO,WARNING,ERROR, andCRITICAL;ERROR: hideINFOandWARNING, but retain errors;DEBUG: show all COPS messages;OFFor0: disable COPS console messages.
Calling cops.configure_logging(...) explicitly after import overrides the environment-derived level, e.g.,
import logging
import cops
cops.configure_logging(
level=logging.DEBUG,
fmt="%(levelname)s: %(processName)s: %(name)s: %(message)s",
force=True,
)
Synthetic data
Simulated optical array probe data from the Workshop on Evaluation of Cloud
Probe Processing Software (Jeju, South Korea, 2024) are archived on Zenodo:
DOI: 10.5281/zenodo.24292124.
The record holds simulated 2DS, HVPS, CAPS (binary and greyscale) and PIP
image files for drops, columns and ice, each with a matching .txt file, plus a
README and the workshop slides (32 files, about 1 GB). The record has no
single-zip download; fetch the files individually, e.g., with
zenodo_get:
pip install zenodo_get
zenodo_get 24292124 # downloads and checks each file's MD5
If you use these data, please cite:
Bansemer, A. (2026). Optical array probe simulations for the Workshop on Evaluation of Cloud Probe Processing Software (Jeju, South Korea, 2024) [Dataset]. Zenodo. https://doi.org/10.5281/zenodo.24292124
Notebooks
The COPS repository contains example notebooks for testing COPS on your system.
They read the synthetic data from
notebooks/ICCP2024_probe_raw_data/, which holds the probe configurations used
for these data; download the raw files there before running them. Run the
notebooks from the notebooks/ folder, starting with the first one.
Other relevant software/materials
Troubleshooting
COPS imports the wrong copy. Python searches the current folder first, so a script run from the repository root imports the local
cops/folder rather than an installed package. Check withpython -c "import cops; print(cops.__file__)". An empty entry inPYTHONPATH(for example a leading:) has the same effect from any folder.numpy.ndarray size changed, may indicate binary incompatibility. A compiled package, often netCDF4, was built against a different NumPy. Reinstall it from the same channel as NumPy, for examplemamba install -c conda-forge netcdf4 numpy.The GUI fails on a machine without a display. Qt needs a display. For headless test runs, set
QT_QPA_PLATFORM=offscreen.
Citation
If you use COPS in your research, please cite the COPS paper listed in CITATION.cff, which GitHub also shows as “Cite this repository”:
Huang, Y., McFarquhar, G. M., Bansemer, A., Wolde, M., Nichman, L., and Woods, S.: COPS v1.0: Python Software for Optical Array Probe Data Processing and Synthetic Evaluation of Particle Sizing and Size Distributions. Submitted.
If you use the ML model bundles, please also cite their Zenodo record (10.5281/zenodo.24547769).
License
The COPS software is licensed under the GNU General Public License, version 3
or any later version (GPL-3.0-or-later), at your option. You may use, modify,
and redistribute it, subject to the license
conditions. Distributed modified
versions must preserve the GPL rights of recipients and provide corresponding
source code as required by the license. COPS comes without any warranty. See
LICENSE for the full terms.
Third-party components retain their own licenses. In particular, NRC-SPIFpy is MIT-licensed, and the optional PyQt6 GUI dependency is available under GPLv3 or a Riverbank commercial license. See THIRD_PARTY_NOTICES.md.