disdrodb 0.1.2__py3-none-any.whl → 0.1.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.
Files changed (123) hide show
  1. disdrodb/__init__.py +64 -34
  2. disdrodb/_config.py +5 -4
  3. disdrodb/_version.py +16 -3
  4. disdrodb/accessor/__init__.py +20 -0
  5. disdrodb/accessor/methods.py +125 -0
  6. disdrodb/api/checks.py +139 -9
  7. disdrodb/api/configs.py +4 -2
  8. disdrodb/api/info.py +10 -10
  9. disdrodb/api/io.py +237 -18
  10. disdrodb/api/path.py +81 -75
  11. disdrodb/api/search.py +6 -6
  12. disdrodb/cli/disdrodb_create_summary_station.py +91 -0
  13. disdrodb/cli/disdrodb_run_l0.py +1 -1
  14. disdrodb/cli/disdrodb_run_l0_station.py +1 -1
  15. disdrodb/cli/disdrodb_run_l0b.py +1 -1
  16. disdrodb/cli/disdrodb_run_l0b_station.py +1 -1
  17. disdrodb/cli/disdrodb_run_l0c.py +1 -1
  18. disdrodb/cli/disdrodb_run_l0c_station.py +1 -1
  19. disdrodb/cli/disdrodb_run_l2e_station.py +1 -1
  20. disdrodb/configs.py +149 -4
  21. disdrodb/constants.py +61 -0
  22. disdrodb/data_transfer/download_data.py +5 -5
  23. disdrodb/etc/configs/attributes.yaml +339 -0
  24. disdrodb/etc/configs/encodings.yaml +473 -0
  25. disdrodb/etc/products/L1/global.yaml +13 -0
  26. disdrodb/etc/products/L2E/10MIN.yaml +12 -0
  27. disdrodb/etc/products/L2E/1MIN.yaml +1 -0
  28. disdrodb/etc/products/L2E/global.yaml +22 -0
  29. disdrodb/etc/products/L2M/10MIN.yaml +12 -0
  30. disdrodb/etc/products/L2M/GAMMA_ML.yaml +8 -0
  31. disdrodb/etc/products/L2M/NGAMMA_GS_LOG_ND_MAE.yaml +6 -0
  32. disdrodb/etc/products/L2M/NGAMMA_GS_ND_MAE.yaml +6 -0
  33. disdrodb/etc/products/L2M/NGAMMA_GS_Z_MAE.yaml +6 -0
  34. disdrodb/etc/products/L2M/global.yaml +26 -0
  35. disdrodb/l0/__init__.py +13 -0
  36. disdrodb/l0/configs/LPM/l0b_cf_attrs.yml +4 -4
  37. disdrodb/l0/configs/PARSIVEL/l0b_cf_attrs.yml +1 -1
  38. disdrodb/l0/configs/PARSIVEL/l0b_encodings.yml +3 -3
  39. disdrodb/l0/configs/PARSIVEL/raw_data_format.yml +1 -1
  40. disdrodb/l0/configs/PARSIVEL2/l0b_cf_attrs.yml +5 -5
  41. disdrodb/l0/configs/PARSIVEL2/l0b_encodings.yml +3 -3
  42. disdrodb/l0/configs/PARSIVEL2/raw_data_format.yml +1 -1
  43. disdrodb/l0/configs/PWS100/l0b_cf_attrs.yml +4 -4
  44. disdrodb/l0/configs/PWS100/raw_data_format.yml +1 -1
  45. disdrodb/l0/l0a_processing.py +30 -30
  46. disdrodb/l0/l0b_nc_processing.py +108 -2
  47. disdrodb/l0/l0b_processing.py +4 -4
  48. disdrodb/l0/l0c_processing.py +5 -13
  49. disdrodb/l0/readers/LPM/NETHERLANDS/DELFT_LPM_NC.py +66 -0
  50. disdrodb/l0/readers/LPM/SLOVENIA/{CRNI_VRH.py → UL.py} +3 -0
  51. disdrodb/l0/readers/LPM/SWITZERLAND/INNERERIZ_LPM.py +195 -0
  52. disdrodb/l0/readers/PARSIVEL/GPM/PIERS.py +0 -2
  53. disdrodb/l0/readers/PARSIVEL/JAPAN/JMA.py +4 -1
  54. disdrodb/l0/readers/PARSIVEL/NCAR/PECAN_MOBILE.py +1 -1
  55. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2009.py +1 -1
  56. disdrodb/l0/readers/PARSIVEL2/BELGIUM/ILVO.py +168 -0
  57. disdrodb/l0/readers/PARSIVEL2/DENMARK/DTU.py +165 -0
  58. disdrodb/l0/readers/PARSIVEL2/FINLAND/FMI_PARSIVEL2.py +69 -0
  59. disdrodb/l0/readers/PARSIVEL2/FRANCE/ENPC_PARSIVEL2.py +255 -134
  60. disdrodb/l0/readers/PARSIVEL2/FRANCE/OSUG.py +525 -0
  61. disdrodb/l0/readers/PARSIVEL2/FRANCE/SIRTA_PARSIVEL2.py +1 -1
  62. disdrodb/l0/readers/PARSIVEL2/GPM/GCPEX.py +9 -7
  63. disdrodb/l0/readers/PARSIVEL2/KIT/BURKINA_FASO.py +1 -1
  64. disdrodb/l0/readers/PARSIVEL2/KIT/TEAMX.py +123 -0
  65. disdrodb/l0/readers/PARSIVEL2/NASA/APU.py +120 -0
  66. disdrodb/l0/readers/PARSIVEL2/NCAR/FARM_PARSIVEL2.py +1 -0
  67. disdrodb/l0/readers/PARSIVEL2/NCAR/PECAN_FP3.py +1 -1
  68. disdrodb/l0/readers/PARSIVEL2/NCAR/PERILS_MIPS.py +126 -0
  69. disdrodb/l0/readers/PARSIVEL2/NCAR/PERILS_PIPS.py +165 -0
  70. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_P2.py +1 -1
  71. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_PIPS.py +20 -12
  72. disdrodb/l0/readers/PARSIVEL2/NETHERLANDS/DELFT_NC.py +2 -0
  73. disdrodb/l0/readers/PARSIVEL2/SPAIN/CENER.py +144 -0
  74. disdrodb/l0/readers/PARSIVEL2/SPAIN/CR1000DL.py +201 -0
  75. disdrodb/l0/readers/PARSIVEL2/SPAIN/LIAISE.py +137 -0
  76. disdrodb/l0/readers/PARSIVEL2/{NETHERLANDS/DELFT.py → USA/C3WE.py} +65 -85
  77. disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100.py +105 -99
  78. disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100_SIRTA.py +151 -0
  79. disdrodb/l0/routines.py +105 -14
  80. disdrodb/l1/__init__.py +5 -0
  81. disdrodb/l1/filters.py +34 -20
  82. disdrodb/l1/processing.py +45 -44
  83. disdrodb/l1/resampling.py +77 -66
  84. disdrodb/l1/routines.py +35 -43
  85. disdrodb/l1_env/routines.py +18 -3
  86. disdrodb/l2/__init__.py +7 -0
  87. disdrodb/l2/empirical_dsd.py +58 -10
  88. disdrodb/l2/event.py +27 -120
  89. disdrodb/l2/processing.py +267 -116
  90. disdrodb/l2/routines.py +618 -254
  91. disdrodb/metadata/standards.py +3 -1
  92. disdrodb/psd/fitting.py +463 -144
  93. disdrodb/psd/models.py +8 -5
  94. disdrodb/routines.py +3 -3
  95. disdrodb/scattering/__init__.py +16 -4
  96. disdrodb/scattering/axis_ratio.py +56 -36
  97. disdrodb/scattering/permittivity.py +486 -0
  98. disdrodb/scattering/routines.py +701 -159
  99. disdrodb/summary/__init__.py +17 -0
  100. disdrodb/summary/routines.py +4120 -0
  101. disdrodb/utils/attrs.py +68 -125
  102. disdrodb/utils/compression.py +30 -1
  103. disdrodb/utils/dask.py +59 -8
  104. disdrodb/utils/dataframe.py +61 -7
  105. disdrodb/utils/directories.py +35 -15
  106. disdrodb/utils/encoding.py +33 -19
  107. disdrodb/utils/logger.py +13 -6
  108. disdrodb/utils/manipulations.py +71 -0
  109. disdrodb/utils/subsetting.py +214 -0
  110. disdrodb/utils/time.py +165 -19
  111. disdrodb/utils/writer.py +20 -7
  112. disdrodb/utils/xarray.py +2 -4
  113. disdrodb/viz/__init__.py +13 -0
  114. disdrodb/viz/plots.py +327 -0
  115. {disdrodb-0.1.2.dist-info → disdrodb-0.1.3.dist-info}/METADATA +3 -2
  116. {disdrodb-0.1.2.dist-info → disdrodb-0.1.3.dist-info}/RECORD +121 -88
  117. {disdrodb-0.1.2.dist-info → disdrodb-0.1.3.dist-info}/entry_points.txt +1 -0
  118. disdrodb/l1/encoding_attrs.py +0 -642
  119. disdrodb/l2/processing_options.py +0 -213
  120. /disdrodb/l0/readers/PARSIVEL/SLOVENIA/{UL_FGG.py → UL.py} +0 -0
  121. {disdrodb-0.1.2.dist-info → disdrodb-0.1.3.dist-info}/WHEEL +0 -0
  122. {disdrodb-0.1.2.dist-info → disdrodb-0.1.3.dist-info}/licenses/LICENSE +0 -0
  123. {disdrodb-0.1.2.dist-info → disdrodb-0.1.3.dist-info}/top_level.txt +0 -0
