ceilopyter 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/CHANGELOG.md +5 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/PKG-INFO +1 -1
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/instruments/chm15k.py +33 -10
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/instruments/ld40.py +8 -1
- ceilopyter-0.2.4/ceilopyter/version.py +1 -0
- ceilopyter-0.2.3/ceilopyter/version.py +0 -1
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/.github/workflows/publish.yml +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/.github/workflows/test.yml +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/.gitignore +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/.pre-commit-config.yaml +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/LICENSE +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/README.md +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/__init__.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/ceilo.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/ceilo_raw.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/cli.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/common.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/instruments/cl31.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/instruments/cl51.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/instruments/cl61.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/instruments/cs135.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/instruments/ct25k.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/noise.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/py.typed +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/readers/read_cl.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/readers/read_cs.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/readers/read_ct.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/ceilopyter/utils.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/pyproject.toml +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/tests/data/celio_chennai_2025-03-11.dat +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/tests/data/kauniainen_cl31.dat +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/tests/data/kenttarova_cl31_msg.dat +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/tests/data/palaiseau_cl31_msg.dat +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/tests/data/uto_cl31_msg.dat +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/tests/test_cl.py +0 -0
- {ceilopyter-0.2.3 → ceilopyter-0.2.4}/tests/test_utils.py +0 -0
|
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 0.2.4 – 2026-10-14
|
|
9
|
+
|
|
10
|
+
- Fix errors with old CHM 15k files
|
|
11
|
+
- Handle empty LD40 files
|
|
12
|
+
|
|
8
13
|
## 0.2.3 – 2026-10-13
|
|
9
14
|
|
|
10
15
|
- Add noise screening for LD40
|
|
@@ -53,22 +53,47 @@ def read_chm15k(
|
|
|
53
53
|
|
|
54
54
|
def _read_file(file: str | PathLike) -> CeiloRaw:
|
|
55
55
|
with netCDF4.Dataset(file) as nc:
|
|
56
|
-
time =
|
|
57
|
-
|
|
58
|
-
beta = _get_beta(nc)
|
|
59
|
-
wavelength =
|
|
56
|
+
time, time_ind = _get_time(nc)
|
|
57
|
+
rng = _get_range(nc)
|
|
58
|
+
beta = _get_beta(nc, rng)[time_ind]
|
|
59
|
+
wavelength = 1064.0
|
|
60
60
|
zenith_angle = nc["zenith"][:] if "zenith" in nc.variables else None
|
|
61
61
|
serial_number = nc.source
|
|
62
|
-
return CeiloRaw(time,
|
|
62
|
+
return CeiloRaw(time, rng, beta, wavelength, zenith_angle, serial_number)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# Filter outliers in some files (e.g. Lindenberg 2010-12-02 and 2010-12-18).
|
|
66
|
+
_TIME_MIN = 0 # 1904-01-01 00:00:00
|
|
67
|
+
_TIME_MAX = 255485145599 # 9999-12-31 23:59:59
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _get_time(nc: netCDF4.Dataset):
|
|
71
|
+
time = nc["time"][:]
|
|
72
|
+
time_ind = (time >= _TIME_MIN) & (time <= _TIME_MAX)
|
|
73
|
+
time = num2pydate(time[time_ind], nc["time"].units)
|
|
74
|
+
return time, time_ind
|
|
63
75
|
|
|
64
76
|
|
|
65
77
|
def _get_range(nc: netCDF4.Dataset):
|
|
66
78
|
rng = nc["range"][:]
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
if ma.getmaskarray(rng).all():
|
|
80
|
+
# Variable range, and sometimes range_gate, are masked in some old files
|
|
81
|
+
# (e.g. Lindenberg 2008-06-04 and 2010-10-15). According to the manual,
|
|
82
|
+
# NetCDF data resolution is 5 m – 30 m in 5 m steps (can be set by the
|
|
83
|
+
# user, default 15 m).
|
|
84
|
+
rng_gate = 5 * round(15000 / (5 * len(rng)))
|
|
85
|
+
logging.warning(
|
|
86
|
+
"range is masked, calculating it assuming resolution of %s m", rng_gate
|
|
87
|
+
)
|
|
88
|
+
rng = rng_gate * np.arange(1, len(rng) + 1)
|
|
89
|
+
else:
|
|
90
|
+
rng_gate = rng[1] - rng[0]
|
|
91
|
+
return rng - rng_gate / 2
|
|
69
92
|
|
|
70
93
|
|
|
71
|
-
def _get_beta(
|
|
94
|
+
def _get_beta(
|
|
95
|
+
nc: netCDF4.Dataset, rng: npt.NDArray[np.floating]
|
|
96
|
+
) -> npt.NDArray[np.floating]:
|
|
72
97
|
"""Get range-corrected backscatter coefficient.
|
|
73
98
|
|
|
74
99
|
References:
|
|
@@ -91,14 +116,12 @@ def _get_beta(nc: netCDF4.Dataset) -> npt.NDArray[np.floating]:
|
|
|
91
116
|
# beta_raw = P_raw
|
|
92
117
|
laser_pulses = nc["laser_pulses"][:]
|
|
93
118
|
base = np.mean(beta[:, -5:], axis=1) / laser_pulses
|
|
94
|
-
rng = nc["range"][:]
|
|
95
119
|
overlap = awful_overlap(rng, 200, 800)
|
|
96
120
|
signal = beta / laser_pulses[:, np.newaxis] - base[:, np.newaxis]
|
|
97
121
|
beta = signal / overlap * rng**2
|
|
98
122
|
elif isinstance(sw_version, np.integer) or sw_version < "0.702":
|
|
99
123
|
# beta_raw = (P_raw / laser_pulses - base) / stddev
|
|
100
124
|
apd = _get_nn(nc)
|
|
101
|
-
rng = nc["range"][:]
|
|
102
125
|
overlap = awful_overlap(rng, 200, 800)
|
|
103
126
|
stddev = nc["stddev"][:]
|
|
104
127
|
signal = beta * stddev[:, np.newaxis]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import logging
|
|
3
|
+
import os.path
|
|
3
4
|
from os import PathLike
|
|
4
5
|
|
|
5
6
|
import numpy as np
|
|
@@ -24,7 +25,11 @@ def read_ld40(
|
|
|
24
25
|
logging.warning("Using default calibration factor: %s", calibration_factor)
|
|
25
26
|
raw = []
|
|
26
27
|
for file in files:
|
|
27
|
-
|
|
28
|
+
try:
|
|
29
|
+
raw.append(_read_file(file))
|
|
30
|
+
except InvalidMessageError as e:
|
|
31
|
+
logging.warning("Failed to read %s: %s", os.path.basename(file), e)
|
|
32
|
+
continue
|
|
28
33
|
concat = concatenate_raw(raw)
|
|
29
34
|
r2 = (concat.range * 1e-3) ** 2
|
|
30
35
|
beta_raw = concat.beta * calibration_factor
|
|
@@ -75,6 +80,8 @@ def _read_file(filename: str | PathLike) -> CeiloRaw:
|
|
|
75
80
|
)
|
|
76
81
|
)
|
|
77
82
|
betas.append(np.array([int(v) for v in values[2:]]))
|
|
83
|
+
if len(times) == 0:
|
|
84
|
+
raise InvalidMessageError("No data")
|
|
78
85
|
res = rng[1] - rng[0]
|
|
79
86
|
rng = rng + res / 2
|
|
80
87
|
time = np.array(times)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.4"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|