Read-only mirror of https://github.com/MeteoSwiss/snr_alc — MeteoSwiss. Issues & pull requests at the source.
  • Jupyter Notebook 99.3%
  • Python 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-27 11:19:54 +02:00
figures Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
notebooks Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
.gitignore Initial commit 2026-07-07 11:27:28 +02:00
alc_liquid_cloud.py Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
alc_snr_daily_l2_rolling.py Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
alc_snr_l1.py Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
alc_snr_l2.py Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
bsc_profile_snr_mask.png Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
bsc_snr_mask.png Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
old_alc_snr_l1.py Brought together all snr - alc scripts and cleaned up a little. Created alc_snr_l2.py which is the baseline to be shared with opertaional services 2026-07-07 15:49:56 +02:00
README.md Update README to highlight alc_snr_l2.py as main script 2026-07-27 11:19:54 +02:00

snr_alc

SNR computation and quality masking for E-Profile Automated Lidar Ceilometers (ALCs).

Files

File Description
alc_snr_l2.py Main script SNR calculation, SNR flag, + plotting. Directly on L2-like data, on a per-profile basis compatible with operational
alc_snr_l1.py SNR computation at L1 level - includes temporal averaging of data on a given time window
alc_snr_daily_l2_rolling.py Daily L2 SNR with rolling window, allows for morphological operations (but not real time processing)

Usage

Compute SNR flag and save to NetCDF

import xarray as xr
from alc_snr_l2 import compute_snr_flag

ds = xr.open_dataset('L2_file.nc', decode_times=False)
r = ds['altitude'] - ds.station_altitude
t = ds['time']
bsc = ds.attenuated_backscatter_0

snr_flag = compute_snr_flag(bsc, r, t, snr_threshold=3, range_dim='altitude')

ds_out = ds.assign(snr_flag=snr_flag)
ds_out.to_netcdf('L2_file_snr_flag.nc')

Compute SNR and plot

import xarray as xr
from alc_snr_l2 import calc_snr, plot_backscatter_timeseries_snr_mask, plot_backscatter_profile_snr_mask

ds = xr.open_dataset('L2_file.nc', decode_times=False)
r = ds['altitude'] - ds.station_altitude
t = ds['time']
bsc = ds.attenuated_backscatter_0

snr = calc_snr(bsc, r, t, range_dim='altitude', use_for_noise_bg='stdmin_rmlinfit')

fig, ax = plot_backscatter_timeseries_snr_mask(bsc, snr, r, t, snr_threshold=3)
fig, ax = plot_backscatter_profile_snr_mask(bsc, snr, r, t, snr_threshold=3)

SNR methods

use_for_noise_bg Description
top Background noise estimated from the top 10% of range gates
stdmin Background noise from the block of gates with lowest std deviation
stdmin_rmlinfit Same as stdmin but linear trend removed before std estimation (default)