cloudnetpy 1.62.1__py3-none-any.whl → 1.64.0__py3-none-any.whl
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.
- cloudnetpy/categorize/categorize.py +3 -1
- cloudnetpy/categorize/containers.py +18 -3
- cloudnetpy/categorize/insects.py +1 -14
- cloudnetpy/categorize/model.py +7 -1
- cloudnetpy/version.py +2 -2
- {cloudnetpy-1.62.1.dist-info → cloudnetpy-1.64.0.dist-info}/METADATA +1 -1
- {cloudnetpy-1.62.1.dist-info → cloudnetpy-1.64.0.dist-info}/RECORD +10 -10
- {cloudnetpy-1.62.1.dist-info → cloudnetpy-1.64.0.dist-info}/LICENSE +0 -0
- {cloudnetpy-1.62.1.dist-info → cloudnetpy-1.64.0.dist-info}/WHEEL +0 -0
- {cloudnetpy-1.62.1.dist-info → cloudnetpy-1.64.0.dist-info}/top_level.txt +0 -0
@@ -18,6 +18,7 @@ def generate_categorize(
|
|
18
18
|
input_files: dict,
|
19
19
|
output_file: str,
|
20
20
|
uuid: str | None = None,
|
21
|
+
options: dict | None = None,
|
21
22
|
) -> str:
|
22
23
|
"""Generates Cloudnet Level 1c categorize file.
|
23
24
|
|
@@ -33,6 +34,7 @@ def generate_categorize(
|
|
33
34
|
RPG level 0 files.
|
34
35
|
output_file: Full path of the output file.
|
35
36
|
uuid: Set specific UUID for the file.
|
37
|
+
options: Dictionary containing optional parameters.
|
36
38
|
|
37
39
|
Returns:
|
38
40
|
UUID of the generated file.
|
@@ -138,7 +140,7 @@ def generate_categorize(
|
|
138
140
|
data["disdrometer"] = Disdrometer(input_files["disdrometer"])
|
139
141
|
except DisdrometerDataError as err:
|
140
142
|
logging.warning("Unable to use disdrometer: %s", err)
|
141
|
-
data["model"] = Model(input_files["model"], data["radar"].altitude)
|
143
|
+
data["model"] = Model(input_files["model"], data["radar"].altitude, options)
|
142
144
|
time, height = _define_dense_grid()
|
143
145
|
valid_ind = _interpolate_to_cloudnet_grid()
|
144
146
|
if not valid_ind:
|
@@ -74,13 +74,28 @@ class ClassData:
|
|
74
74
|
|
75
75
|
def _find_rain_from_radar_echo(self) -> np.ndarray:
|
76
76
|
gate_number = 3
|
77
|
-
threshold = 0
|
77
|
+
threshold = {"z": 3, "v": 0, "ldr": -15}
|
78
78
|
z = self.z[:, gate_number]
|
79
|
-
|
79
|
+
v = self.v[:, gate_number]
|
80
|
+
if hasattr(self, "ldr"):
|
81
|
+
ldr = self.ldr[:, gate_number]
|
82
|
+
elif hasattr(self, "sldr"):
|
83
|
+
ldr = self.sldr[:, gate_number]
|
84
|
+
else:
|
85
|
+
ldr = np.full(self.time.shape, threshold["ldr"] - 1)
|
86
|
+
|
87
|
+
return np.where(
|
88
|
+
(~ma.getmaskarray(z))
|
89
|
+
& (z > threshold["z"])
|
90
|
+
& (v < threshold["v"])
|
91
|
+
& (ldr < threshold["ldr"]),
|
92
|
+
1,
|
93
|
+
0,
|
94
|
+
)
|
80
95
|
|
81
96
|
def _find_rain_from_disdrometer(self) -> ma.MaskedArray:
|
82
97
|
threshold_mm_h = 0.25 # Standard threshold for drizzle -> rain
|
83
|
-
threshold_particles =
|
98
|
+
threshold_particles = 30 # This is arbitrary and should be better tested
|
84
99
|
threshold_rate = threshold_mm_h * MM_H_TO_M_S
|
85
100
|
try:
|
86
101
|
rainfall_rate = self.data["disdrometer"].data["rainfall_rate"].data
|
cloudnetpy/categorize/insects.py
CHANGED
@@ -148,8 +148,7 @@ def _screen_insects(
|
|
148
148
|
prob[(above_liquid == 1) & (insect_prob_no_ldr > 0)] = 0
|
149
149
|
|
150
150
|
def _screen_rainy_profiles() -> None:
|
151
|
-
|
152
|
-
prob[rain_smoothed == 1, :] = 0
|
151
|
+
prob[obs.is_rain == 1, :] = 0
|
153
152
|
|
154
153
|
prob = np.copy(insect_prob)
|
155
154
|
_screen_liquid_layers()
|
@@ -157,15 +156,3 @@ def _screen_insects(
|
|
157
156
|
_screen_above_liquid()
|
158
157
|
_screen_rainy_profiles()
|
159
158
|
return prob
|
160
|
-
|
161
|
-
|
162
|
-
def _smooth_rain(time: np.ndarray, is_rain: np.ndarray) -> np.ndarray:
|
163
|
-
is_rain_smoothed = np.copy(is_rain)
|
164
|
-
time_buffer = 5 # minutes
|
165
|
-
n_profiles = len(is_rain)
|
166
|
-
n_steps = utils.n_elements(time, time_buffer, "time")
|
167
|
-
for rain_idx in np.where(is_rain)[0]:
|
168
|
-
idx_start = max(0, rain_idx - n_steps)
|
169
|
-
idx_end = min(rain_idx + n_steps, n_profiles)
|
170
|
-
is_rain_smoothed[idx_start : idx_end + 1] = True
|
171
|
-
return is_rain_smoothed
|
cloudnetpy/categorize/model.py
CHANGED
@@ -17,6 +17,7 @@ class Model(DataSource):
|
|
17
17
|
Args:
|
18
18
|
model_file: File name of the NWP model file.
|
19
19
|
alt_site: Altitude of the site above mean sea level (m).
|
20
|
+
options: Dictionary containing optional parameters.
|
20
21
|
|
21
22
|
Attributes:
|
22
23
|
source_type (str): Model type, e.g. 'gdas1' or 'ecwmf'.
|
@@ -41,8 +42,9 @@ class Model(DataSource):
|
|
41
42
|
)
|
42
43
|
fields_sparse = (*fields_dense, "q", "uwind", "vwind")
|
43
44
|
|
44
|
-
def __init__(self, model_file: str, alt_site: float):
|
45
|
+
def __init__(self, model_file: str, alt_site: float, options: dict | None = None):
|
45
46
|
super().__init__(model_file)
|
47
|
+
self.options = options
|
46
48
|
self.source_type = _find_model_type(model_file)
|
47
49
|
self.model_heights = self._get_model_heights(alt_site)
|
48
50
|
self.mean_height = _calc_mean_height(self.model_heights)
|
@@ -113,7 +115,11 @@ class Model(DataSource):
|
|
113
115
|
def calc_wet_bulb(self) -> None:
|
114
116
|
"""Calculates wet-bulb temperature in dense grid."""
|
115
117
|
wet_bulb_temp = atmos_utils.calc_wet_bulb_temperature(self.data_dense)
|
118
|
+
offset = (self.options or {}).get("temperature_offset", 0)
|
119
|
+
wet_bulb_temp += offset
|
116
120
|
self.append_data(wet_bulb_temp, "Tw", units="K")
|
121
|
+
if offset:
|
122
|
+
self.data["Tw"].temperature_correction_applied = offset
|
117
123
|
|
118
124
|
def screen_sparse_fields(self) -> None:
|
119
125
|
"""Removes model fields that we don't want to write in the output."""
|
cloudnetpy/version.py
CHANGED
@@ -8,21 +8,21 @@ cloudnetpy/metadata.py,sha256=v_VDo2vbdTxB0zIsfP69IcrwSKiRlLpsGdq6JPI4CoA,5306
|
|
8
8
|
cloudnetpy/output.py,sha256=YkCaxVkG_Mt2hng_IVnhygHteV4UMKzKALkeFZwFJL8,14822
|
9
9
|
cloudnetpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
cloudnetpy/utils.py,sha256=JV0Fawnme1HoZgoiidV3eIzsn6vx0AEjBNmI1CcrBsA,28517
|
11
|
-
cloudnetpy/version.py,sha256=
|
11
|
+
cloudnetpy/version.py,sha256=Vd42PiP_XdZoz_QmRiX6hYj94MB5XO3CY5sRjjHTfPQ,72
|
12
12
|
cloudnetpy/categorize/__init__.py,sha256=gP5q3Vis1y9u9OWgA_idlbjfWXYN_S0IBSWdwBhL_uU,69
|
13
13
|
cloudnetpy/categorize/atmos.py,sha256=G4DmEJCt1FAPYyt7oXzBH47JTeb5lUOGDakkviOXblE,12390
|
14
14
|
cloudnetpy/categorize/atmos_utils.py,sha256=64uenj2uxj3P3Blaq_pBN1pBjcF-X4LYNt-uTOjvevg,3778
|
15
|
-
cloudnetpy/categorize/categorize.py,sha256=
|
15
|
+
cloudnetpy/categorize/categorize.py,sha256=owM4ebqJCHnCWHDMELv6Qa8zM_7qKcBpzJOfPva1Py0,17929
|
16
16
|
cloudnetpy/categorize/classify.py,sha256=a-0bVCtynGfORnDGTsPuzqkuDeOOR_OMz5ai9NsMuic,9870
|
17
|
-
cloudnetpy/categorize/containers.py,sha256=
|
17
|
+
cloudnetpy/categorize/containers.py,sha256=L4UaihDfeMCADZiKdII5NCP49ZNlodCoM9X3yxEfJ_A,4748
|
18
18
|
cloudnetpy/categorize/disdrometer.py,sha256=keU3pFvKtk840A0oLwAyNDuqOCswBPJEKf2bV0YWyA8,2004
|
19
19
|
cloudnetpy/categorize/droplet.py,sha256=894VHdL9ScaB8f1oxXwM2la4ShXd-uWywQDINoaoiD8,8687
|
20
20
|
cloudnetpy/categorize/falling.py,sha256=aI09_6H24x34lYr3vnKIgjWB0wzTkxOA6wE-gkdf6bs,4386
|
21
21
|
cloudnetpy/categorize/freezing.py,sha256=c4k5AIgfBpvw64EaVVVYPi2Fx4SpHk1cyfceE1ydD28,3755
|
22
|
-
cloudnetpy/categorize/insects.py,sha256=
|
22
|
+
cloudnetpy/categorize/insects.py,sha256=9J5agmktit8Or66GGNue-bThiaG9rB2SuPNZBXI7FCE,5243
|
23
23
|
cloudnetpy/categorize/lidar.py,sha256=YQrM_LOz8NQrrD9l9HyujV1GSGwkQ8LMqXN13bEJRW4,2605
|
24
24
|
cloudnetpy/categorize/melting.py,sha256=mYdOKxfTC2InB8NdOPwr_7NpbouQMm-9f2Q1kfTqIJE,6262
|
25
|
-
cloudnetpy/categorize/model.py,sha256=
|
25
|
+
cloudnetpy/categorize/model.py,sha256=rLyx9SKz56BmQ809PwwhCnbusshUuYPoqhLJbnZvrt8,5842
|
26
26
|
cloudnetpy/categorize/mwr.py,sha256=rTyVYaMotXl7LRgRQBBcrLInsrWGl4sFdZ4pyM4jXMc,1436
|
27
27
|
cloudnetpy/categorize/radar.py,sha256=C4R74E_jmLOJqXLrfhdrAitHRHHA79UYuChz9VLxy58,13722
|
28
28
|
cloudnetpy/instruments/__init__.py,sha256=_jejVwi_viSZehmAOkEqTNI-0-exGgAJ_bHW1IRRwTI,398
|
@@ -108,8 +108,8 @@ cloudnetpy/products/mie_lu_tables.nc,sha256=It4fYpqJXlqOgL8jeZ-PxGzP08PMrELIDVe5
|
|
108
108
|
cloudnetpy/products/mwr_tools.py,sha256=3esU5cG5GI2WVmOENqrJ0FbMuxLegADv7q8TB0RorGg,4674
|
109
109
|
cloudnetpy/products/product_tools.py,sha256=VNw2diJj30POz68-3qNVkJP7r9AUspT_d1Fp0BbeIx8,10414
|
110
110
|
docs/source/conf.py,sha256=IKiFWw6xhUd8NrCg0q7l596Ck1d61XWeVjIFHVSG9Og,1490
|
111
|
-
cloudnetpy-1.
|
112
|
-
cloudnetpy-1.
|
113
|
-
cloudnetpy-1.
|
114
|
-
cloudnetpy-1.
|
115
|
-
cloudnetpy-1.
|
111
|
+
cloudnetpy-1.64.0.dist-info/LICENSE,sha256=wcZF72bdaoG9XugpyE95Juo7lBQOwLuTKBOhhtANZMM,1094
|
112
|
+
cloudnetpy-1.64.0.dist-info/METADATA,sha256=FWBF4HeLgWopUcCrb5w4RlFOrmVaNdym-v2dZgVD0Fc,5784
|
113
|
+
cloudnetpy-1.64.0.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
114
|
+
cloudnetpy-1.64.0.dist-info/top_level.txt,sha256=ibSPWRr6ojS1i11rtBFz2_gkIe68mggj7aeswYfaOo0,16
|
115
|
+
cloudnetpy-1.64.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|