cloudnetpy 1.49.9__py3-none-any.whl → 1.87.3__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/__init__.py +1 -2
- cloudnetpy/categorize/atmos_utils.py +297 -67
- cloudnetpy/categorize/attenuation.py +31 -0
- cloudnetpy/categorize/attenuations/__init__.py +37 -0
- cloudnetpy/categorize/attenuations/gas_attenuation.py +30 -0
- cloudnetpy/categorize/attenuations/liquid_attenuation.py +84 -0
- cloudnetpy/categorize/attenuations/melting_attenuation.py +78 -0
- cloudnetpy/categorize/attenuations/rain_attenuation.py +84 -0
- cloudnetpy/categorize/categorize.py +332 -156
- cloudnetpy/categorize/classify.py +127 -125
- cloudnetpy/categorize/containers.py +107 -76
- cloudnetpy/categorize/disdrometer.py +40 -0
- cloudnetpy/categorize/droplet.py +23 -21
- cloudnetpy/categorize/falling.py +53 -24
- cloudnetpy/categorize/freezing.py +25 -12
- cloudnetpy/categorize/insects.py +35 -23
- cloudnetpy/categorize/itu.py +243 -0
- cloudnetpy/categorize/lidar.py +36 -41
- cloudnetpy/categorize/melting.py +34 -26
- cloudnetpy/categorize/model.py +84 -37
- cloudnetpy/categorize/mwr.py +18 -14
- cloudnetpy/categorize/radar.py +215 -102
- cloudnetpy/cli.py +578 -0
- cloudnetpy/cloudnetarray.py +43 -89
- cloudnetpy/concat_lib.py +218 -78
- cloudnetpy/constants.py +28 -10
- cloudnetpy/datasource.py +61 -86
- cloudnetpy/exceptions.py +49 -20
- cloudnetpy/instruments/__init__.py +5 -0
- cloudnetpy/instruments/basta.py +29 -12
- cloudnetpy/instruments/bowtie.py +135 -0
- cloudnetpy/instruments/ceilo.py +138 -115
- cloudnetpy/instruments/ceilometer.py +164 -80
- cloudnetpy/instruments/cl61d.py +21 -5
- cloudnetpy/instruments/cloudnet_instrument.py +74 -36
- cloudnetpy/instruments/copernicus.py +108 -30
- cloudnetpy/instruments/da10.py +54 -0
- cloudnetpy/instruments/disdrometer/common.py +126 -223
- cloudnetpy/instruments/disdrometer/parsivel.py +453 -94
- cloudnetpy/instruments/disdrometer/thies.py +254 -87
- cloudnetpy/instruments/fd12p.py +201 -0
- cloudnetpy/instruments/galileo.py +65 -23
- cloudnetpy/instruments/hatpro.py +123 -49
- cloudnetpy/instruments/instruments.py +113 -1
- cloudnetpy/instruments/lufft.py +39 -17
- cloudnetpy/instruments/mira.py +268 -61
- cloudnetpy/instruments/mrr.py +187 -0
- cloudnetpy/instruments/nc_lidar.py +19 -8
- cloudnetpy/instruments/nc_radar.py +109 -55
- cloudnetpy/instruments/pollyxt.py +135 -51
- cloudnetpy/instruments/radiometrics.py +313 -59
- cloudnetpy/instruments/rain_e_h3.py +171 -0
- cloudnetpy/instruments/rpg.py +321 -189
- cloudnetpy/instruments/rpg_reader.py +74 -40
- cloudnetpy/instruments/toa5.py +49 -0
- cloudnetpy/instruments/vaisala.py +95 -343
- cloudnetpy/instruments/weather_station.py +774 -105
- cloudnetpy/metadata.py +90 -19
- cloudnetpy/model_evaluation/file_handler.py +55 -52
- cloudnetpy/model_evaluation/metadata.py +46 -20
- cloudnetpy/model_evaluation/model_metadata.py +1 -1
- cloudnetpy/model_evaluation/plotting/plot_tools.py +32 -37
- cloudnetpy/model_evaluation/plotting/plotting.py +327 -117
- cloudnetpy/model_evaluation/products/advance_methods.py +92 -83
- cloudnetpy/model_evaluation/products/grid_methods.py +88 -63
- cloudnetpy/model_evaluation/products/model_products.py +43 -35
- cloudnetpy/model_evaluation/products/observation_products.py +41 -35
- cloudnetpy/model_evaluation/products/product_resampling.py +17 -7
- cloudnetpy/model_evaluation/products/tools.py +29 -20
- cloudnetpy/model_evaluation/statistics/statistical_methods.py +30 -20
- cloudnetpy/model_evaluation/tests/e2e/conftest.py +3 -3
- cloudnetpy/model_evaluation/tests/e2e/process_cf/main.py +9 -5
- cloudnetpy/model_evaluation/tests/e2e/process_cf/tests.py +15 -14
- cloudnetpy/model_evaluation/tests/e2e/process_iwc/main.py +9 -5
- cloudnetpy/model_evaluation/tests/e2e/process_iwc/tests.py +15 -14
- cloudnetpy/model_evaluation/tests/e2e/process_lwc/main.py +9 -5
- cloudnetpy/model_evaluation/tests/e2e/process_lwc/tests.py +15 -14
- cloudnetpy/model_evaluation/tests/unit/conftest.py +42 -41
- cloudnetpy/model_evaluation/tests/unit/test_advance_methods.py +41 -48
- cloudnetpy/model_evaluation/tests/unit/test_grid_methods.py +216 -194
- cloudnetpy/model_evaluation/tests/unit/test_model_products.py +23 -21
- cloudnetpy/model_evaluation/tests/unit/test_observation_products.py +37 -38
- cloudnetpy/model_evaluation/tests/unit/test_plot_tools.py +43 -40
- cloudnetpy/model_evaluation/tests/unit/test_plotting.py +30 -36
- cloudnetpy/model_evaluation/tests/unit/test_statistical_methods.py +68 -31
- cloudnetpy/model_evaluation/tests/unit/test_tools.py +33 -26
- cloudnetpy/model_evaluation/utils.py +2 -1
- cloudnetpy/output.py +170 -111
- cloudnetpy/plotting/__init__.py +2 -1
- cloudnetpy/plotting/plot_meta.py +562 -822
- cloudnetpy/plotting/plotting.py +1142 -704
- cloudnetpy/products/__init__.py +1 -0
- cloudnetpy/products/classification.py +370 -88
- cloudnetpy/products/der.py +85 -55
- cloudnetpy/products/drizzle.py +77 -34
- cloudnetpy/products/drizzle_error.py +15 -11
- cloudnetpy/products/drizzle_tools.py +79 -59
- cloudnetpy/products/epsilon.py +211 -0
- cloudnetpy/products/ier.py +27 -50
- cloudnetpy/products/iwc.py +55 -48
- cloudnetpy/products/lwc.py +96 -70
- cloudnetpy/products/mwr_tools.py +186 -0
- cloudnetpy/products/product_tools.py +170 -128
- cloudnetpy/utils.py +455 -240
- cloudnetpy/version.py +2 -2
- {cloudnetpy-1.49.9.dist-info → cloudnetpy-1.87.3.dist-info}/METADATA +44 -40
- cloudnetpy-1.87.3.dist-info/RECORD +127 -0
- {cloudnetpy-1.49.9.dist-info → cloudnetpy-1.87.3.dist-info}/WHEEL +1 -1
- cloudnetpy-1.87.3.dist-info/entry_points.txt +2 -0
- docs/source/conf.py +2 -2
- cloudnetpy/categorize/atmos.py +0 -361
- cloudnetpy/products/mwr_multi.py +0 -68
- cloudnetpy/products/mwr_single.py +0 -75
- cloudnetpy-1.49.9.dist-info/RECORD +0 -112
- {cloudnetpy-1.49.9.dist-info → cloudnetpy-1.87.3.dist-info/licenses}/LICENSE +0 -0
- {cloudnetpy-1.49.9.dist-info → cloudnetpy-1.87.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import numpy.typing as npt
|
|
3
|
+
from numpy import ma
|
|
4
|
+
|
|
5
|
+
import cloudnetpy.constants as con
|
|
6
|
+
from cloudnetpy import utils
|
|
7
|
+
from cloudnetpy.categorize.attenuations import (
|
|
8
|
+
Attenuation,
|
|
9
|
+
calc_two_way_attenuation,
|
|
10
|
+
)
|
|
11
|
+
from cloudnetpy.categorize.containers import ClassificationResult, Observations
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def calc_rain_attenuation(
|
|
15
|
+
data: Observations, classification: ClassificationResult
|
|
16
|
+
) -> Attenuation:
|
|
17
|
+
affected_region, inducing_region = _find_regions(classification)
|
|
18
|
+
shape = affected_region.shape
|
|
19
|
+
|
|
20
|
+
if data.disdrometer is None:
|
|
21
|
+
return Attenuation(
|
|
22
|
+
amount=ma.masked_all(shape),
|
|
23
|
+
error=ma.masked_all(shape),
|
|
24
|
+
attenuated=affected_region,
|
|
25
|
+
uncorrected=affected_region,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
rainfall_rate = data.disdrometer.data["rainfall_rate"][:].copy()
|
|
29
|
+
rainfall_rate[classification.is_rain == 0] = ma.masked
|
|
30
|
+
frequency = data.radar.radar_frequency
|
|
31
|
+
|
|
32
|
+
specific_attenuation_array = _calc_rain_specific_attenuation(
|
|
33
|
+
rainfall_rate, frequency
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
specific_attenuation = utils.transpose(specific_attenuation_array) * ma.ones(shape)
|
|
37
|
+
|
|
38
|
+
two_way_attenuation = calc_two_way_attenuation(
|
|
39
|
+
data.radar.height_agl, specific_attenuation
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
two_way_attenuation[~inducing_region] = 0
|
|
43
|
+
two_way_attenuation = ma.array(utils.ffill(two_way_attenuation.data))
|
|
44
|
+
two_way_attenuation[two_way_attenuation == 0] = ma.masked
|
|
45
|
+
|
|
46
|
+
return Attenuation(
|
|
47
|
+
amount=two_way_attenuation,
|
|
48
|
+
error=two_way_attenuation * 0.2,
|
|
49
|
+
attenuated=affected_region,
|
|
50
|
+
uncorrected=np.zeros_like(affected_region, dtype=bool),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _find_regions(
|
|
55
|
+
classification: ClassificationResult,
|
|
56
|
+
) -> tuple[npt.NDArray[np.bool_], npt.NDArray[np.bool_]]:
|
|
57
|
+
"""Finds regions where rain attenuation is present and can be corrected or not."""
|
|
58
|
+
warm_region = ~classification.category_bits.freezing
|
|
59
|
+
is_rain = utils.transpose(classification.is_rain).astype(bool)
|
|
60
|
+
affected_region = np.ones_like(warm_region, dtype=bool) * is_rain
|
|
61
|
+
inducing_region = warm_region * is_rain
|
|
62
|
+
return affected_region, inducing_region
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _calc_rain_specific_attenuation(
|
|
66
|
+
rainfall_rate: npt.NDArray, frequency: float
|
|
67
|
+
) -> npt.NDArray:
|
|
68
|
+
"""Calculates specific attenuation due to rain (dB km-1).
|
|
69
|
+
|
|
70
|
+
References:
|
|
71
|
+
Crane, R. (1980). Prediction of Attenuation by Rain.
|
|
72
|
+
IEEE Transactions on Communications, 28(9), 1717–1733.
|
|
73
|
+
doi:10.1109/tcom.1980.1094844
|
|
74
|
+
"""
|
|
75
|
+
if frequency > 8 and frequency < 12:
|
|
76
|
+
alpha, beta = 0.0125, 1.18
|
|
77
|
+
if frequency > 34 and frequency < 37:
|
|
78
|
+
alpha, beta = 0.242, 1.04
|
|
79
|
+
elif frequency > 93 and frequency < 96:
|
|
80
|
+
alpha, beta = 0.95, 0.72
|
|
81
|
+
else:
|
|
82
|
+
msg = "Radar frequency not supported"
|
|
83
|
+
raise ValueError(msg)
|
|
84
|
+
return alpha * (rainfall_rate * con.M_S_TO_MM_H) ** beta
|