COPS Example of Converting Probe Raw Data to SPIF
Created by Yongjie Huang (huangynj@gmail.com), 2026-07-16.
import cops
**********************************************************
* CCCCC OOOOO PPPPPPP SSSSSSS __|__ *
* _ . CC CC OO OO PP PP SS --*-(_)-*--*
* ( _ )_ CC OO OO PPPPPPP SSSSSSS *
*(_ _(_ ,) CC CC OO OO PP SS *
* CCCCC OOOOO PP SSSSSSS *
**********************************************************
* CLOUD OAP PROCESSING SOFTWARE (COPS) *
* (Version 0.0.1) *
* Copyright (C) 2024-2026 *
**********************************************************
* This software is free: You may redistribute and/or *
* modify it under the terms of the GNU General Public *
* License version 3 or any later version *
* (GPL-3.0-or-later). *
* *
* This software is distributed "AS IS", WITHOUT ANY *
* WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GPL-3.0-or-later license for more details: *
* https://www.gnu.org/licenses/gpl-3.0.html *
**********************************************************
2DS
raw_file_list = ['./ICCP2024_probe_raw_data/base100101000000.2DS_ice_v01',
'./ICCP2024_probe_raw_data/base100101000000.2DS_drops_v01',
'./ICCP2024_probe_raw_data/base100101000000.2DS_columns_v01'
]
probe_name = '2DS'
project_name = 'ICCP2024'
cops.io.decode_OAP_raw_data(raw_file_list,
probe_name,
project_name=project_name,
out_dir='output/spif_lvl0',
config_path=f'./ICCP2024_probe_raw_data/{project_name}.{probe_name}.ini',
)
INFO: cops.io: Probe configuration file './ICCP2024_probe_raw_data/ICCP2024.2DS.ini' exists!
INFO: cops.io: Here is the configuration. If there is something wrong, stop the program and correct them in './ICCP2024_probe_raw_data/ICCP2024.2DS.ini'
------------------------------------------------------
Section: root
title = SPIF-Single Particle Image Format
institution = University of Oklahoma
references =
project = ICCP2024
Section: instrument
instrument_name = 2DS
instrument_long_name = SPEC Two Dimensional Stereo Imaging Probe
institution = NSF NCAR
reference =
instrument_serial_number = 2DS-XXXX-XX
manufacturer = SPEC
instrument_firmware = xx
instrument_software = xx
platform = NSF NCAR XXX
comment = Synthetic data for testing
Section: pixels
value = 128
long_name = vector of pixel numbers for instrument
comment =
Section: resolution
value = 10
long_name = physical resolution of each pixel on array
units = micrometer
ancillary_variables = resolution_err
Section: resolution_err
value = 0
long_name = Uncertainty of physical resolution of each pixel on array
units = micrometer
Section: arm_separation
value = 63
long_name = Physical distance between probe arms
units = millimeter
ancillary_variables = arm_separation_err
Section: arm_separation_err
value = 0
long_name = Uncertainty of physical distance between probe arms
units = millimeter
Section: antishatter_tips
value = True
long_name = Use of antishatter-, or Korolev-, tips on probe arms
Section: bpp
value = 1
long_name = Bits per pixel used in image data
Section: wavelength
value = 785
long_name = Probe laser wavelength
units = nm
Section: particle_image_processing
particle_mask = 0
iRectEllipse = 0
iCalcAllDiodeStats = 1
Section: particle_size_distribution
probe_type = 2
tasMax = 170
time_interval_sec = 1
accepted_codes = ['0', 'H', 'R']
bin_edges = np.arange(5, 3006, 10)/1000.
diameter_choice = 6
applyIntArrThresh = 0
intArrThreshMode = probabilistic
defaultIntArrThresh = 1e-6
intArrProbAlphaStart = 0.01
intArrProbAlphaExtend = 0.05
intArrProbRollingWindowSec = 5
intArrProbMinLambda = 10.0
reaccptShatrs = 1
reaccptD = 0.05
reaccptMaxIAT = 1e-6
SAmethod = 0
iCreateAspectRatio = 0
iCreateBad = 1
------------------------------------------------------
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/base100101000000.2DS_ice_v01
Extracting HK data for 2DS-H...
Extracting HK data for 2DS-V...
Processing frames: 500 frame [00:02, 170.18 frame/s]
Writing frames: 500 frame [00:02, 170.21 frame/s]
Finished processing.
0-H; 7459-V images processed in 2.938 seconds
Recalculating image times...
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/base100101000000.2DS_ice_v01 to SPIF data output/spif_lvl0/base100101000000.2DS_ice_v01.nc
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/base100101000000.2DS_drops_v01
Extracting HK data for 2DS-H...
Extracting HK data for 2DS-V...
Processing frames: 500 frame [00:08, 60.33 frame/s]
Writing frames: 500 frame [00:08, 60.34 frame/s]
Finished processing.
0-H; 17331-V images processed in 8.287 seconds
Recalculating image times...
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/base100101000000.2DS_drops_v01 to SPIF data output/spif_lvl0/base100101000000.2DS_drops_v01.nc
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/base100101000000.2DS_columns_v01
Extracting HK data for 2DS-H...
Extracting HK data for 2DS-V...
Processing frames: 500 frame [00:05, 83.44 frame/s]
Writing frames: 500 frame [00:05, 83.45 frame/s]
Finished processing.
0-H; 15557-V images processed in 5.992 seconds
Recalculating image times...
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/base100101000000.2DS_columns_v01 to SPIF data output/spif_lvl0/base100101000000.2DS_columns_v01.nc
INFO: cops.io: All raw files have been processed. Done!
HVPS
raw_file_list = ['./ICCP2024_probe_raw_data/base100101000000.HVPS_ice_v01',
'./ICCP2024_probe_raw_data/base100101000000.HVPS_drops_v01',
'./ICCP2024_probe_raw_data/base100101000000.HVPS_columns_v01'
]
probe_name = 'HVPS'
project_name = 'ICCP2024'
cops.io.decode_OAP_raw_data(raw_file_list,
probe_name,
project_name=project_name,
out_dir='output/spif_lvl0',
config_path=f'./ICCP2024_probe_raw_data/{project_name}.{probe_name}.ini',
)
INFO: cops.io: Probe configuration file './ICCP2024_probe_raw_data/ICCP2024.HVPS.ini' exists!
INFO: cops.io: Here is the configuration. If there is something wrong, stop the program and correct them in './ICCP2024_probe_raw_data/ICCP2024.HVPS.ini'
------------------------------------------------------
Section: root
title = SPIF-Single Particle Image Format
institution = University of Oklahoma
references =
project = ICCP2024
Section: instrument
instrument_name = HVPS
instrument_long_name = SPEC High Volume Precipitation Spectrometer
institution = NSF NCAR
reference =
instrument_serial_number = HVPS-XXXX-XX
manufacturer = SPEC
instrument_firmware = xx
instrument_software = xx
platform = NSF NCAR XXX
comment = Synthetic data for testing
Section: pixels
value = 128
long_name = vector of pixel numbers for instrument
comment =
Section: resolution
value = 150
long_name = physical resolution of each pixel on array
units = micrometer
ancillary_variables = resolution_err
Section: resolution_err
value = 0
long_name = Uncertainty of physical resolution of each pixel on array
units = micrometer
Section: arm_separation
value = 162.5
long_name = Physical distance between probe arms
units = millimeter
ancillary_variables = arm_separation_err
Section: arm_separation_err
value = 0
long_name = Uncertainty of physical distance between probe arms
units = millimeter
Section: antishatter_tips
value = True
long_name = Use of antishatter-, or Korolev-, tips on probe arms
Section: bpp
value = 1
long_name = Bits per pixel used in image data
Section: wavelength
value = 785
long_name = Probe laser wavelength
units = nm
Section: particle_image_processing
particle_mask = 0
iRectEllipse = 0
iCalcAllDiodeStats = 1
Section: particle_size_distribution
probe_type = 1
tasMax = 170
time_interval_sec = 1
accepted_codes = ['0', 'H', 'R']
bin_edges = np.arange(75, 45090, 150)/1000.
diameter_choice = 6
applyIntArrThresh = 0
intArrThreshMode = probabilistic
defaultIntArrThresh = 1e-6
intArrProbAlphaStart = 0.01
intArrProbAlphaExtend = 0.05
intArrProbRollingWindowSec = 5
intArrProbMinLambda = 10.0
reaccptShatrs = 1
reaccptD = 0.05
reaccptMaxIAT = 1e-6
SAmethod = 0
iCreateAspectRatio = 0
iCreateBad = 1
------------------------------------------------------
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/base100101000000.HVPS_ice_v01
Extracting HK data for HVPS...
Processing frames: 500 frame [00:05, 87.96 frame/s]
Writing frames: 500 frame [00:05, 87.98 frame/s]
Finished processing.
0-H; 24802-V images processed in 5.683 seconds
Recalculating image times...
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/base100101000000.HVPS_ice_v01 to SPIF data output/spif_lvl0/base100101000000.HVPS_ice_v01.nc
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/base100101000000.HVPS_drops_v01
Extracting HK data for HVPS...
Processing frames: 2000 frame [00:14, 135.13 frame/s]
Writing frames: 2000 frame [00:14, 135.14 frame/s]
Finished processing.
0-H; 374032-V images processed in 14.800 seconds
Recalculating image times...
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/base100101000000.HVPS_drops_v01 to SPIF data output/spif_lvl0/base100101000000.HVPS_drops_v01.nc
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/base100101000000.HVPS_columns_v01
Extracting HK data for HVPS...
Processing frames: 1500 frame [00:13, 113.04 frame/s]
Writing frames: 1500 frame [00:13, 113.04 frame/s]
Finished processing.
0-H; 270415-V images processed in 13.270 seconds
Recalculating image times...
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/base100101000000.HVPS_columns_v01 to SPIF data output/spif_lvl0/base100101000000.HVPS_columns_v01.nc
INFO: cops.io: All raw files have been processed. Done!
DMT CAPS-CIP
raw_file_list = ['./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_drops_v01',
'./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_columns_v01',
'./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_ice_v01'
]
probe_name = 'CIP'
project_name = 'ICCP2024'
cops.io.decode_OAP_raw_data(raw_file_list,
probe_name,
project_name=project_name,
out_dir='output/spif_lvl0',
config_path=f'./ICCP2024_probe_raw_data/{project_name}.{probe_name}.ini',
)
INFO: cops.io: Probe configuration file './ICCP2024_probe_raw_data/ICCP2024.CIP.ini' exists!
INFO: cops.io: Here is the configuration. If there is something wrong, stop the program and correct them in './ICCP2024_probe_raw_data/ICCP2024.CIP.ini'
------------------------------------------------------
Section: root
title = SPIF-Single Particle Image Format
institution = University of Oklahoma
references =
project = ICCP2024
Section: instrument
instrument_name = CIP
instrument_long_name = DMT Cloud Imaging Probe
institution = NSF NCAR
reference =
instrument_serial_number = CIP-XXXX-XX
manufacturer = Droplet Measurement Technologies
instrument_firmware = xx
instrument_software = PADS 3.x
platform = NSF NCAR XXX
comment = Synthetic data for testing
Section: pixels
value = 64
long_name = vector of pixel numbers for instrument
comment =
Section: resolution
value = 25
long_name = physical resolution of each pixel on array
units = micrometer
ancillary_variables = resolution_err
Section: resolution_err
value = 0
long_name = Uncertainty of physical resolution of each pixel on array
units = micrometer
Section: arm_separation
value = 100
long_name = Physical distance between probe arms
units = millimeter
ancillary_variables = arm_separation_err
Section: arm_separation_err
value = 0
long_name = Uncertainty of physical distance between probe arms
units = millimeter
Section: antishatter_tips
value = True
long_name = Use of antishatter-, or Korolev-, tips on probe arms
Section: bpp
value = 1
long_name = Bits per pixel used in image data
Section: wavelength
value = 658
long_name = Probe laser wavelength
units = nm
Section: particle_image_processing
particle_mask = 0
iRectEllipse = 0
iCalcAllDiodeStats = 1
Section: particle_size_distribution
probe_type = 5
tasMax = 170
time_interval_sec = 1
accepted_codes = ['0', 'H', 'R']
bin_edges = np.arange(12.5, 7515, 25)/1000.
diameter_choice = 6
applyIntArrThresh = 0
intArrThreshMode = probabilistic
defaultIntArrThresh = 1e-6
intArrProbAlphaStart = 0.01
intArrProbAlphaExtend = 0.05
intArrProbRollingWindowSec = 5
intArrProbMinLambda = 10.0
reaccptShatrs = 1
reaccptD = 0.05
reaccptMaxIAT = 1e-6
SAmethod = 0
iCreateAspectRatio = 0
iCreateBad = 1
------------------------------------------------------
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_drops_v01
Processing frames: 1000 frame [00:09, 103.10 frame/s]
Writing frames: 1000 frame [00:09, 103.11 frame/s]
31117 images processed in 9.699 seconds
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_drops_v01 to SPIF data output/spif_lvl0/Imagefile_20100101000000.CAPS_drops_v01.nc
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_columns_v01
Processing frames: 1000 frame [00:09, 106.02 frame/s]
Writing frames: 1000 frame [00:09, 106.03 frame/s]
27221 images processed in 9.432 seconds
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_columns_v01 to SPIF data output/spif_lvl0/Imagefile_20100101000000.CAPS_columns_v01.nc
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_ice_v01
Processing frames: 500 frame [00:03, 129.58 frame/s]
Writing frames: 500 frame [00:03, 129.60 frame/s]
13024 images processed in 3.858 seconds
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/Imagefile_20100101000000.CAPS_ice_v01 to SPIF data output/spif_lvl0/Imagefile_20100101000000.CAPS_ice_v01.nc
INFO: cops.io: All raw files have been processed. Done!
DMT PIP
raw_file_list = ['./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_drops_v01',
'./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_columns_v01',
'./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_ice_v01'
]
probe_name = 'PIP'
project_name = 'ICCP2024'
cops.io.decode_OAP_raw_data(raw_file_list,
probe_name,
project_name=project_name,
out_dir='output/spif_lvl0',
config_path=f'./ICCP2024_probe_raw_data/{project_name}.{probe_name}.ini',
)
INFO: cops.io: Probe configuration file './ICCP2024_probe_raw_data/ICCP2024.PIP.ini' exists!
INFO: cops.io: Here is the configuration. If there is something wrong, stop the program and correct them in './ICCP2024_probe_raw_data/ICCP2024.PIP.ini'
------------------------------------------------------
Section: root
title = SPIF-Single Particle Image Format
institution = University of Oklahoma
references =
project = ICCP2024
Section: instrument
instrument_name = PIP
instrument_long_name = DMT Precipitation Imaging Probe
institution = NSF NCAR
reference =
instrument_serial_number = PIP-XXXX-XX
manufacturer = Droplet Measurement Technologies
instrument_firmware = xx
instrument_software = PADS 3.x
platform = NSF NCAR XXX
comment = Synthetic data for testing
Section: pixels
value = 64
long_name = vector of pixel numbers for instrument
comment =
Section: resolution
value = 100
long_name = physical resolution of each pixel on array
units = micrometer
ancillary_variables = resolution_err
Section: resolution_err
value = 0
long_name = Uncertainty of physical resolution of each pixel on array
units = micrometer
Section: arm_separation
value = 260
long_name = Physical distance between probe arms
units = millimeter
ancillary_variables = arm_separation_err
Section: arm_separation_err
value = 0
long_name = Uncertainty of physical distance between probe arms
units = millimeter
Section: antishatter_tips
value = True
long_name = Use of antishatter-, or Korolev-, tips on probe arms
Section: bpp
value = 1
long_name = Bits per pixel used in image data
Section: wavelength
value = 658
long_name = Probe laser wavelength
units = nm
Section: particle_image_processing
particle_mask = 0
iRectEllipse = 0
iCalcAllDiodeStats = 1
Section: particle_size_distribution
probe_type = 6
tasMax = 170
time_interval_sec = 1
accepted_codes = ['0', 'H', 'R']
bin_edges = np.arange(50, 30060, 100)/1000.
diameter_choice = 6
applyIntArrThresh = 0
intArrThreshMode = probabilistic
defaultIntArrThresh = 1e-6
intArrProbAlphaStart = 0.01
intArrProbAlphaExtend = 0.05
intArrProbRollingWindowSec = 5
intArrProbMinLambda = 10.0
reaccptShatrs = 1
reaccptD = 0.05
reaccptMaxIAT = 1e-6
SAmethod = 0
iCreateAspectRatio = 0
iCreateBad = 1
------------------------------------------------------
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_drops_v01
Processing frames: 2500 frame [00:15, 160.35 frame/s]
Writing frames: 2500 frame [00:15, 160.36 frame/s]
220857 images processed in 15.590 seconds
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_drops_v01 to SPIF data output/spif_lvl0/Imagefile_20100101000000.PIP_drops_v01.nc
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_columns_v01
Processing frames: 2000 frame [00:13, 152.97 frame/s]
Writing frames: 2000 frame [00:13, 152.97 frame/s]
171022 images processed in 13.074 seconds
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_columns_v01 to SPIF data output/spif_lvl0/Imagefile_20100101000000.PIP_columns_v01.nc
INFO: cops.io: Processing file: ./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_ice_v01
Processing frames: 500 frame [00:07, 70.54 frame/s]
Writing frames: 500 frame [00:07, 70.55 frame/s]
16748 images processed in 7.088 seconds
INFO: cops.io: Converted raw data ./ICCP2024_probe_raw_data/Imagefile_20100101000000.PIP_ice_v01 to SPIF data output/spif_lvl0/Imagefile_20100101000000.PIP_ice_v01.nc
INFO: cops.io: All raw files have been processed. Done!