Skip to main content

psapkit

psapkit processes raw telemetry from three-wavelength Particle Soot Absorption Photometers (PSAP) and Ecotech Aurora 3000 integrating nephelometers into harmonized L2 datasets. Built on Polars, it handles hex packet decoding (L0–L1), transmittance ($T_r$) and absorption coefficient ($\sigma$) re-calculation (L1–L1.5), Aurora zero/span calibration and Müller et al. (2011) truncation correction (L0–L2), multi-stage QA/QC flagging, and joint PSAP–nephelometer integration.

Install

pip install psapkit

Quick start (Dome C)

1. Meteorology & standalone PSAP (L0 → L1 → L1.5 → L2)

import polars as pl
from psapkit import (
    AbsorptionConfig,
    FlowCalibrationConfig,
    ScreeningConfig,
    aggregate_meteo_hourly,
    compute_uv_wind,
    process_l1_5_to_l2,
    process_l1_to_l1_5,
    process_raw_to_l1,
)

# Dome C clean-sector epochs (2008-2013: 20°-110°; 2014+: 10°-120°)
wd_sectors = ScreeningConfig.dome_c_default(
    post2014_sector=(10.0, 120.0)
).wd_contam_sectors

meteo_1m = pl.read_parquet("data/domec_meteo_1min.parquet")
meteo_1h = aggregate_meteo_hourly(
    compute_uv_wind(meteo_1m),
    wd_contam_sectors=wd_sectors,
)

psap_cfg = ScreeningConfig(
    wd_contam_sectors=wd_sectors,
    wd_contam_mode="1m",
    psap_blacklist="data/psap_blacklist.csv",
)

psap_l1 = process_raw_to_l1("data/domec_psap_raw", output_path="out/psap_l1.parquet")
psap_l1_5 = process_l1_to_l1_5(
    psap_l1,
    absorption_config=AbsorptionConfig.dome_c_default(),
    flow_config=FlowCalibrationConfig.dome_c_default(regime="gt05"),
    resolution="1h",
    output_path="out/psap_l1_5.parquet",
)
psap_l2 = process_l1_5_to_l2(
    psap_l1_5,
    meteo_df=meteo_1h,
    config=psap_cfg,
    output_path="out/psap_l2.parquet",
)

Or run the standalone Dome C PSAP workflow end-to-end:

from psapkit import run_psap_workflow

psap = run_psap_workflow(
    "data/domec_psap_raw",
    meteo_df=meteo_1h,
    absorption_config=AbsorptionConfig.dome_c_default(),
    flow_config=FlowCalibrationConfig.dome_c_default(regime="gt05"),
    screening_config=psap_cfg,
    output_dir="out/psap",
    save_intermediates=True,
    file_format="parquet",
)
print(psap.l2.head())
print(psap.spot_summary)

2. Aurora 3000 & integrated PSAP–nephelometer dataset

from psapkit import (
    NepheConfig,
    build_integrated_hourly_dataset,
    run_aurora_workflow,
)

aurora = run_aurora_workflow(
    "data/domec_aurora_l0.parquet",
    output_dir="out/aurora",
    config=NepheConfig(manual_blacklist="data/aurora_blacklist.csv"),
    run_l2=True,
)

joint_cfg = ScreeningConfig(
    wd_contam_sectors=wd_sectors,
    wd_contam_mode="1m",
    psap_blacklist="data/psap_blacklist.csv",
    nephe_blacklist="data/aurora_blacklist.csv",
    pack_flags_hex=True,
)
integrated = build_integrated_hourly_dataset(
    psap_df=psap.l1_5,
    nephe_df=aurora.l2_1h,
    meteo_df=meteo_1h,
    absorption_config=AbsorptionConfig.dome_c_default(),
    screening_config=joint_cfg,
    output_path="out/domec_integrated_1h.parquet",
)

Note:

  • Filter spot area (spot_area_mm2): Defaults to the nominal PSAP spot area of 17.81 mm² (4.76 mm diameter). For Dome C, use AbsorptionConfig.dome_c_default() (18.9 mm², 4.9 mm diameter; Virkkula et al., 2022) or pass a custom spot_area_mm2 value.
  • Clean-filter baseline ($r_0$ at $t_0$): Rather than relying on a single noisy minute immediately after a filter change, each spot's baseline ratio $r_0$ is phase-locked to the firmware transmittance using the median of $(\Delta I_{\mathrm{sample}} / \Delta I_{\mathrm{ref}}) / T_{r,\mathrm{firmware}}$ across stable minutes ($0.70 \le T_r \le 1.02$, $|\Delta T_r| \le 0.002$) within that spot_id.
  • Temporal resolution (resolution): Defaults to "1h", implementing the $\Delta t = 60\ \mathrm{min}$ detector-count integration method of Virkkula et al. (2022, Eq. 10) to avoid 1-second/1-minute digitization noise at low absorption levels. All valid modulo-$2^{40}$ A/D counter deltas within each clock hour (closed="left", requiring $\ge 30$ valid minutes) are accumulated, and $\sigma_0$ is computed from the logarithmic attenuation between consecutive hourly bins using their mean flow rate. Pass resolution="1m" if 1-minute output is needed.