disdrodb/psd/models.py CHANGED
@@ -32,7 +32,7 @@ import xarray as xr
32
32
  from scipy.interpolate import PchipInterpolator, interp1d
33
33
  from scipy.special import gamma as gamma_f
34
34
 
35
- from disdrodb import DIAMETER_DIMENSION
35
+ from disdrodb.constants import DIAMETER_DIMENSION
36
36
  from disdrodb.utils.warnings import suppress_warnings
37
37
 
38
38
  # Check if pytmatrix is available
@@ -79,7 +79,7 @@ def check_diameter_inputs(D):
79
79
  raise ValueError("Expecting a 1-dimensional diameter array.")
80
80
  if D.size == 0:
81
81
  raise ValueError("Expecting a non-empty diameter array.")
82
- return xr.DataArray(D, dims=DIAMETER_DIMENSION)
82
+ return D # If xr.DataArray(D, dims=DIAMETER_DIMENSION) make pytmatrix failing !
83
83
  raise TypeError(f"Invalid diameter type: {type(D)}")
84
84
 
85
85
 
@@ -121,6 +121,8 @@ class XarrayPSD(PSD):
121
121
  def __call__(self, D):
122
122
  """Compute the PSD."""
123
123
  D = check_diameter_inputs(D)
124
+ if self.has_xarray_parameters() and not np.isscalar(D):
125
+ D = xr.DataArray(D, dims=DIAMETER_DIMENSION)
124
126
  with suppress_warnings():
