ceilopyter 0.2.0__tar.gz → 0.2.2__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.0 → ceilopyter-0.2.2}/.github/workflows/publish.yml +3 -3
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/.github/workflows/test.yml +2 -2
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/CHANGELOG.md +11 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/PKG-INFO +6 -2
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/ceilo.py +8 -2
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/ceilo_raw.py +19 -8
- ceilopyter-0.2.2/ceilopyter/cli.py +164 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/instruments/chm15k.py +56 -19
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/instruments/cl31.py +1 -1
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/instruments/cl51.py +1 -1
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/instruments/cl61.py +1 -1
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/instruments/cs135.py +1 -1
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/instruments/ct25k.py +10 -2
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/instruments/ld40.py +9 -2
- ceilopyter-0.2.2/ceilopyter/noise.py +145 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/readers/read_cl.py +12 -8
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/utils.py +51 -0
- ceilopyter-0.2.2/ceilopyter/version.py +1 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/pyproject.toml +5 -2
- ceilopyter-0.2.2/tests/data/kauniainen_cl31.dat +14 -0
- ceilopyter-0.2.2/tests/data/kenttarova_cl31_msg.dat +6 -0
- ceilopyter-0.2.2/tests/data/palaiseau_cl31_msg.dat +6 -0
- ceilopyter-0.2.2/tests/data/uto_cl31_msg.dat +6 -0
- ceilopyter-0.2.2/tests/test_cl.py +45 -0
- ceilopyter-0.2.2/tests/test_utils.py +29 -0
- ceilopyter-0.2.0/ceilopyter/noise.py +0 -22
- ceilopyter-0.2.0/ceilopyter/version.py +0 -1
- ceilopyter-0.2.0/tests/test_cl.py +0 -17
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/.gitignore +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/.pre-commit-config.yaml +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/LICENSE +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/README.md +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/__init__.py +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/common.py +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/py.typed +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/readers/read_cs.py +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/ceilopyter/readers/read_ct.py +0 -0
- {ceilopyter-0.2.0 → ceilopyter-0.2.2}/tests/data/celio_chennai_2025-03-11.dat +0 -0
|
@@ -12,9 +12,9 @@ jobs:
|
|
|
12
12
|
contents: write
|
|
13
13
|
id-token: write
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
16
|
- name: Set up Python
|
|
17
|
-
uses: actions/setup-python@
|
|
17
|
+
uses: actions/setup-python@v6
|
|
18
18
|
with:
|
|
19
19
|
python-version: "3.10"
|
|
20
20
|
- name: Install dependencies
|
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
echo "name=Ceilopyter $version" >> $GITHUB_OUTPUT
|
|
31
31
|
id: changelog
|
|
32
32
|
- name: Create release
|
|
33
|
-
uses: softprops/action-gh-release@
|
|
33
|
+
uses: softprops/action-gh-release@v2
|
|
34
34
|
with:
|
|
35
35
|
name: ${{ steps.changelog.outputs.name }}
|
|
36
36
|
body_path: ${{ github.workspace }}-CHANGELOG.txt
|
|
@@ -11,9 +11,9 @@ jobs:
|
|
|
11
11
|
|
|
12
12
|
runs-on: ${{ matrix.os }}
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@v6
|
|
15
15
|
- name: Set up Python ${{ matrix.python-version }}
|
|
16
|
-
uses: actions/setup-python@
|
|
16
|
+
uses: actions/setup-python@v6
|
|
17
17
|
with:
|
|
18
18
|
python-version: ${{ matrix.python-version }}
|
|
19
19
|
cache: "pip"
|
|
@@ -5,6 +5,17 @@ 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.2 – 2026-10-01
|
|
9
|
+
|
|
10
|
+
- Improve CHM 15k processing
|
|
11
|
+
- Support timestamp format in Kolsass
|
|
12
|
+
- Add command-line interface
|
|
13
|
+
|
|
14
|
+
## 0.2.1 – 2026-04-14
|
|
15
|
+
|
|
16
|
+
- Fix checksum calculation for CL31 messages
|
|
17
|
+
- Support CL31 logger format with comma-separated timestamp header
|
|
18
|
+
|
|
8
19
|
## 0.2.0 – 2025-06-18
|
|
9
20
|
|
|
10
21
|
- Add LD40, CL61 and CHM 15k readers
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: ceilopyter
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Read ceilometer data
|
|
5
5
|
Project-URL: Homepage, https://github.com/actris-cloudnet/ceilopyter
|
|
6
6
|
Project-URL: Issues, https://github.com/actris-cloudnet/ceilopyter/issues
|
|
@@ -13,11 +13,15 @@ Classifier: Operating System :: OS Independent
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
15
15
|
Requires-Python: >=3.10
|
|
16
|
+
Requires-Dist: cloudnet-api-client
|
|
17
|
+
Requires-Dist: matplotlib
|
|
16
18
|
Requires-Dist: netcdf4
|
|
17
19
|
Requires-Dist: numpy
|
|
20
|
+
Requires-Dist: scipy
|
|
18
21
|
Provides-Extra: dev
|
|
19
22
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
20
23
|
Requires-Dist: release-version; extra == 'dev'
|
|
24
|
+
Requires-Dist: scipy-stubs; extra == 'dev'
|
|
21
25
|
Provides-Extra: test
|
|
22
26
|
Requires-Dist: mypy; extra == 'test'
|
|
23
27
|
Requires-Dist: pytest; extra == 'test'
|
|
@@ -5,28 +5,34 @@ from .ceilo_raw import CeiloRaw
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class Ceilo:
|
|
8
|
-
"""
|
|
8
|
+
"""Ceilometer data.
|
|
9
9
|
|
|
10
10
|
Attributes:
|
|
11
11
|
time: Time
|
|
12
12
|
range: Range (m)
|
|
13
13
|
beta_raw: Non-screened range-corrected backscatter coefficient (sr-1 m-1)
|
|
14
14
|
beta: Screened range-corrected backscatter coefficient (sr-1 m-1)
|
|
15
|
+
beta_smooth: Screened range-corrected smoothed backscatter coefficient
|
|
16
|
+
(sr-1 m-1)
|
|
15
17
|
wavelength: Wavelength (nm)
|
|
16
18
|
zenith_angle: Zenith angle (deg)
|
|
19
|
+
serial_number: Instrument serial number
|
|
17
20
|
"""
|
|
18
21
|
|
|
19
22
|
def __init__(
|
|
20
23
|
self,
|
|
21
24
|
raw: CeiloRaw,
|
|
22
25
|
beta_raw: npt.NDArray[np.floating],
|
|
23
|
-
beta: npt.NDArray[np.floating] | None,
|
|
24
26
|
calibration_factor: float,
|
|
27
|
+
beta: npt.NDArray[np.floating] | None = None,
|
|
28
|
+
beta_smooth: npt.NDArray[np.floating] | None = None,
|
|
25
29
|
):
|
|
26
30
|
self.time = raw.time
|
|
27
31
|
self.range = raw.range
|
|
28
32
|
self.beta = beta
|
|
29
33
|
self.beta_raw = beta_raw
|
|
34
|
+
self.beta_smooth = beta_smooth
|
|
30
35
|
self.calibration_factor = calibration_factor
|
|
31
36
|
self.wavelength = raw.wavelength
|
|
32
37
|
self.zenith_angle = raw.zenith_angle
|
|
38
|
+
self.serial_number = raw.serial_number
|
|
@@ -21,12 +21,14 @@ class CeiloRaw:
|
|
|
21
21
|
beta: npt.NDArray[np.floating],
|
|
22
22
|
wavelength: float,
|
|
23
23
|
zenith_angle: npt.NDArray[np.floating] | None = None,
|
|
24
|
+
serial_number: str | None = None,
|
|
24
25
|
):
|
|
25
26
|
self.time = time
|
|
26
27
|
self.range = range
|
|
27
28
|
self.beta = beta
|
|
28
29
|
self.wavelength = wavelength
|
|
29
30
|
self.zenith_angle = zenith_angle
|
|
31
|
+
self.serial_number = serial_number
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
def concatenate_raw(raw: list[CeiloRaw]) -> CeiloRaw:
|
|
@@ -35,25 +37,33 @@ def concatenate_raw(raw: list[CeiloRaw]) -> CeiloRaw:
|
|
|
35
37
|
if len(raw) == 1:
|
|
36
38
|
return raw[0]
|
|
37
39
|
|
|
40
|
+
serial_number = raw[0].serial_number
|
|
41
|
+
if any(r.serial_number != serial_number for r in raw):
|
|
42
|
+
raise ValueError("Inconsistent serial number")
|
|
43
|
+
|
|
44
|
+
wavelength = raw[0].wavelength
|
|
45
|
+
if any(r.wavelength != wavelength for r in raw):
|
|
46
|
+
raise ValueError("Inconsistent wavelength")
|
|
47
|
+
|
|
38
48
|
all_time = np.concatenate([r.time for r in raw])
|
|
39
|
-
|
|
49
|
+
n_time = len(all_time)
|
|
50
|
+
|
|
51
|
+
uniq_time, time_ind = np.unique(all_time, return_index=True)
|
|
40
52
|
all_zenith_angle = (
|
|
41
53
|
None
|
|
42
54
|
if all(r.zenith_angle is None for r in raw)
|
|
43
|
-
else np.concatenate(
|
|
55
|
+
else np.concatenate(
|
|
56
|
+
[np.broadcast_to(r.zenith_angle, len(r.time)) for r in raw] # type: ignore[arg-type]
|
|
57
|
+
)[time_ind]
|
|
44
58
|
)
|
|
45
59
|
|
|
46
|
-
wavelength = raw[0].wavelength
|
|
47
|
-
if any(r.wavelength != wavelength for r in raw):
|
|
48
|
-
raise ValueError("Inconsistent wavelength")
|
|
49
|
-
|
|
50
60
|
all_rngs = [r.range for r in raw]
|
|
51
61
|
max_rng = max(all_rngs, key=len)
|
|
52
62
|
for rng in all_rngs:
|
|
53
63
|
if not np.array_equal(rng, max_rng[: len(rng)]):
|
|
54
64
|
raise ValueError("Inconsistent ranges")
|
|
55
65
|
|
|
56
|
-
all_beta = ma.masked_all((
|
|
66
|
+
all_beta = ma.masked_all((n_time, len(max_rng)))
|
|
57
67
|
i = 0
|
|
58
68
|
for r in raw:
|
|
59
69
|
all_beta[i : i + len(r.time), : len(r.range)] = r.beta
|
|
@@ -61,9 +71,10 @@ def concatenate_raw(raw: list[CeiloRaw]) -> CeiloRaw:
|
|
|
61
71
|
all_beta = all_beta[time_ind]
|
|
62
72
|
|
|
63
73
|
return CeiloRaw(
|
|
64
|
-
|
|
74
|
+
uniq_time,
|
|
65
75
|
max_rng,
|
|
66
76
|
all_beta,
|
|
67
77
|
wavelength,
|
|
68
78
|
all_zenith_angle,
|
|
79
|
+
serial_number,
|
|
69
80
|
)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import datetime
|
|
3
|
+
import gzip
|
|
4
|
+
import logging
|
|
5
|
+
import shutil
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
import numpy as np
|
|
10
|
+
from cloudnet_api_client import APIClient
|
|
11
|
+
from numpy import ma
|
|
12
|
+
|
|
13
|
+
from ceilopyter import (
|
|
14
|
+
read_chm15k,
|
|
15
|
+
read_cl31,
|
|
16
|
+
read_cl51,
|
|
17
|
+
read_cl61,
|
|
18
|
+
read_cs135,
|
|
19
|
+
read_ct25k,
|
|
20
|
+
read_ld40,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def make_edges(centers):
|
|
25
|
+
edges = np.empty(len(centers) + 1)
|
|
26
|
+
edges[0] = centers[0] - (centers[1] - centers[0]) / 2
|
|
27
|
+
edges[1:-1] = (centers[:-1] + centers[1:]) / 2
|
|
28
|
+
edges[-1] = centers[-1] + (centers[-1] - centers[-2]) / 2
|
|
29
|
+
return edges
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def main():
|
|
33
|
+
parser = argparse.ArgumentParser()
|
|
34
|
+
parser.add_argument("-f", "--files", type=Path, nargs="+", help="path to raw data")
|
|
35
|
+
parser.add_argument("-s", "--site", help="Cloudnet site identifier (e.g. hyytiala)")
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"-d",
|
|
38
|
+
"--date",
|
|
39
|
+
type=datetime.date.fromisoformat,
|
|
40
|
+
help="measurement date (YYYY-MM-DD)",
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
"-i",
|
|
44
|
+
"--instrument",
|
|
45
|
+
choices=[
|
|
46
|
+
"ld40",
|
|
47
|
+
"ct25k",
|
|
48
|
+
"cl31",
|
|
49
|
+
"cl51",
|
|
50
|
+
"cl61d",
|
|
51
|
+
"cs135",
|
|
52
|
+
"chm15k",
|
|
53
|
+
"chm15kx",
|
|
54
|
+
],
|
|
55
|
+
required=True,
|
|
56
|
+
help="instrument identifier",
|
|
57
|
+
)
|
|
58
|
+
parser.add_argument(
|
|
59
|
+
"--noise-h2",
|
|
60
|
+
choices=["on", "off"],
|
|
61
|
+
default="on",
|
|
62
|
+
help="noise range correction (ct25k, cl31, cl51)",
|
|
63
|
+
)
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
"--calibration-factor", type=float, help="instrument calibration factor"
|
|
66
|
+
)
|
|
67
|
+
args = parser.parse_args()
|
|
68
|
+
|
|
69
|
+
if args.files and (args.site or args.date):
|
|
70
|
+
parser.error("cannot use --files with --site and --date")
|
|
71
|
+
elif args.files:
|
|
72
|
+
file_paths = args.files
|
|
73
|
+
elif args.site and args.date:
|
|
74
|
+
client = APIClient()
|
|
75
|
+
raw_dir = "data_raw/"
|
|
76
|
+
raw_metadata = client.raw_files(
|
|
77
|
+
site_id=args.site,
|
|
78
|
+
date=args.date,
|
|
79
|
+
instrument_id=args.instrument,
|
|
80
|
+
status=["uploaded", "processed"],
|
|
81
|
+
)
|
|
82
|
+
instrument_pids = sorted({r.instrument.pid for r in raw_metadata})
|
|
83
|
+
if len(instrument_pids) > 1:
|
|
84
|
+
logging.warning("Multiple instruments found, using %s", instrument_pids[0])
|
|
85
|
+
raw_metadata = [
|
|
86
|
+
r for r in raw_metadata if r.instrument.pid == instrument_pids[0]
|
|
87
|
+
]
|
|
88
|
+
file_paths = client.download(raw_metadata, raw_dir)
|
|
89
|
+
else:
|
|
90
|
+
parser.error("use --files or --site and --date")
|
|
91
|
+
|
|
92
|
+
file_paths2 = []
|
|
93
|
+
for path_in in file_paths:
|
|
94
|
+
if path_in.suffix.lower() == ".gz":
|
|
95
|
+
path_out = path_in.parent / path_in.stem
|
|
96
|
+
print(f"Decompressing {path_in} to {path_out}")
|
|
97
|
+
with gzip.open(path_in, "rb") as file_in, open(path_out, "wb") as file_out:
|
|
98
|
+
shutil.copyfileobj(file_in, file_out)
|
|
99
|
+
file_paths2.append(path_out)
|
|
100
|
+
else:
|
|
101
|
+
file_paths2.append(path_in)
|
|
102
|
+
|
|
103
|
+
if args.instrument == "ct25k":
|
|
104
|
+
ceilo = read_ct25k(file_paths2, args.calibration_factor, args.noise_h2 == "on")
|
|
105
|
+
elif args.instrument == "cl31":
|
|
106
|
+
ceilo = read_cl31(file_paths2, args.calibration_factor)
|
|
107
|
+
elif args.instrument == "cl51":
|
|
108
|
+
ceilo = read_cl51(file_paths2, args.calibration_factor)
|
|
109
|
+
elif args.instrument in ("chm15k", "chm15kx"):
|
|
110
|
+
ceilo = read_chm15k(file_paths2, args.calibration_factor)
|
|
111
|
+
elif args.instrument == "cl61d":
|
|
112
|
+
ceilo = read_cl61(file_paths2, args.calibration_factor)
|
|
113
|
+
elif args.instrument == "cs135":
|
|
114
|
+
ceilo = read_cs135(file_paths2, args.calibration_factor)
|
|
115
|
+
elif args.instrument == "ld40":
|
|
116
|
+
ceilo = read_ld40(file_paths2, args.calibration_factor)
|
|
117
|
+
else:
|
|
118
|
+
raise NotImplementedError
|
|
119
|
+
|
|
120
|
+
vmin = 1e-7
|
|
121
|
+
vmax = 1e-4
|
|
122
|
+
plt_beta_raw = ma.log10(np.maximum(vmin, ceilo.beta_raw))
|
|
123
|
+
plt_beta = (
|
|
124
|
+
ma.log10(np.maximum(vmin, ceilo.beta)) if ceilo.beta is not None else None
|
|
125
|
+
)
|
|
126
|
+
plt_time = make_edges(np.arange(len(ceilo.time)))
|
|
127
|
+
range_km = ceilo.range / 1000
|
|
128
|
+
plt_rng = make_edges(range_km)
|
|
129
|
+
|
|
130
|
+
fig, (ax1, ax2) = plt.subplots(2, sharex=True, sharey=True, figsize=(15, 5))
|
|
131
|
+
ax1.set_title("beta_raw")
|
|
132
|
+
ax1.set_ylabel("Range (km)")
|
|
133
|
+
ax1.pcolorfast(
|
|
134
|
+
plt_time, plt_rng, plt_beta_raw.T, vmin=np.log10(vmin), vmax=np.log10(vmax)
|
|
135
|
+
)
|
|
136
|
+
ax2.set_title("beta")
|
|
137
|
+
ax2.set_ylabel("Range (km)")
|
|
138
|
+
ax2.set_xlabel("Time index")
|
|
139
|
+
if plt_beta is not None:
|
|
140
|
+
ax2.pcolorfast(
|
|
141
|
+
plt_time, plt_rng, plt_beta.T, vmin=np.log10(vmin), vmax=np.log10(vmax)
|
|
142
|
+
)
|
|
143
|
+
plt.tight_layout()
|
|
144
|
+
|
|
145
|
+
def onclick(event):
|
|
146
|
+
if fig.canvas.manager.toolbar.mode:
|
|
147
|
+
return
|
|
148
|
+
i = round(event.xdata)
|
|
149
|
+
|
|
150
|
+
fig2, axs = plt.subplots(1, 2, sharey=True)
|
|
151
|
+
axs[0].set_title(f"beta_raw i={i}")
|
|
152
|
+
axs[0].plot(ceilo.beta_raw[i], range_km)
|
|
153
|
+
axs[0].set_ylabel("Range (km)")
|
|
154
|
+
axs[1].set_title(f"beta_uncorr i={i}")
|
|
155
|
+
axs[1].plot(ceilo.beta_raw[i] / range_km**2, range_km)
|
|
156
|
+
plt.show()
|
|
157
|
+
|
|
158
|
+
fig.canvas.mpl_connect("button_press_event", onclick)
|
|
159
|
+
|
|
160
|
+
plt.show()
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
if __name__ == "__main__":
|
|
164
|
+
main()
|
|
@@ -7,6 +7,9 @@ import numpy.typing as npt
|
|
|
7
7
|
from cftime import num2pydate
|
|
8
8
|
from numpy import ma
|
|
9
9
|
|
|
10
|
+
from ceilopyter.noise import remove_noise
|
|
11
|
+
from ceilopyter.utils import awful_overlap
|
|
12
|
+
|
|
10
13
|
from ..ceilo import Ceilo
|
|
11
14
|
from ..ceilo_raw import CeiloRaw, concatenate_raw
|
|
12
15
|
|
|
@@ -25,17 +28,41 @@ def read_chm15k(
|
|
|
25
28
|
raw.append(_read_file(file))
|
|
26
29
|
concat = concatenate_raw(raw)
|
|
27
30
|
beta_raw = concat.beta * calibration_factor
|
|
28
|
-
|
|
31
|
+
|
|
32
|
+
beta_uncorr = beta_raw / (concat.range * 1e-3) ** 2
|
|
33
|
+
is_noise, beta_smooth = remove_noise(
|
|
34
|
+
concat.time,
|
|
35
|
+
concat.range,
|
|
36
|
+
beta_uncorr,
|
|
37
|
+
noise_floor=4e-9,
|
|
38
|
+
filter_above_negative=True,
|
|
39
|
+
)
|
|
40
|
+
beta = ma.masked_where(is_noise, beta_raw)
|
|
41
|
+
|
|
42
|
+
return Ceilo(
|
|
43
|
+
concat,
|
|
44
|
+
beta_raw=beta_raw,
|
|
45
|
+
beta=beta,
|
|
46
|
+
beta_smooth=beta_smooth,
|
|
47
|
+
calibration_factor=calibration_factor,
|
|
48
|
+
)
|
|
29
49
|
|
|
30
50
|
|
|
31
51
|
def _read_file(file: str | PathLike) -> CeiloRaw:
|
|
32
52
|
with netCDF4.Dataset(file) as nc:
|
|
33
53
|
time = num2pydate(nc["time"][:], nc["time"].units)
|
|
34
|
-
range = nc
|
|
54
|
+
range = _get_range(nc)
|
|
35
55
|
beta = _get_beta(nc)
|
|
36
56
|
wavelength = nc["wavelength"][:]
|
|
37
|
-
zenith_angle = nc["zenith"][:]
|
|
38
|
-
|
|
57
|
+
zenith_angle = nc["zenith"][:] if "zenith" in nc.variables else None
|
|
58
|
+
serial_number = nc.source
|
|
59
|
+
return CeiloRaw(time, range, beta, wavelength, zenith_angle, serial_number)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _get_range(nc: netCDF4.Dataset):
|
|
63
|
+
rng = nc["range"][:]
|
|
64
|
+
res = rng[1] - rng[0]
|
|
65
|
+
return rng - res / 2
|
|
39
66
|
|
|
40
67
|
|
|
41
68
|
def _get_beta(nc: netCDF4.Dataset) -> npt.NDArray[np.floating]:
|
|
@@ -53,37 +80,45 @@ def _get_beta(nc: netCDF4.Dataset) -> npt.NDArray[np.floating]:
|
|
|
53
80
|
# When netcdf_mode is 2 (or unspecified in old files), we have beta_raw
|
|
54
81
|
# without calibration factor applied. This mode is recommended in ACTRIS
|
|
55
82
|
# CCRES ALC SOP.
|
|
83
|
+
# beta = ((P_raw / lp) - b) / (cs * o(r) * p_calc) * r * r
|
|
56
84
|
beta = nc["beta_raw"][:]
|
|
57
85
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
86
|
+
sw_version = _get_sw_version(nc)
|
|
87
|
+
if isinstance(sw_version, np.integer) and sw_version <= 135:
|
|
88
|
+
# beta_raw = P_raw
|
|
89
|
+
laser_pulses = nc["laser_pulses"][:]
|
|
90
|
+
base = np.mean(beta[:, -5:], axis=1) / laser_pulses
|
|
91
|
+
rng = nc["range"][:]
|
|
92
|
+
overlap = awful_overlap(rng, 200, 800)
|
|
93
|
+
signal = beta / laser_pulses[:, np.newaxis] - base[:, np.newaxis]
|
|
94
|
+
beta = signal / overlap * rng**2
|
|
95
|
+
elif isinstance(sw_version, np.integer) or sw_version < "0.702":
|
|
96
|
+
# beta_raw = (P_raw / laser_pulses - base) / stddev
|
|
97
|
+
apd = _get_nn(nc)
|
|
62
98
|
rng = nc["range"][:]
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
beta
|
|
66
|
-
beta
|
|
99
|
+
overlap = awful_overlap(rng, 200, 800)
|
|
100
|
+
stddev = nc["stddev"][:]
|
|
101
|
+
signal = beta * stddev[:, np.newaxis]
|
|
102
|
+
beta = signal / (overlap * apd[:, np.newaxis]) * rng**2
|
|
67
103
|
|
|
68
104
|
return beta
|
|
69
105
|
|
|
70
106
|
|
|
71
|
-
def
|
|
107
|
+
def _get_sw_version(nc: netCDF4.Dataset) -> np.integer | str:
|
|
72
108
|
version = nc.software_version
|
|
73
109
|
# In old files, the version is a single integer.
|
|
74
110
|
if isinstance(version, np.integer):
|
|
75
|
-
return
|
|
111
|
+
return version
|
|
76
112
|
# In newer files, the version is a space-separated list: Operating system,
|
|
77
113
|
# FPGA, firmware, CloudDetectionMode (added in firmware version 0.747).
|
|
78
114
|
if isinstance(version, str):
|
|
79
115
|
parts = version.split()
|
|
80
|
-
|
|
81
|
-
return firmware < "0.702"
|
|
116
|
+
return parts[2]
|
|
82
117
|
msg = f"Cannot determine version: {version}"
|
|
83
118
|
raise ValueError(msg)
|
|
84
119
|
|
|
85
120
|
|
|
86
|
-
def _get_nn(nc: netCDF4.Dataset) ->
|
|
121
|
+
def _get_nn(nc: netCDF4.Dataset) -> npt.NDArray[np.floating]:
|
|
87
122
|
"""Correct for changing avalanche photodiode (APD) voltage.
|
|
88
123
|
|
|
89
124
|
References:
|
|
@@ -96,7 +131,9 @@ def _get_nn(nc: netCDF4.Dataset) -> float:
|
|
|
96
131
|
nn1 = nc["NN1"][:]
|
|
97
132
|
else:
|
|
98
133
|
logging.warning("Unable to compute normalized APD: variable nn1 not found")
|
|
99
|
-
return 1
|
|
134
|
+
return np.repeat(1, len(nc["time"]))
|
|
135
|
+
if len(nn1) <= 1 or nn1[1] is ma.masked or nn1[1] == 0:
|
|
136
|
+
return np.repeat(1, len(nc["time"]))
|
|
100
137
|
median_nn1 = ma.median(nn1)
|
|
101
138
|
# Parameters taken from the MATLAB implementation of Cloudnet.
|
|
102
139
|
if 120 < median_nn1 < 160:
|
|
@@ -109,5 +146,5 @@ def _get_nn(nc: netCDF4.Dataset) -> float:
|
|
|
109
146
|
"median nn1 (%s) outside of expected range",
|
|
110
147
|
median_nn1,
|
|
111
148
|
)
|
|
112
|
-
return 1
|
|
149
|
+
return np.repeat(1, len(nc["time"]))
|
|
113
150
|
return step_factor ** (-(nn1 - reference) / scale)
|
|
@@ -17,4 +17,4 @@ def read_cl31(
|
|
|
17
17
|
raw = read_msgs(files, read_cl_file, wavelength=910.0)
|
|
18
18
|
concat = concatenate_raw(raw)
|
|
19
19
|
beta_raw = concat.beta * calibration_factor
|
|
20
|
-
return Ceilo(concat, beta_raw,
|
|
20
|
+
return Ceilo(concat, beta_raw=beta_raw, calibration_factor=calibration_factor)
|
|
@@ -17,4 +17,4 @@ def read_cl51(
|
|
|
17
17
|
raw = read_msgs(files, read_cl_file, wavelength=910.0)
|
|
18
18
|
concat = concatenate_raw(raw)
|
|
19
19
|
beta_raw = concat.beta * calibration_factor
|
|
20
|
-
return Ceilo(concat, beta_raw,
|
|
20
|
+
return Ceilo(concat, beta_raw=beta_raw, calibration_factor=calibration_factor)
|
|
@@ -23,7 +23,7 @@ def read_cl61(
|
|
|
23
23
|
raw = [_read_file(files)]
|
|
24
24
|
concat = concatenate_raw(raw)
|
|
25
25
|
beta_raw = concat.beta * calibration_factor
|
|
26
|
-
return Ceilo(concat, beta_raw,
|
|
26
|
+
return Ceilo(concat, beta_raw=beta_raw, calibration_factor=calibration_factor)
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
def _read_file(file: str | PathLike) -> CeiloRaw:
|
|
@@ -18,4 +18,4 @@ def read_cs135(
|
|
|
18
18
|
raw = read_msgs(files, read_cs_file, wavelength=905.0)
|
|
19
19
|
concat = concatenate_raw(raw)
|
|
20
20
|
beta_raw = concat.beta * calibration_factor
|
|
21
|
-
return Ceilo(concat, beta_raw,
|
|
21
|
+
return Ceilo(concat, beta_raw=beta_raw, calibration_factor=calibration_factor)
|
|
@@ -28,11 +28,19 @@ def read_ct25k(
|
|
|
28
28
|
beta_calib = concat.beta * calibration_factor
|
|
29
29
|
beta_uncorr = beta_calib / r2 if noise_h2 else _fix_beta(r2, beta_calib)
|
|
30
30
|
|
|
31
|
-
is_noise = remove_noise(
|
|
31
|
+
is_noise, beta_smooth = remove_noise(
|
|
32
|
+
concat.time, concat.range, beta_uncorr, noise_floor=6e-8
|
|
33
|
+
)
|
|
32
34
|
beta_raw = beta_uncorr * r2
|
|
33
35
|
beta = ma.masked_where(is_noise, beta_raw)
|
|
34
36
|
|
|
35
|
-
return Ceilo(
|
|
37
|
+
return Ceilo(
|
|
38
|
+
concat,
|
|
39
|
+
beta_raw=beta_raw,
|
|
40
|
+
beta=beta,
|
|
41
|
+
beta_smooth=beta_smooth,
|
|
42
|
+
calibration_factor=calibration_factor,
|
|
43
|
+
)
|
|
36
44
|
|
|
37
45
|
|
|
38
46
|
def _fix_beta(
|
|
@@ -3,6 +3,9 @@ import logging
|
|
|
3
3
|
from os import PathLike
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
|
+
from numpy import ma
|
|
7
|
+
|
|
8
|
+
from ceilopyter.utils import awful_overlap
|
|
6
9
|
|
|
7
10
|
from ..ceilo import Ceilo
|
|
8
11
|
from ..ceilo_raw import CeiloRaw, concatenate_raw
|
|
@@ -23,7 +26,7 @@ def read_ld40(
|
|
|
23
26
|
raw.append(_read_file(file))
|
|
24
27
|
concat = concatenate_raw(raw)
|
|
25
28
|
beta_raw = concat.beta * calibration_factor
|
|
26
|
-
return Ceilo(concat, beta_raw,
|
|
29
|
+
return Ceilo(concat, beta_raw=beta_raw, calibration_factor=calibration_factor)
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
def _read_file(filename: str | PathLike) -> CeiloRaw:
|
|
@@ -49,6 +52,10 @@ def _read_file(filename: str | PathLike) -> CeiloRaw:
|
|
|
49
52
|
)
|
|
50
53
|
)
|
|
51
54
|
betas.append(np.array([int(v) for v in values[2:]]))
|
|
55
|
+
res = rng[1] - rng[0]
|
|
56
|
+
rng = rng + res / 2
|
|
52
57
|
time = np.array(times)
|
|
53
|
-
|
|
58
|
+
overlap = awful_overlap(rng, 100, 200)
|
|
59
|
+
beta = np.array(betas)
|
|
60
|
+
beta = ma.divide(beta, overlap) * rng**2 * 1e-12
|
|
54
61
|
return CeiloRaw(time, rng, beta, 855)
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import math
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
import numpy.typing as npt
|
|
6
|
+
from numpy import ma
|
|
7
|
+
from numpy.lib.stride_tricks import sliding_window_view
|
|
8
|
+
from scipy.ndimage import gaussian_filter
|
|
9
|
+
|
|
10
|
+
from ceilopyter import utils
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def remove_noise(
|
|
14
|
+
time: npt.NDArray,
|
|
15
|
+
rng: npt.NDArray[np.floating],
|
|
16
|
+
beta_uncorr: npt.NDArray[np.floating],
|
|
17
|
+
noise_floor: float,
|
|
18
|
+
snr_limit: float = 5,
|
|
19
|
+
filter_above_negative: bool = False,
|
|
20
|
+
) -> tuple[npt.NDArray[np.bool_], npt.NDArray[np.floating]]:
|
|
21
|
+
n_range = len(rng)
|
|
22
|
+
zero_ranges = np.all(beta_uncorr == 0, axis=0)
|
|
23
|
+
n_zeros = np.argmax(~zero_ranges[::-1])
|
|
24
|
+
|
|
25
|
+
is_negative = beta_uncorr < 0
|
|
26
|
+
|
|
27
|
+
if filter_above_negative:
|
|
28
|
+
is_above_negative = _mask_low_values_above_consequent_negatives(beta_uncorr)
|
|
29
|
+
beta_uncorr = np.where(is_above_negative, noise_floor, beta_uncorr)
|
|
30
|
+
|
|
31
|
+
smooth, smooth_uncorr = _calc_beta_smooth(time, rng, beta_uncorr)
|
|
32
|
+
cloud_mask = _calc_cloud_mask(time, rng, beta_uncorr)
|
|
33
|
+
|
|
34
|
+
fraction = 0.1
|
|
35
|
+
n_top_gates = round(n_range * fraction)
|
|
36
|
+
beta_top = ma.masked_where(cloud_mask, smooth_uncorr)
|
|
37
|
+
beta_top = beta_top[:, n_range - n_zeros - n_top_gates : n_range - n_zeros]
|
|
38
|
+
noise = ma.std(beta_top, axis=1)
|
|
39
|
+
noise = utils.interpolate_masked(noise)
|
|
40
|
+
noise = np.maximum(noise, noise_floor)
|
|
41
|
+
snr = smooth_uncorr / noise[:, np.newaxis]
|
|
42
|
+
is_noise = snr < snr_limit
|
|
43
|
+
|
|
44
|
+
return is_noise | is_negative, smooth
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _calc_beta_smooth(
|
|
48
|
+
time: npt.NDArray[np.floating],
|
|
49
|
+
rng: npt.NDArray[np.floating],
|
|
50
|
+
beta_uncorr: npt.NDArray[np.floating],
|
|
51
|
+
) -> tuple[npt.NDArray[np.floating], npt.NDArray[np.floating]]:
|
|
52
|
+
cloud_mask, cloud_values, cloud_limit = _calc_naive_cloud_mask(beta_uncorr)
|
|
53
|
+
|
|
54
|
+
beta_uncorr = np.where(cloud_mask, cloud_limit, beta_uncorr)
|
|
55
|
+
sigma = _calc_sigma_units(time, rng)
|
|
56
|
+
smooth_uncorr = gaussian_filter(beta_uncorr, sigma)
|
|
57
|
+
smooth_uncorr[cloud_mask] = cloud_values
|
|
58
|
+
|
|
59
|
+
smooth = smooth_uncorr * (rng * 1e-3) ** 2
|
|
60
|
+
return smooth, smooth_uncorr
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _calc_sigma_units(
|
|
64
|
+
time: npt.NDArray,
|
|
65
|
+
rng: npt.NDArray[np.floating],
|
|
66
|
+
sigma_minutes: float = 1,
|
|
67
|
+
sigma_meters: float = 10,
|
|
68
|
+
) -> tuple[float, float]:
|
|
69
|
+
"""Calculates Gaussian peak std parameters.
|
|
70
|
+
|
|
71
|
+
The amount of smoothing is hard coded. This function calculates how many
|
|
72
|
+
steps in time and height corresponds to this smoothing.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
time: Time.
|
|
76
|
+
rng: Range (m).
|
|
77
|
+
sigma_minutes: Smoothing in minutes.
|
|
78
|
+
sigma_meters: Smoothing in meters.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
tuple: Two element tuple containing number of steps in time and height
|
|
82
|
+
to achieve wanted smoothing.
|
|
83
|
+
"""
|
|
84
|
+
time_step = ma.median(np.diff(time))
|
|
85
|
+
alt_step = ma.median(np.diff(rng))
|
|
86
|
+
x_std = datetime.timedelta(minutes=sigma_minutes) / time_step
|
|
87
|
+
y_std = sigma_meters / alt_step
|
|
88
|
+
return x_std, y_std
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _calc_cloud_mask(
|
|
92
|
+
time: npt.NDArray,
|
|
93
|
+
rng: npt.NDArray[np.floating],
|
|
94
|
+
beta_uncorr: npt.NDArray[np.floating],
|
|
95
|
+
) -> npt.NDArray[np.bool]:
|
|
96
|
+
"""Find clouds using mean and standard deviation.
|
|
97
|
+
|
|
98
|
+
References:
|
|
99
|
+
Kotthaus et al. (2016): Recommendations for processing atmospheric
|
|
100
|
+
attenuated backscatter profiles from Vaisala CL31 ceilometers, Atmos.
|
|
101
|
+
Meas. Tech., 9, 3769–3791, https://doi.org/10.5194/amt-9-3769-2016
|
|
102
|
+
"""
|
|
103
|
+
x_std, y_std = _calc_sigma_units(time, rng, 1, 100)
|
|
104
|
+
x_std = max(3, _ceil_odd(x_std))
|
|
105
|
+
y_std = max(3, _ceil_odd(y_std))
|
|
106
|
+
beta_uncorr_pad = np.pad(
|
|
107
|
+
beta_uncorr, ((x_std // 2, x_std // 2), (y_std // 2, y_std // 2)), "reflect"
|
|
108
|
+
)
|
|
109
|
+
windows = sliding_window_view(beta_uncorr_pad, (x_std, y_std))
|
|
110
|
+
rolling_mean = np.mean(windows, (-1, -2))
|
|
111
|
+
rolling_std = np.std(windows, (-1, -2))
|
|
112
|
+
rv = ma.divide(rolling_std, rolling_mean) ** 2
|
|
113
|
+
return rv < 1
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _calc_naive_cloud_mask(
|
|
117
|
+
beta_uncorr: npt.NDArray[np.floating],
|
|
118
|
+
) -> tuple[npt.NDArray[np.bool_], npt.NDArray[np.floating], float]:
|
|
119
|
+
"""Naively finds strong clouds from ceilometer backscatter."""
|
|
120
|
+
cloud_limit = 5e-6
|
|
121
|
+
cloud_mask = beta_uncorr > cloud_limit
|
|
122
|
+
return cloud_mask, beta_uncorr[cloud_mask], cloud_limit
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _mask_low_values_above_consequent_negatives(
|
|
126
|
+
beta_uncorr: npt.NDArray,
|
|
127
|
+
n_negatives: int = 5,
|
|
128
|
+
threshold: float = 8e-6,
|
|
129
|
+
n_skip_lowest: int = 5,
|
|
130
|
+
) -> npt.NDArray:
|
|
131
|
+
n_time, n_gates = beta_uncorr.shape
|
|
132
|
+
bottom_n_gates = n_gates // 5
|
|
133
|
+
negative_data = beta_uncorr[:, n_skip_lowest : n_skip_lowest + bottom_n_gates] < 0
|
|
134
|
+
n_consequent_negatives = utils.cumsumr(negative_data, axis=1)
|
|
135
|
+
time_indices, alt_indices = np.where(n_consequent_negatives > n_negatives)
|
|
136
|
+
alt_indices += n_skip_lowest
|
|
137
|
+
is_negative = np.zeros(beta_uncorr.shape, dtype=np.bool_)
|
|
138
|
+
for time_ind, alt_ind in zip(time_indices, alt_indices, strict=True):
|
|
139
|
+
profile = beta_uncorr[time_ind, alt_ind:]
|
|
140
|
+
is_negative[time_ind, alt_ind:][profile < threshold] = True
|
|
141
|
+
return is_negative
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _ceil_odd(x):
|
|
145
|
+
return math.ceil(x) | 1
|
|
@@ -7,7 +7,10 @@ from pathlib import Path
|
|
|
7
7
|
from .. import utils
|
|
8
8
|
from ..common import InvalidMessageError, Message, Status
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
FORMATS = [
|
|
11
|
+
utils.date_format_to_regex(rb"-?%Y-%m-%d %H:%M:%S\r?\n"),
|
|
12
|
+
utils.date_format_to_regex(rb"%Y-%m-%d %H:%M:%S,"),
|
|
13
|
+
]
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
class ClStatus(Status):
|
|
@@ -103,12 +106,13 @@ def read_cl_file(
|
|
|
103
106
|
content = Path(filename).read_bytes()
|
|
104
107
|
time = []
|
|
105
108
|
data = []
|
|
106
|
-
for
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
for fmt in FORMATS:
|
|
110
|
+
for ts, msg in utils.parse_file(content, fmt):
|
|
111
|
+
try:
|
|
112
|
+
data.append(read_cl_message(msg))
|
|
113
|
+
time.append(ts)
|
|
114
|
+
except (InvalidMessageError, ValueError) as e:
|
|
115
|
+
logging.debug("Invalid message: %s", e)
|
|
112
116
|
return time, data
|
|
113
117
|
|
|
114
118
|
|
|
@@ -127,7 +131,7 @@ def read_cl_message(message: bytes) -> ClMessage:
|
|
|
127
131
|
raise InvalidMessageError(msg)
|
|
128
132
|
subclass = line1[7:8]
|
|
129
133
|
if subclass in (b"1", b"2", b"3", b"4"):
|
|
130
|
-
line3_len =
|
|
134
|
+
line3_len = 35 # CL31
|
|
131
135
|
elif subclass == b"6":
|
|
132
136
|
line3_len = 40 # CL51
|
|
133
137
|
else:
|
|
@@ -5,6 +5,7 @@ from collections.abc import Iterator
|
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import numpy.typing as npt
|
|
8
|
+
from numpy import ma
|
|
8
9
|
|
|
9
10
|
from ceilopyter.common import InvalidMessageError
|
|
10
11
|
|
|
@@ -88,3 +89,53 @@ def next_line(
|
|
|
88
89
|
msg = f"Expected {length} characters but got {len(line)} instead"
|
|
89
90
|
raise InvalidMessageError(msg)
|
|
90
91
|
return line
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def cumsumr(array: npt.NDArray, axis: int = 0) -> npt.NDArray:
|
|
95
|
+
"""Finds cumulative sum that resets on 0.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
array: Input array.
|
|
99
|
+
axis: Axis where the sum is calculated. Default is 0.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
Cumulative sum, restarted at 0.
|
|
103
|
+
|
|
104
|
+
Examples:
|
|
105
|
+
>>> x = np.array([0, 0, 1, 1, 0, 0, 0, 1, 1, 1])
|
|
106
|
+
>>> cumsumr(x)
|
|
107
|
+
[0, 0, 1, 2, 0, 0, 0, 1, 2, 3]
|
|
108
|
+
|
|
109
|
+
"""
|
|
110
|
+
cums = array.cumsum(axis=axis)
|
|
111
|
+
return cums - np.maximum.accumulate(cums * (array == 0), axis=axis)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def interpolate_masked(array: npt.NDArray) -> npt.NDArray:
|
|
115
|
+
out = ma.copy(array)
|
|
116
|
+
m = ma.getmaskarray(array)
|
|
117
|
+
if np.all(m):
|
|
118
|
+
return out
|
|
119
|
+
d = np.diff(np.pad(m.astype(np.int8), 1))
|
|
120
|
+
start = np.nonzero(d == 1)[0]
|
|
121
|
+
end = np.nonzero(d == -1)[0]
|
|
122
|
+
for a, b in zip(start, end, strict=True):
|
|
123
|
+
if a == 0:
|
|
124
|
+
out[: b + 1] = out[b]
|
|
125
|
+
elif b == len(array):
|
|
126
|
+
out[a - 1 :] = out[a - 1]
|
|
127
|
+
else:
|
|
128
|
+
out[a - 1 : b + 1] = np.linspace(out[a - 1], out[b], b - a + 2)
|
|
129
|
+
return out
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def awful_overlap(
|
|
133
|
+
rng: npt.NDArray[np.floating], rng_zero: float, rng_one: float
|
|
134
|
+
) -> npt.NDArray[np.floating]:
|
|
135
|
+
n = len(rng)
|
|
136
|
+
i = np.nonzero(rng > rng_zero)[0][0]
|
|
137
|
+
j = np.nonzero(rng > rng_one)[0][0]
|
|
138
|
+
zero = np.zeros(i)
|
|
139
|
+
mids = np.linspace(0, 1, j - i)
|
|
140
|
+
ones = np.ones(n - j)
|
|
141
|
+
return np.concatenate([zero, mids, ones])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.2"
|
|
@@ -18,12 +18,15 @@ classifiers = [
|
|
|
18
18
|
"Programming Language :: Python :: 3",
|
|
19
19
|
"Topic :: Scientific/Engineering :: Atmospheric Science",
|
|
20
20
|
]
|
|
21
|
-
dependencies = ["netCDF4", "numpy"]
|
|
21
|
+
dependencies = ["cloudnet-api-client", "matplotlib", "netCDF4", "numpy", "scipy"]
|
|
22
22
|
dynamic = ["version"]
|
|
23
23
|
|
|
24
24
|
[project.optional-dependencies]
|
|
25
25
|
test = ["mypy", "pytest"]
|
|
26
|
-
dev = ["pre-commit", "release-version"]
|
|
26
|
+
dev = ["pre-commit", "release-version", "scipy-stubs"]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
ceilopyter = "ceilopyter.cli:main"
|
|
27
30
|
|
|
28
31
|
[project.urls]
|
|
29
32
|
Homepage = "https://github.com/actris-cloudnet/ceilopyter"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
2025-02-02 00:00:03,CL018121
|
|
2
|
+
1W 00440 ///// ///// 00008004C080
|
|
3
|
+
8 037 0 /// 0 /// 0 /// 0 ///
|
|
4
|
+
00100 10 0770 100 +26 039 01 0003 L0016HN15 178
|
|
5
|
+
0035b0029f0035d003a3003e500438004a40049b004d2004d6004ae00472004430041c003f9003e0003fd00439004630045e00419003a0003430032c0031f00306002f400343007cb017360262601ffe00f8d00861007b20058200294001ac004b2010ab0261d039520425c04164038d202d21021c20178d00f1e00987005fc0036e001ac000b5000610003a000210001a00006ffff1ffff70001b00000fffe7fffdf00007ffffdfffd4fffe6ffffbfffefffff7ffff3fffeaffff1ffff4fffe8ffff9ffffcffff6fffecfffe8fffb0fffde00028000230000a0000ffffe5fffcbfffeb0001f00020ffffefffbfffff1fffe6fffb8fffcffffcffff8bfff72fffa1fffe40001900030fffe0fff9dfff7bfffa3fffd6fffd0fffa2fffcffff98fffb7ffff90000ffffccfffc9ffff2fffb1fff72fffc1ffffafffc8fff84fffa7fff8efffb5fffa0fffb0fffa1fff87000090000cfff84fffc80000cfff55fff9afffa3fff89fff78fff9600014fffa8fffb0fff7dfff48fff78fffbffffe4ffff8fff8dfff91fff64fff7dfffc5fffb2fff94fff25fff81fffd6fff62fff86fffc3ffff3fff88fff21fffa3fffc4fff9efffac0000c0000cfffa2ffeb6ffee1fff1bffff4fffb90002bfffaafffe5fffd9ffff2fffd5ffed9ffed5fff89fff7cfff9efffa0fff08fff96fff6efffcffffd300037fffbdfff22ffeca0001700031ffeb9ffe70fff12000b4fffcfffe20fff4900015fff17fff0f00037000fafffb0ffdb4ffe59fff370009afffe3ffe94ffe2affdf9fffb1000f00007e0007c00023fffe0fff67ffe96ffef3ffe6efff6e00041ffedc0003100036fff7fffe34ffe71fff39ffe78ffe5bfff7afff9efff77fffc9ffe8ffff27fff7bfff15fffb6fffe600056fff43ffea5ffe98ffefefff88ffeee0000300154fff98ffe8efffbf0001cffeabffda5ffef4fff8ffffc7fff69fff97ffe85ffe9d000b50016f00033ffe7dfff13ffef8ffe00ffeae000690000cfff57fff90fff08fff7e0000dffe2cffde1ffdf9fff6efffc5fff8cffea5000130023400045ffedbfff91fff27ffefeffeb9ffffc0016cffe5cffdaffffc5fff66ffed40008d00032fff59000c1001530010600027ffcefffe130003cfffe8fffa6ffe7bffe4fffd8dfff7d001350012dffd9affe1bffdcbfff170001ffffeeffffbfff71ffdeb001dcffe8cffeb7ffec8ffec90015300163fff7f0003dfff48ffef4ffd60ffef8000c400495000bdffdbeffdb6fff0bffec3ffe7dffdc3fffadffff7ffe11ffe8a00079ffd53fff38000b9fff1cfff99000df002020012d0004f00001ffef5ffebfffe3efffe3fff68fff1effe2bffde9000b8ffff100074ffe9ffff3300061002ecfff3affce0ffe60ffd5effef0ffff2000800017a00429fffeafff5cfffc0ffd50ffe21ffebbffe4fffd7ffffb0ffd54ffef500028000c6ffe7e000aa0015efffd1000f4ffed3ffe25ffe30ffd26ffc91ffde80012ffff1600024ffcb9ffc7effcc10019e001a1ffe9d000fa00068ffe07fff17ffd9bffe08002090009efffafffe5afff9dfff0dffdc4ffee5ffc2effe4800077ffc35ffca7001c3000e900054001ccffc45ffb4fffe0ffff1affcfaffee3fffe6ffb5bffbf90005f0008dffb2cffd29ffd19ffef9003cf000e2fffeefff06ffee1fffbb00029fff4e0025affd24ffda4fff0affe9d002f1001e1ffd4eff901ffa77ffec4001d40045000198ffdc7fff220000affde0fff75ffcadffcb0ffe2dffe96fff5affc7effd6bffdf1fffbaffd03002eb00413ffd71ffbe6ffbc6ffe3c000c6ffe45ffd7cfff50ffe58fff81ffe82ffcb80015f0020200456000c6ffac2ff842ffb4cfff09ffda6ffc2ffff0e001c2ffd2cffb47fffe900177ffe64ffd3800139fffbaff91eff885ffc0900116000ccffb44ffd2cffdc6fffacfffbdffc6dff6f8ffc07ffd3fffef1ffebeffbca003d400148003a4002efffc1eff98fffeeffff25ff8adffc8f003290034afff620022fffbc1ffa94ff9feffff7ffd0bffda8ff8f0ffb41ffc22001620020500231ffb1eff95fffe5c00000ffde5ffeb0ff96800007ffefdffa5fffd2effd2d003a800346000e6000eaffcc2ffb08ff8beff9f0fff0e00403fff4bffc82ffebf0027700356fff6affcae0009d002e1001320007afffb7ffdc2ffb44ffd5bffd86ffb68ffc30000afffd39000e2005cfffc0000011fff5fffc36ffb9cffd18ffe6500146001cf001caffcdcffcf4001b6004c600170ffec8ffcfcfff1fff8e9ffa3ffff6e002f5007c3fff26ffe2cfffd7ffc04ffd670004affdaf00296ffdc7fffc1ff878ffd850008dfffc7ffc48fff13002d8ffb50ffb8dffb39ffc28ffd3a002dbffd12ffd2800195007ff003e0003210048e0058c003ceffa52ffbf5ffb45002dc003d0000f5ffdf3ff81dffe0c0015e00678ffd18ffb5b004c6004fd0078effa91ffa22ffe840036f00032ffc27ffe47ff89d0016e0019c00d2900a53ffde7ff615ff3da0017200016ffaf4ffbd7ff874ffcd80035ffff38003d1008d4004b3ff771004d8008b40066b00ae40050eff7dc003f50033d0020300647ffe31fffa9004eb007a7004d5ff9b1ffbfc004e70020500108ffd96000d30075700a2d00829ffe6dff9e1ffb09ffd220088e0036200459005e100ad5ffec3ffa7bffdc00046100b54
|
|
6
|
+
c262
|
|
7
|
+
|
|
8
|
+
2025-02-02 00:00:18,CL018121
|
|
9
|
+
1W 00400 ///// ///// 00000004C080
|
|
10
|
+
8 037 0 /// 0 /// 0 /// 0 ///
|
|
11
|
+
00100 10 0770 099 +26 039 01 0003 L0016HN15 165
|
|
12
|
+
003a2002ab00335003460035f00399003f0003f50043500431003ef0038e00337002f8002cd002b4002b6002bf002cb002d3002e0002fb00305002de002a50027900267002890044c00aa7016a40241802906022d2018d2010e100c0100b8b011f8021b80324c0352802cc50234301bf00160f0105300abf0064c004130035100286001c20017c0018a0018300142000c2000440000fffff50000500000ffff0ffff900007ffff8ffffbfffedfffe3fffe6fffdafffbdfffadfffd7fffecffff7fffffffff2fffcafffd3ffffcffff4fffd3fffedffff7000120004d000310003a0001800000fffdeffffafffd70001c00022fffddfffc2fffc200004ffffdfffc4fffabfff99fffa1fffb2fff9efffb8fffe400008fff99fff74fffd1fffd7fffc5fffe1fffc3fff90fff69fff88fffe3fffd6fffbefffce0000cfffeafffa7fff93fffd5fffc0fffd1fff68fffae00000fffc3fff1ffff81fffaffff57fff61fffd7fffc5fff5dfff52fff50fff9ffffb3fff9afff9afff98fff3bfff32fff9e00018fff5ffffa8fffe0fff8afffe4fff8bfffc0fffddffff300071fff74ffea3fff08fffeefff28fff18fff79fffd50001efffecfff1bffeebfff16fff9a0006ffff9cfff43fff10ffff300010fff6efffa100038ffeb3ffee3fffcafff71ffffbfffadfff10fff47fffe1fffc2ffef5fff57fff3efff49fff47fff43fff7efffa9fffd1fff37fff9bffea10003200193fffa5ffebbffefbfff60ffe7effec3ffef1fff7000089fff9cffe32ffe23fff87000f3fffadfffe400056fffc500049000dafff8cffe3fffeaffff11000480014ffffdd00010fff64ffe4dffe05fff3f00008ffee2ffea5ffecffff4effff2fff9dffeddfffb600052fff09fff39fffd6fffe6fff9bffe9effecffffcdfff48fff54fffae00115ffffdffeacffe62fffb3ffee8ffd9bfff80fffedfffb3fff450008fffeccffe03ffebbfff4fffff1fffae00023fff93ffdfaffeb7fff6bfffa5000790010efffe2ffe9cfffe6fffabffec0ffef1fff6afffbcffe77ffe4ffffac001640009fffde7ffe3efff770008cfff74ffeabffedbffe43fffa3000b100077fff830005afff13ffe5effff00014b000c0ffe79ffd90ffe9afff5400019001b1fff1effebcfffb2fff83000900001efff4afff13ffdbe000c4000ff000070003200014ffd13ffee3ffe71fffad0012bfff1dfff21ffef8ffeab0007800061fff0affd08ffef10022f0037600225ffead00069fffccfffa4ffd9effcf8ffe9fffefaffdddfff8ffffaaffbd3ffc1d000b3fffdcffd78ffecc001320000dfff7000030ffdf1ffe92fff2800016fff77fff5dfff3efff180005e0000900069fff2bffff6ffc75ffec7ffe12ffe79fffb6ffe1affe20ffeebffe04fff80002c9fffb2ffef2ffe3effe19000bd0028900170fff77ffca7ffd26000d8ffe65ffd8fffec7fffe300086ffcf4ffb41ffc3d0004d002d60015d00053ffec900038ffbacffd04ffd3bffd34ffcfcfff8effea4000d600190fffc0ffef6ffd8dffb86ffdb90016dffe31fffe2ffdf8ffdeffff70001b5002abffef8ffe8600077ffd57ffc060006a001d8001b0fffdbfff6effba7ffa4affc58ffea3fff0100035ffdd8ffd77ffde3ffcc5ffc08ffff0ffe8fffdd70015dffe79fff0dfff30ffe8b00046001fffffacfff9dff975ffd35001a10025b0005dffdebffc3fff9d0ffea40017cffffdfff390022e0012900221ffef8ffbf5ffdf2ffa9dffd22000f000065ffbdeff94c00019ffdf4000c6fff67fff7500114ffd27ffe78fffb00002a00069ffa98ffa73ffd7cffce6000ec000eafff79000dffff950031e001b6ffb18ff7c0ff843ffbc00020bfffb9ffbfdffcb0ffdc4ffdc2ffede00191ffb63ffa26ffb16ffd6dffe05ffde4ffe830016f0025effc20ffabcff8c5ffdae0002fffac4ff704ffe5700198ffeaaffe47ffaeeffd8a0034e0037100101ffc77ffcebffbe5fff94ffdc2ffc3cffc95ffc6bffdee005210003cff94effbf3fffac00324002f9fff61fffd6ffa18ff6fcffe8c0050000203ffc7c0004fffe57ffba9ffdbbffa2b0032c006ce00215ff8abff3f2ff8240003f005860012dffd91ffe81ffde9ffb4a002c6001aeffc07ffbf600039000f50029100139ffd28ffb2fffba0fffa10000b0009d005abfff94ffb5aff96affbc6ffd7f00374000e2ffdb1ffd3fffb02ffdcb001a0002740029f0043fffe840005affe040009c0001affd8d006a8004f60018dffab0ffb36ffdd9ffefb0006cfff96002c1000c9ffc4affa08ffdc70019e001f3ffeddffb510010effc74ffc3cffe380005dffede0038500107ffb1cff8ceff51effe45fffa9ffa42ff504ff836ffa6cffd1bffffd0011b003e8001000041b001deffd11ff4a6ffd53000ccffff500097003bc000efffb7dffce7003af00436ffc4bffccb0064c0021300543006c8fffd900384004a1002df000d8ffca2ff75900411002690080b0047f000c8003feffa68ffd2100246ffab8ff7ea002db003a9ffa8fffc3a003fc00262003b900681002610028d0041200c8c002aefffeb0082e0065100bfe00d6600c83ffe0cff999003e100fc900582fff85ffbf2ff675ffc3bffd6a001a200afa00576005d1ffec4ffffa004340068e00dc0ffd7f00326007d700a52ffbb1ff6a2ff9a2009da00194
|
|
13
|
+
337f
|
|
14
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
CL120521
|
|
2
|
+
10 00080 ///// ///// 00000000C080
|
|
3
|
+
8 008 0 /// 0 /// 0 /// 0 ///
|
|
4
|
+
00100 10 0770 101 +30 100 11 0008 L0016HN15 223
|
|
5
|
+
001f800d6501dd10448a07b5d0a1da0a76807dbd0554d032a301bd200e4d006d50031100150000900003a000120000d00002ffffcfffeffffe4ffff4ffffafffe7fffebffff2fffdefffc3fffcafffc7fffbcfffb3fffacfffb5fffc9fffc1fffb4fff94fffcafffd3fffbffff8cfff4dfff8dfffcafff52fff45fff86fffc0fffecffffcfffc3fffa8fff8efff8cfffa7fff8cfff8efff64fff82fff61fff7dfff86fff42fff3efff54fff43fff58fff46fff32ffefbfff65fff6cfff9afff72fff82fffcafffacfffa5fffbafff99fff7ffffb1ffff7fffb6fff86fffb4fffd5fffbdfff80fff2cfff5afff70fff85fffd0fff85fffa4fff86fff8ffff92fffa0fffa4fffa0fffacfffa6fffe0fffa4fff9efff9fffff30002cffff9fffaaffff10003300000fff98fff9cfffaffff9bfffb8fffcffffbefffc1fffbffffb5fffbafffe7ffff1fffd3ffff3fffdffffb6fff96fffcafffb4fffe5fffd2fffabfffbcffff9fffe7fff95fff7afff82fffd000024fffeffff57fff8bfffc4fffeefffd7fffcdfff9cfffbd0002f0005000006fffa3fffddffff1fffe9fffcdfff6cfff02fff1cfff5dfff80fff6ffffbcfffe9fffcefffa3fffc9fff9ffff7efffccfffd9fffe4fff92fff8ffffdc0001500004fffe8fffb1fff7efff9cfff80fff8bfffe1fffbcfff98fffb5fffaeffff300008fffaffffb4ffff6fffd1fff9afff9efff5bfff93fffa3fffcc0000dfffd60000e0003a0002bfffd8fffacfffe4fffc9fff9afffc7fffe6fff8dfff67ffffcfffb1fff7efff7bfff9bfffb90003ffffd3fff71fff9bfff4bfff62000010003800028fffd0fff59fff5afff9ffffc0fff9efff9efffccfffcbfffebfffaefff75fff80ffff8fffecfffbefff5efff87fffb1fffa0fff9afff9effff0fffb5fffa7fffbefff9fffff4ffff4fffe60003cfffadfff72fff810000efffc9fffb0fff61fff9700088fffdcfffaafffd1fff440001200019fffacfff92fff9efff6bfff9dfffaa0005cfffd3fffd2fffe6fff44fff5c0000e00063ffffffffb6fffe3fffc1fff75fff9efffb6fff7dffffaffff6ffff6fffbcfffc8ffed6fffa60002e0002afffec00019fffd400016ffff1fffd6fffc3fff5bfff7000023fffc7fff16fff57fffbffff2efff78fff7b0002900047ffef0fff4dfffeefffd1fffa0fffcc0008ffffcbfffc5ffeeafffcbfff9afff34fff69fff62fff78fff96fffb7fff60fff7efffb0fff2ffffc3fff44fffb3fff56fffe9fffb2fff73fff62fffa2fffedfff95fff7afffaffff6bfff5cfff9e0004fffec1fff24fff71fffed00069ffff9fff59fff0bfff36ffee1ffff2fffc6fff3c00002000680005cffffefff9cfff20ffe9f0005d00025fffe4fffeefff7dfffdb00038fffc9fff5500023000edfffee0002ffff4effe8ffff09000380002800087fff9afffa8ffeb3ffff80003cfffd6fffcdffed2fff5cfffe9ffecffff8cffffcfffcfffefffff35fff9cfff7e00077000e7fffba0008900092fff96ffea1ffeaefff5effff1fff79fff13fff2800010fffaafffc200018fff0bfff0fffedbfff61fff4afff8effdc7ffee90002efff9afff4d00032fff20fff5a000fb00035fffbd00022fffc3fff0affef0fff6b000cf00065ffffcfffed0008bfff3c0000a0000efff4bffecbfffa60011100073fff76fff5a0005200087ffff8fffe00001ffff83fff94ffeb5fffd70004dffe3dffedd00093fffcdfffb4fff78fffc2fff3e00147fffb4fff4d00066fff92ffed300037fffa1fff3dfffc1ffebefff05000a400037ffec0fff70001a9000d7000c600187000dd00000fff4cffee1fff38ffeabfff8cfff790012400177ffffd000f30001cffe81ffe8d0002cffe62ffe31fff4b0003c000abfffedfff6300087000c7ffecafff69fff56ffe77ffdd4fffc80014a000e900011fffe50007fffeb9ffe92000affff50ffe41fff94fff6e00021ffe8cfff20fff82fff4affeb8ffef5000460011cfffc0fff13fff5b0018400082ffef4fff3cffe93ffeaffff62fffcbffd1bfffcc0005e000e1fffaeffe0000078000bcfffce000a4fff6dfffe00003b000fb000470003effeaf00078fffc7fff58000780018b00073ffe91000340015b0000a001420002000053000dd0010b000a6ffe62fff0ffffd20003700044fff79ffe86000fb002e00014100021000a10000f0013f000fe00081fff3c001c00020500142001210014c000bd00080fff220005bfff6bfff5f000820001e0001dffe54ffe11fff8affd94ffd21000b900173000e2000f9fff6f001800017d002720027300099fff4a0011a0002f0009dfffc10008c00141000b0ffe43ffd64ffef900063001faffe89fff09000aa0024900058fffd700195ffffcfffc5ffe21ffda1ffd94ffdc4ffdfd0012c00154002560036c00037fff9300105fffeeffe5e000cf0008000262000d50005d00000fff26ffeab00006001c6002040005000024fffa9fff9dffe3efff9c002080029cfffef0027d000c6ffd40fff570013a000eb0002afffcdfffe80000fffefeffe1bffea4002320014e001730007d000ae002aa0021a001da0001700292fff670003efff35ffecb0021600215001df001e2001f70015d0006e00042ffed9fff2f0024a00391001aa0007d003c100011ffe6500079ffe940016e001d5fff64
|
|
6
|
+
c0ae
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
CL020123
|
|
2
|
+
00 ///// ///// ///// 000000000080
|
|
3
|
+
-1 /// 0 /// 0 /// 0 /// 0 ///
|
|
4
|
+
00100 05 1500 099 +26 100 11 0002 L0016HN30 013
|
|
5
|
+
000a000087000840008300084000850008500085000a9000a10009200088000840007c00078000790007c0007e0007e0007f00080000800007f0007e0007d0007c0007c0007b0007a000790007800077000750007700075000740007500076000770007800077000790007800075000760007a0007800075000700007100074000790007d000790007800077000770007c0007b00077000760007b0007b00078000750006e000680006700072000750007c0007a000780006f0006600068000670006d00074000730006d000610005a0005b0005c00072000700007b000690006d0006300068000730006d0007a000660006d0006500068000710007d000780007d00069000640005d0005e0006400069000670006c00067000460003c000490004e0005500049000590006800060000550005d0006d0007a0007900075000730007e00081000730005d0005600069000730006b00067000740006b000880008800087000720005a0006000059000840009e000a00007a0005700029000440006500097000950008d000a1000ab0008300060000470002c00050000670006f000660008e000be000a400091000530002c0002c0006c000a6000de000ee000a30005d0004d00059000560004c0001d00016ffffd0004d00058000750008700062000600007b0005a0007a0004b0008e00055000630006d0008a000b8000a4000630001b00001ffff300011000570008b000c2000b3000c9000cd000c8000d300059000100002b0001000016000380006c00070000430003200025000360002200075000500006400062000910009a0008f0008a000910008e0001200004000120000b000340005b0007a00096000ab000be000710003800010000570002b0001cffff30002b0005e0009600068000850003e0002700035000430006100068000740007e000d7000c20003500002fffba000300002e0008300090000590004c0006c000730004b00008000140004f0008300027fffe00001300076000a6000a6000b20008200063000540002d0001e000610001cffff7000320004c0003e00045000490006a00077000880007000079000ca000be0007400060000a3000c7000e5000b10006300056000570003700029fffe800023fffebffffb0002000082000420006800037ffffcfff99fffb4ffff600061000ef000b8000a60000dffff2fffadfffba0000b0001c0003d0003c00034fffed0002600021fffe1fffdafffb9fff8b000010006200030fffbffff6ffff8afffdaffff2fffd8fffe6000000003600014fff91fffcafff7efff7efffa3fffd20001f0001d0005f000560001100012fffe6fffbdfff70fff8bfffde00032000660002efffb5ffff30007a000ee000e7000470000bfffeefff95fff9dfffdefff80fffb5fffabfffbcfff89fff51fff55fff7ffffcdfffff0002c000010002d0004300051000000004800012000190007b00087000ba000a90008f00011fffbdfffa9fffe500001fffe4fffaefffdb000750009e0006f0008900044ffff9fffc6fff75fffa60000d0003efffd0fff65fff720002e0006300076000aa0007f00070000480006c0004d000920006b0004ffffecfffc1fffa8fffe40000500086001290014a0009a00031fff92fff30fff4dfff2afffe1ffffa0007c000d600093fffb2fff87fff9bfffe60004b0000cfffa4fffc8fffca000170003a00088000930006300011ffff5fffe60002dffffefffdb000230003e000a10004200055000890004300007000500007400042fffe6fffc4fffdffffb3fffbefffc500024ffff7fff96ffff100013fffb2fffd1fffd10005200049000900001efffeefffbdfff70fffe9ffff500002fffd3fffcb0000200067000ae000470003f00027fffeffffd1fffe4fffd60001a0005f00003fffd2fffb7fffd30000c0005100001fffcfffff0fffedfffedfffdbfffb2fffadfffa0fffa3fffb2fff3ffff76fff53fffd5fffa5fffeb0006c000730007f0001a0000efffdc00020ffff5fffc9fffbaffff6fffbcfffa5fffa9fffc0fffe10000f0000d0005f000d0000f70006afff8cfff5bfff5dfffb5fffed0000e00006000af00041fffe5fffa8fffacfffbffffc9fffb0fffc80002a000ac0010c000a6fffe30003afffaaffff9ffffafffe7fffccffff8fffc8ffff8fffef00002fffec00035000330001000029000190003a00091000a800039fff8afff9efff9efffe30006a00067fffdcfff79fffc1fffbffff9dfffe8ffff900008fffe5fff9cfff52000000001cfff90fffe50007100060000b6000a00007600007fffc1fffb400031000370002afffedfffcd000350001bfffe1fff8afffbdfff7dfff8a0001e0004b00023ffff4000210001d00071000200007700041fffe1fffd900019fffd3fffdeffff00004c00000fffd7fffd6ffff0000140009a0007d00021ffff0000130003300013ffff50001dfffe20000f0002c00024ffffefffc1ffffe0002600049000b60005f0009500002fffd5fff8bfff93fffa30002800091000a50003400025fffaafffc2fff58000120006d0005700021fffabfffbc0003e00032ffff3fffcafff85fff780000c00019fffb8fff91fffe2fffee00021fffebfffff00065000820007dfffcdfffacfffcdfff710000a0006700095000490003f0003900058000640000200001fffc0ffffd0000e0003b0003c00021fffd9fff87fffe200049000e100114000db0002500000fffbafffeb00020fffc1fffad00031ffffbfffd3fff67fff9800000000780006affff700025000730006e0008c000ae000f50006a00018fffb0fffcffffe70004c0000100012fff7bfff8e00023000a10006b000b40003600015fffea00014ffffffffcd00017000070004f00044000270000afffaefffbafffe70001e0007b00071fffd4fffbefffa9fffd400028000500006d000610003fffff1fffbd000150003a00018fff82ffffc00038000b50009b0005afffd3fff88fff7200041000af000b8000cd0000affff4fffcdfff70fffe6fffc8fff95fffbd00000fffbefffb8fffa7fffdd000380000dffff20003100060000a4000410005efffeffff69fff33fff86fffc8fffe1ffffbfffd6fffa1fff8efffe6fffa8fff6efffc800049000d9000f6000c0000390009c00087000770003efffff00013fffd7fffd3fffe6fff79fffc7fffac00011fffef0000bfffe5fffe1ffff9ffff5fffdf0000c0003800035fffc9fff64fffb0fffc7000320005e0004000003fffa0fff74fff54fffb7000090003600048000600002800007ffff2000140001d00088000880002f000240005900029fffdafff6afffdeffffeffff0fffdc0000d0003e0002bfffd8000350006a0005500013fffb0fff21fff3ffffa00002d00057fffedfffc1ffff8fffd1ffff90000e0003200074000680003000003fffa7fffcbfffebfffb7fff54ffef7ffeb0ffef4fffb1000060008700034fffcefffd1fffd500039000760009b000630002bfffbffff63fff82fff7d00017000480002b0002f000620003e000220002600025fff91fff9bfffbbffffe0003b00020fffb0fff08ffec9ffee2fffc5fffe4fffe1fffc3fffbafffb0fffcafffadffffe0002c00025fff66fff71fff32fff4afff76fff7dfffd9fffa8000150004b000ab000a8000ad00092000970002b00048fffb8fffc9fffd20001200035000860002dfffbafff61fff92fffc50001b000670005c00093000030000dfffd3ffff4000110002900006fffdbfffd6fff96fffe4000880002c0004a0001b0000000016fffe0ffff600026000a80007afff97fff7efffbd00006fffe5fffeafffadfff97fff9cfffdefffaffffd5fffaefff4efff75000160007000040fffe7fff5bfff88fff980001900049fff81fffb6fffca0001a0001e0009e0008c0009700042fffd40001dfffd7fff5bfff660001b000b4000b900070fffc3fffcdfffb9fffdb0008700084000650002ffffecffffdfffda0002100070000aa0005a00031ffffefffca00035000360004e000500002b00034fffacfffa4000040006200040fffa5fff86fff62fff4cfff9cfffc7fffe8ffffd0006d0002c00042fffc1fffd2fffc6fffeb000750007a0005e00050ffffdffff70000000039000380007f0007a00064fffe00002dffffd00051fffe600011fffe4fffe9fff89fff4efff7bfff4afffa60000c00034fffc6fffdbfffd4fffc1fffe6fff8ffff970002a0007e000730006900023ffff10000400038000750001b00011fffe20002ffffe6fffe3000350002b00044fffbdfff8ffffd20005d0009a0007900006fff92fff6ffff4dfffb4fffb4ffffc000220002ffffdbfff82fff09fff62fff82fffa2fff8efffd100004fffbafffc1ffffc0001d000100002dfffcf0000afffcafffc6fffeffffdf0002fffffdfffe8000620000d0001cfffcafffaefffa2ffff80003b0003d00025fff73fff77fffc7fffe800036fffe1fffadfff6dfff78fffa1fff9cfff8cfffdc0000fffff5000330006d00044fffe6fff99fff80fffd5fffd90004f0005f0006a000f1000a80009f00010fff76fffbbfffe900048000300006b0002c0008e000c8000b400063fffe8fff72fff57fff70fff5efff9dfffb5fffc1fffc8fffcffff9bfffb0fff8f000ba000e7000da0004400051000430001efffdcffff0fff97fff82fff7cfff90000270005f0005500043fffc5fffdafffb4fff98fff88fffdd000350003d00012000570003f0001200010fffd7fffbbfffe1fff8efffc60003b0004e00013000260002e000680008f0007d0001d0001900002fffe3fffcafffbdfffb6fffcbfffdcfff84fffab0000efffe2fffb1fffd2fffdcfffe200031fffe1ffff9ffffbfff9afffcbfffbffffd4ffffd0004800043000650005f00068000360000d0003c0004d00059fffd3fff9bfffbcfffb2fff89fffe1fffc60002900073000820004e00088000b50006a0004a00023000340001e00085000670005100032fffbdfff8bfffbe00010000480006b0005f000730006e0005d0003bfffdbfffbffffe7fffcefffbdfff91fff52fff68fffbbfffdefffacfffd5fffacfffa8fffd2fffb6fff4cfff55fff62fff9e000050006300004fffc6fff49fff0dfff60fffa0fffa4fff88fff6d000000004c00062fffc7fff8ffff10fff87fff82fff51fff85ffff7000960006900023fffb1fffcb0002c00065000c00006c0006500058
|
|
6
|
+
1bd6
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
CL120221
|
|
2
|
+
00 ///// ///// ///// 000000000080
|
|
3
|
+
0 /// 0 /// 0 /// 0 /// 0 ///
|
|
4
|
+
00100 10 0770 103 +24 100 14 0003 L0016HN15 003
|
|
5
|
+
000ff0002d000200002000032000270001e0001b0001a000190001800018000190001900017000170001800018000170001600016000160001700017000150001800018000170001d0001a00018000180000e000100001400014000120000c0001100016000170000f000110001c000150001800018000080000b00014000110000c00001000050000e0001600024000180000e00001000020000b0000c00000000120000cffffb0001e0001b0001b000170001b000250000c00004000110000b0000d0001200020ffff3fffee0001a0000700009fffec0000a00017000290001f0002b0003200013000250000b0002d0002a0002c0001800024000350002a000210002f000390002c00007000390001500026ffffa0002700046ffffa0004f000410003a00030000490004b000280001f0002e0003efffd60001d000280004f00035000210002e00053fffe5fffc80000f00005fffddfff7cfffda0006600060fffcf000030001b00078fffd2fffebfffd20002c00038000200004a0006a0003bfffb4fffab0001ffffd2fffd00004e00062000230004100077000610002ffffea0000dffff000049fffa50001afffdcfff51fff4800012000530001efffa8fff50fffaf0004efffcd0005e00051fff5bfff4affff2fffb900006000740001500009ffffaffffcffffb0005500023000410007300084ffffdfff4e000240004d00024fff99fff820000bfffe1000cb000380008b0006d000810004bfffff0005bfffb60000500028fffb9fff7f000e50002afffcbfffb9000aa000bd00099fff71fff8d0007e000aefff9f00076000f50000ffffaf0003f0002bfffd4fff8d0004300036fff85fffa2fff9efff8d00083fffdbfffc8fff80fff9dfff88fff1afffaffff72fff4a0002e000fdfff32ffe91000ae0004d00049fffca0004000024fff6affebffff310007d0007a00028fffd90003efffccfffd7fff68fffc2fffa500065fff61fff990002a0008800059fff1afff7100043fffd8fffcf0008cffefcffeeafffb6fffd7000f700072000b5fffe2ffff5fff70fff6cfff75fffc6fffd500024fff72000dffff79fff5cfff32fffa6fffcbffff4ffea6fff8200078fffecfffdbfffbcfff56ffef0fff050001c00012000410009e00014fff890001200109ffed0fff12000c00000b000df00145000c10008f000a300097000f1ffe25ffe8bfff5c000190000800062000ac000fffffeeffc79000ef0023b0007bfffdc000cb00037000ddfffe6fff47fff33ffe8effecb0007c00080000600012e00074fff1bfff71fff9ffffbd00246001d2fff5cfff4c00191000e10000efffc100015fff77ffe84000c6fff42fffd30004e00091000b6fff71fff1fffffc00034fff74000c1000a3fff460009200046fff5100073fffd8ffef80016b00090fff6e0000c000e60001d000eb0023a0000effe77fff78ffe040006d00081fff4f0007a00169ffefafff06fff0cfff770016900088ffe17ffe16ffd26fffd7000d8000360027100347fff1cffe4e00006ffcedffe8ffff2c000360023c0006b002e90026a0002e00080fffb700193ffd9fffd07fff49000f7002d9001c7000e20037a00022ffcffffe8affd77fff1600199ffdf8ffdb5ffd8affd9ffff8e0005dfff8cfffaefff0c0014e001a300294000baffe7b00039001c7fff4c00122002fcfffa600015002d6ffdab0013600454001eaffd78ffe25fffd500105fff85ffe3c0003a004d1ffe75ffc2cffd6200123ffdf40004efffacffed70022b004fe00102fffcd0022000284002960044e0018b001d9000c90018b000b4fffe3ffbfffff0f00052ffe76fff820022e0003a00019fffd000029ffdee0005efff66fff970037b005460017afffcbffef00030800219000dd0007a000efffe42ffffe00056fff0bffe6d003c6005e2ffff4ffcd40029affefbfff4dfffd100378ffe50ffe69ffe55ffcfaffbe5ffb70002740032effcb9000cbfff0ffff27ffd77000bd00034ffebdfff17ffc81000b6000d5001f300435002400023b003cffffca00051003e0fff850002e00524ffe90000fd000b9ffce30016900115ffcb1ffec0004af001b8ffd4f002430035affc00ffc710029a00340ffe9cffc5dffcf10010200310fff9c00296004f40028900171ffb95ffb31002e7005b100181004980022effd5900007ffee90031b0016e0058a00101ffd34ffe1dfff55001990002e00137002e2fff02ffc2affbdf00203000f4ffad4004cd0024bfffb30037b00201001a2fff77ffd13ffab4001daffe7effd84fffc900079002370010cffe3ffffe10011cfffe7ff770ff883ffe240045c009ca004adff872ff973006bf00190ffdaaffe4e0028affeb1fffcb00203ff993ffde5001ff004e900182ffe910043800410ffecd00088ffc62ffebc009210021600239000ac00009ffd5cffd920032bffe49fff3b003a5006eb002a5ffc50004b0004a7ff96cff9f6003b4ffe65ffdd6ffe7d001cc003b8004cc005000027ffff7d0031a000a8ffe6c0006affb1dff895ffeae0015afff83ffdda00426ffe55ff77f00255ffec9ffb00ffc96000eeffd7600053fff78ffbe6ffe4bff9a8ffdedfff1bffed0ffe29002c0003a200019ff719ffad600264ffaecffd0bffb73fff7dff8b0ffc0700101ffb97005aaffe18ffe61ff8eeffbc400482
|
|
6
|
+
3c1c
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from ceilopyter import read_cl_file, read_cl_message
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_skip_invalid():
|
|
8
|
+
time, data = read_cl_file("tests/data/celio_chennai_2025-03-11.dat")
|
|
9
|
+
assert len(time) == 2
|
|
10
|
+
assert len(data) == 2
|
|
11
|
+
|
|
12
|
+
assert time[0] == datetime.datetime(2025, 3, 11, 8, 4, 55)
|
|
13
|
+
assert data[0].laser_temperature == 43
|
|
14
|
+
assert data[0].status.blower_fail_warning
|
|
15
|
+
|
|
16
|
+
assert time[1] == datetime.datetime(2025, 3, 11, 8, 6, 58)
|
|
17
|
+
assert data[1].laser_temperature == 42
|
|
18
|
+
assert not data[1].status.blower_fail_warning
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_kenttarova_cl31_msg():
|
|
22
|
+
path = Path("tests/data/kenttarova_cl31_msg.dat")
|
|
23
|
+
msg = read_cl_message(path.read_bytes())
|
|
24
|
+
assert msg.range_resolution == 10
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_palaiseau_cl31_msg():
|
|
28
|
+
path = Path("tests/data/palaiseau_cl31_msg.dat")
|
|
29
|
+
msg = read_cl_message(path.read_bytes())
|
|
30
|
+
assert msg.range_resolution == 5
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_uto_cl31_msg():
|
|
34
|
+
path = Path("tests/data/uto_cl31_msg.dat")
|
|
35
|
+
msg = read_cl_message(path.read_bytes())
|
|
36
|
+
assert msg.range_resolution == 10
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_kauniainen_cl31():
|
|
40
|
+
time, data = read_cl_file("tests/data/kauniainen_cl31.dat")
|
|
41
|
+
assert len(time) == len(data) == 2
|
|
42
|
+
assert time[0] == datetime.datetime(2025, 2, 2, 0, 0, 3)
|
|
43
|
+
assert time[1] == datetime.datetime(2025, 2, 2, 0, 0, 18)
|
|
44
|
+
assert data[0].range_resolution == 10
|
|
45
|
+
assert data[0].laser_temperature == 26
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pytest
|
|
3
|
+
from numpy import ma
|
|
4
|
+
from numpy.testing import assert_array_equal
|
|
5
|
+
|
|
6
|
+
from ceilopyter.utils import interpolate_masked
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.mark.parametrize(
|
|
10
|
+
"array,mask,expected",
|
|
11
|
+
[
|
|
12
|
+
([0.0, 0.0, 3.0], [1, 1, 0], [3.0, 3.0, 3.0]),
|
|
13
|
+
([2.0, 0.0, 0.0], [0, 1, 1], [2.0, 2.0, 2.0]),
|
|
14
|
+
([1.0, 0.0, 3.0], [0, 1, 0], [1.0, 2.0, 3.0]),
|
|
15
|
+
([1.0, 0.0, 3.0, 0.0, 5.0], [0, 1, 0, 1, 0], [1.0, 2.0, 3.0, 4.0, 5.0]),
|
|
16
|
+
([1.0, 0.0, 0.0, 0.0, 3.0], [0, 1, 1, 1, 0], [1.0, 1.5, 2.0, 2.5, 3.0]),
|
|
17
|
+
],
|
|
18
|
+
)
|
|
19
|
+
def test_interpolate_masked(array, mask, expected):
|
|
20
|
+
input = ma.array(array, mask=mask)
|
|
21
|
+
actual = interpolate_masked(input)
|
|
22
|
+
assert not ma.is_masked(actual)
|
|
23
|
+
assert_array_equal(actual, expected)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_interpolate_all_masked():
|
|
27
|
+
array = interpolate_masked(ma.masked_all(5))
|
|
28
|
+
assert len(array) == 5
|
|
29
|
+
assert np.all(array.mask)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
import numpy.typing as npt
|
|
3
|
-
from numpy import ma
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def remove_noise(
|
|
7
|
-
beta_uncorr: npt.NDArray[np.floating], noise_floor: float, snr_limit: float = 5
|
|
8
|
-
) -> npt.NDArray[np.bool]:
|
|
9
|
-
zero_ranges = np.all(beta_uncorr == 0, axis=0)
|
|
10
|
-
n_zeros = np.argmax(~zero_ranges[::-1])
|
|
11
|
-
|
|
12
|
-
fraction = 0.1
|
|
13
|
-
n_top_gates = round(beta_uncorr.shape[1] * fraction)
|
|
14
|
-
beta_top = beta_uncorr[:, -n_top_gates - n_zeros : -n_zeros]
|
|
15
|
-
noise = ma.std(beta_top, axis=1)
|
|
16
|
-
|
|
17
|
-
noise = np.maximum(noise, noise_floor)
|
|
18
|
-
snr = beta_uncorr / noise[:, np.newaxis]
|
|
19
|
-
|
|
20
|
-
is_noise = snr < snr_limit
|
|
21
|
-
|
|
22
|
-
return is_noise
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.0"
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import datetime
|
|
2
|
-
|
|
3
|
-
from ceilopyter import read_cl_file
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def test_skip_invalid():
|
|
7
|
-
time, data = read_cl_file("tests/data/celio_chennai_2025-03-11.dat")
|
|
8
|
-
assert len(time) == 2
|
|
9
|
-
assert len(data) == 2
|
|
10
|
-
|
|
11
|
-
assert time[0] == datetime.datetime(2025, 3, 11, 8, 4, 55)
|
|
12
|
-
assert data[0].laser_temperature == 43
|
|
13
|
-
assert data[0].status.blower_fail_warning
|
|
14
|
-
|
|
15
|
-
assert time[1] == datetime.datetime(2025, 3, 11, 8, 6, 58)
|
|
16
|
-
assert data[1].laser_temperature == 42
|
|
17
|
-
assert not data[1].status.blower_fail_warning
|
|
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
|