Dome C calibration and screening

AbsorptionConfig.dome_c_default() and FlowCalibrationConfig.dome_c_default() supply the spot area and three operational flow-regression periods used for Dome C. For another site, pass a custom spot_area_mm2, provide FlowSegment objects (timestamp, slope, intercept, and optional time dependence), set a constant factor, or disable flow correction with FlowCalibrationConfig.disabled().

ScreeningConfig exposes flow and transmittance thresholds, wind-contamination sectors and calm-wind threshold, manual date-range blacklists (psap_blacklist and nephe_blacklist), and transient-screening controls. Transient plume screening (flag_rapid_transient) operates strictly on PSAP-only absorption (sigma_b1999_nsc_green) so standalone PSAP and integrated L2 screening remain identical; with no meteorology input, wind contamination is explicitly flagged False. For Aurora 3000 processing, NepheConfig exposes zero/span check QC criteria, piecewise epoch gain settings, scoped calibration blacklists, and Müller et al. (2011) no_cut truncation options.

Stages and data

  • PSAP Raw → L1: parse_raw_file / process_raw_to_l1; supports one file, a directory, and readable file-like objects.
  • PSAP L1 → L1.5: compute_psap_absorption / process_l1_to_l1_5; provides spot_id, tr_recomputed_*, sigma_0_*, sigma_b1999_nsc_* (Bond et al., 1999 without scattering subtraction), and hourly (default) or 1-minute resolution.
  • PSAP L1.5 → L2: process_l1_5_to_l2; adds QA flags (flag_clean_psap, etc.) without modifying or removing any numeric values.
  • Aurora L0 → L1 → L2: process_aurora_l0_to_l1 / process_aurora_l1_to_l2 / run_aurora_workflow; performs segmented zero check, span check, and no_cut truncation correction (SCA*_L2, BSC*_L2).
  • Integrated L2: build_integrated_hourly_dataset; interpolates Aurora scattering (sca_*, bsc_*) to PSAP bands (467/530/660 nm), applies Bond et al. (1999) and Virkkula (2010) corrections, derives ssa_*/sae_*/aae_*, and packs QC flags (qc_flags_hex).

Optional stage outputs accept .parquet and .csv paths. The optional meteorology module includes UV wind decomposition and hourly aggregation.

References

  • Bond, T. C., Anderson, T. L., and Campbell, D. (1999). Calibration and intercomparison of filter-based measurements of visible light absorption by aerosols. Aerosol Science and Technology, 30, 582–600. https://doi.org/10.1080/027868299304435
  • Müller, T., Laborde, M., Kassell, G., and Wiedensohler, A. (2011). Design and performance of a three-wavelength LED-based total scatter and backscatter integrating nephelometer. Atmospheric Measurement Techniques, 4, 1291–1303. https://doi.org/10.5194/amt-4-1291-2011
  • Virkkula, A., Ahlquist, N. C., Covert, D. S., Arnott, W. P., Sheridan, P. J., Quinn, P. K., and Coffman, D. J. (2005). Modification, calibration and a field test of an instrument for measuring light absorption by particles. Aerosol Science and Technology, 39(1), 68–83. https://doi.org/10.1080/027868290901963
  • Virkkula, A. (2010). Correction of the calibration of the 3-wavelength particle soot absorption photometer (3λ PSAP). Aerosol Science and Technology, 44(8), 706–712. https://doi.org/10.1080/02786826.2010.482110
  • Virkkula, A., et al. (2022). Aerosol optical properties calculated from size distributions, filter samples and absorption photometer data at Dome C, Antarctica, and their relationships with seasonal cycles of sources. Atmospheric Chemistry and Physics, 22(7), 5033–5069. https://acp.copernicus.org/articles/22/5033/2022

License

MIT. See LICENSE.

Metadata

Release files for psapkit 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psapkit 0.2.0
File Size Uploaded Provenance Actions
psapkit-0.2.0.tar.gz 64.0 kB With provenance Details for psapkit-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for psapkit 0.2.0
File Interpreter ABI Platform Actions
psapkit-0.2.0-py3-none-any.whl Python 3 none any Details for psapkit-0.2.0-py3-none-any.whl

Total release size: 124.9 kB

Release files / psapkit-0.2.0.tar.gz

Download URL psapkit-0.2.0.tar.gz
Size 64.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dec0f197f269f3cb263ae7d8baa80829bce0d2b7bad0451a50c417a4c754dbed
BLAKE2b-256 checksum
How to use checksums
a61589b80a00c2108e9c4f0d2e891a1b29bf9bdc02741f09be785f3383e7c9ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / psapkit-0.2.0-py3-none-any.whl

Download URL psapkit-0.2.0-py3-none-any.whl
Size 60.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6029912872b4b17b1aa3da1526de7dea185a439b797d289b00c7b3c1ab7d54d6
BLAKE2b-256 checksum
How to use checksums
d26caca0d9e9738118fb36019c817394d5b78b81385f0e63ca68e279d3202243
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for psapkit 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for psapkit-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page