125
127
  return self.formula(D=D, **self.parameters)
126
128
 
@@ -302,7 +304,7 @@ class ExponentialPSD(XarrayPSD):
302
304
  Lambda: the inverse scale parameter
303
305
 
304
306
  Args (call):
305
- D: the particle diameter.
307
+ D: the particle diameter in millimeter.
306
308
 
307
309
  Returns (call):
308
310
  The PSD value for the given diameter.
@@ -377,7 +379,7 @@ class GammaPSD(ExponentialPSD):
377
379
  mu: the shape parameter [-]
378
380
 
379
381
  Args (call):
380
- D: the particle diameter.
382
+ D: the particle diameter in millimeter.
381
383
 
382
384
  Returns (call):
383
385
  The PSD value for the given diameter.
@@ -478,7 +480,7 @@ class NormalizedGammaPSD(XarrayPSD):
478
480
  mu: the shape parameter.
479
481
 
480
482
  Args (call):
481
- D: the particle diameter.
483
+ D: the particle diameter in millimeter.
482
484
 
483
485
  Returns (call):
484
486
  The PSD value for the given diameter.
@@ -695,6 +697,7 @@ class BinnedPSD(PSD):
695
697
  """
696
698
  # Ensure D is numpy array of correct dimension
697
699
  D = np.asanyarray(check_diameter_inputs(D))
700
+
698
701
  # Define interpolator
699
702
  interpolator = define_interpolator(
700
703
  bin_edges=self.bin_edges,
disdrodb/routines.py CHANGED
@@ -91,7 +91,7 @@ def run_l0_station(
91
91
  debugging_mode : bool
92
92
  If ``True``, it reduces the amount of data to process.
93
93
  For L0A, it processes just the first 3 raw data files for each station.
94
- For L0B, it processes just the first 100 rows of 3 L0A files for each station.
94
+ For L0B, it processes 100 rows sampled from 3 L0A files for each station.
95
95
  The default value is ``False``.
96
96
  data_archive_dir : str (optional)
97
97
  The directory path where the DISDRODB Data Archive is located.
@@ -794,7 +794,7 @@ def run_l0b(
794
794
  If ``False``, the files are processed sequentially in a single process.
795
795
  debugging_mode : bool
796
796
  If ``True``, it reduces the amount of data to process.
797
- For L0B, it processes just the first 100 rows of 3 L0A files.
797
+ For L0B, it processes 100 rows sampled from 3 L0A files.
798
798
  The default value is ``False``.
799
799
  data_archive_dir : str (optional)
800
800
  The directory path where the DISDRODB Data Archive is located.
@@ -1033,7 +1033,7 @@ def run_l0(
1033
1033
  debugging_mode : bool
1034
1034
  If ``True``, it reduces the amount of data to process.
1035
1035
  For L0A, it processes just the first 3 raw data files.
1036
- For L0B, it processes just the first 100 rows of 3 L0A files.
1036
+ For L0B, it processes 100 rows sampled from 3 L0A files.
1037
1037
  The default value is ``False``.
1038
1038
  data_archive_dir : str (optional)
1039
1039
  The directory path where the DISDRODB Data Archive is located.
@@ -17,12 +17,24 @@
17
17
  """Implement PSD scattering routines."""
18
18
 
19
19
 
20
- from disdrodb.scattering.axis_ratio import available_axis_ratio, get_axis_ratio
21
- from disdrodb.scattering.routines import available_radar_bands, get_radar_parameters
20
+ from disdrodb.scattering.axis_ratio import available_axis_ratio_models, get_axis_ratio_model
21
+ from disdrodb.scattering.permittivity import available_permittivity_models, get_refractive_index
22
+ from disdrodb.scattering.routines import (
23
+ RADAR_OPTIONS,
24
+ RADAR_VARIABLES,
25
+ available_radar_bands,
26
+ get_radar_parameters,
27
+ load_scatterer,
28
+ )
22
29
 
23
30
  __all__ = [
24
- "available_axis_ratio",
31
+ "RADAR_OPTIONS",
32
+ "RADAR_VARIABLES",
33
+ "available_axis_ratio_models",
34
+ "available_permittivity_models",
25
35
  "available_radar_bands",
26
- "get_axis_ratio",
36
+ "get_axis_ratio_model",
27
37
  "get_radar_parameters",
38
+ "get_refractive_index",
39
+ "load_scatterer",
28
40
  ]
@@ -14,70 +14,90 @@
14
14
  # You should have received a copy of the GNU General Public License
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
- """Implement drop axis ratio theoretical models."""
17
+ """Implement drop (vertical-to-horizontal) axis ratio theoretical models."""
18
18
 
19
19
  import numpy as np
20
20
  import xarray as xr
21
21
 
22
22
 
23
- def available_axis_ratio():
24
- """Return a list of the available drop axis ratio methods."""
25
- return list(AXIS_RATIO_METHODS)
23
+ def available_axis_ratio_models():
24
+ """Return a list of the available drop axis ratio models."""
25
+ return list(AXIS_RATIO_MODELS)
26
26
 
27
27
 
28
- def get_axis_ratio_method(method):
29
- """Return the specified drop axis ratio method."""
30
- method = check_axis_ratio(method)
31
- return AXIS_RATIO_METHODS[method]
28
+ def get_axis_ratio_model(model):
29
+ """Return the specified drop axis ratio model.
32
30
 
31
+ Parameters
32
+ ----------
33
+ model : str
34
+ The model to use for calculating the axis ratio. Available models are:
35
+ 'Thurai2005', 'Thurai2007', 'Battaglia2010', 'Brandes2002',
36
+ 'Pruppacher1970', 'Beard1987', 'Andsager1999'.
33
37
 
34
- def check_axis_ratio(method):
35
- """Check validity of the specified drop axis ratio method."""
36
- available_methods = available_axis_ratio()
37
- if method not in available_methods:
38
- raise ValueError(f"{method} is an invalid axis-ratio method. Valid methods: {available_methods}.")
39
- return method
38
+ Returns
39
+ -------
40
+ callable
41
+ A function which compute the vertical-to-horizontal axis ratio given a
42
+ particle diameter in mm.
40
43
 
44
+ Notes
45
+ -----
46
+ This function serves as a wrapper to various axis ratio models for raindrops.
47
+ It returns the appropriate model based on the `model` parameter.
41
48
 
42
- def get_axis_ratio(diameter, method):
49
+ Please note that the axis ratio function to be provided to pyTmatrix expects to
50
+ return a horizontal-to-vertical axis ratio !
51
+
52
+ """
53
+ model = check_axis_ratio_model(model)
54
+ return AXIS_RATIO_MODELS[model]
55
+
56
+
57
+ def check_axis_ratio_model(model):
58
+ """Check validity of the specified drop axis ratio model."""
59
+ available_models = available_axis_ratio_models()
60
+ if model not in available_models:
61
+ raise ValueError(f"{model} is an invalid axis-ratio model. Valid models: {available_models}.")
62
+ return model
63
+
64
+
65
+ def get_axis_ratio(diameter, model):
43
66
  """
44
- Compute the axis ratio of raindrops using the specified method.
67
+ Compute the axis ratio of raindrops using the specified model.
45
68
 
46
69
  Parameters
47
70
  ----------
48
71
  diameter : array-like
49
72
  Raindrops diameter in mm.
50
- method : str
51
- The method to use for calculating the axis ratio. Available methods are:
73
+ model : str
74
+ The axis ratio model to use for calculating the axis ratio. Available models are:
52
75
  'Thurai2005', 'Thurai2007', 'Battaglia2010', 'Brandes2002',
53
76
  'Pruppacher1970', 'Beard1987', 'Andsager1999'.
54
77
 
55
78
  Returns
56
79
  -------
57
80
  axis_ratio : array-like
58
- Calculated axis ratios corresponding to the input diameters.
59
-
60
- Raises
61
- ------
62
- ValueError
63
- If the specified method is not one of the available methods.
81
+ The vertical-to-horizontal drop axis ratio corresponding to the input diameters.
82
+ Values of 1 indicate spherical particles, while values <1 indicate oblate particles.
83
+ Values >1 means prolate particles.
64
84
 
65
85
  Notes
66
86
  -----
67
87
  This function serves as a wrapper to various axis ratio models for raindrops.
68
- It selects and applies the appropriate model based on the `method` parameter.
88
+ It selects and applies the appropriate model based on the `model` parameter.
69
89
 
70
90
  Examples
71
91
  --------
72
92
  >>> diameter = np.array([0.5, 1.0, 2.0, 3.0])
73
- >>> axis_ratio = get_axis_ratio(diameter, method="Brandes2002")
93
+ >>> axis_ratio = get_axis_ratio(diameter, model="Brandes2002")
74
94
 
75
95
  """
76
96
  # Retrieve axis ratio function
77
- func = get_axis_ratio_method(method)
97
+ axis_ratio_func = get_axis_ratio_model(model)
78
98
 
79
99
  # Retrieve axis ratio
80
- axis_ratio = func(diameter)
100
+ axis_ratio = axis_ratio_func(diameter)
81
101
 
82
102
  # Clip values between 0 and 1
83
103
  axis_ratio = np.clip(axis_ratio, 0, 1)
@@ -86,7 +106,7 @@ def get_axis_ratio(diameter, method):
86
106
 
87
107
  def get_axis_ratio_andsager_1999(diameter):
88
108
  """
89
- Compute the axis ratio of raindrops using the Andsager et al. (1999) method.
109
+ Compute the axis ratio of raindrops using the Andsager et al. (1999) model.
90
110
 
91
111
  Parameters
92
112
  ----------
@@ -145,7 +165,7 @@ def get_axis_ratio_andsager_1999(diameter):
145
165
 
146
166
  def get_axis_ratio_battaglia_2010(diameter):
147
167
  """
148
- Compute the axis ratio of raindrops using the Battaglia et al. (2010) method.
168
+ Compute the axis ratio of raindrops using the Battaglia et al. (2010) model.
149
169
 
150
170
  Parameters
151
171
  ----------
@@ -185,7 +205,7 @@ def get_axis_ratio_battaglia_2010(diameter):
185
205
 
186
206
  def get_axis_ratio_beard_1987(diameter):
187
207
  """
188
- Compute the axis ratio of raindrops using the Beard and Chuang (1987) method.
208
+ Compute the axis ratio of raindrops using the Beard and Chuang (1987) model.
189
209
 
190
210
  Parameters
191
211
  ----------
@@ -214,7 +234,7 @@ def get_axis_ratio_beard_1987(diameter):
214
234
 
215
235
  def get_axis_ratio_brandes_2002(diameter):
216
236
  """
217
- Compute the axis ratio of raindrops using the Brandes et al. (2002) method.
237
+ Compute the axis ratio of raindrops using the Brandes et al. (2002) model.
218
238
 
219
239
  Parameters
220
240
  ----------
@@ -243,7 +263,7 @@ def get_axis_ratio_brandes_2002(diameter):
243
263
 
244
264
  def get_axis_ratio_pruppacher_1970(diameter):
245
265
  """
246
- Compute the axis ratio of raindrops using the Pruppacher and Pitter (1971) method.
266
+ Compute the axis ratio of raindrops using the Pruppacher and Pitter (1971) model.
247
267
 
248
268
  Parameters
249
269
  ----------
@@ -273,7 +293,7 @@ def get_axis_ratio_pruppacher_1970(diameter):
273
293
 
274
294
  def get_axis_ratio_thurai_2005(diameter):
275
295
  """
276
- Compute the axis ratio of raindrops using the Thurai et al. (2005) method.
296
+ Compute the axis ratio of raindrops using the Thurai et al. (2005) model.
277
297
 
278
298
  Parameters
279
299
  ----------
@@ -297,7 +317,7 @@ def get_axis_ratio_thurai_2005(diameter):
297
317
 
298
318
 
299
319
  def get_axis_ratio_thurai_2007(diameter):
300
- """Compute the axis ratio of raindrops using the Thurai et al. (2007) method.
320
+ """Compute the axis ratio of raindrops using the Thurai et al. (2007) model.
301
321
 
302
322
  Parameters
303
323
  ----------
@@ -333,7 +353,7 @@ def get_axis_ratio_thurai_2007(diameter):
333
353
  return axis_ratio
334
354
 
335
355
 
336
- AXIS_RATIO_METHODS = {
356
+ AXIS_RATIO_MODELS = {
337
357
  "Thurai2005": get_axis_ratio_thurai_2005,
338
358
  "Thurai2007": get_axis_ratio_thurai_2007,
339
359
  "Battaglia2010": get_axis_ratio_battaglia_2010,