disdrodb 0.1.2__py3-none-any.whl → 0.1.4__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 (142) hide show
  1. disdrodb/__init__.py +68 -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 +177 -24
  7. disdrodb/api/configs.py +3 -3
  8. disdrodb/api/info.py +13 -13
  9. disdrodb/api/io.py +281 -22
  10. disdrodb/api/path.py +184 -195
  11. disdrodb/api/search.py +18 -9
  12. disdrodb/cli/disdrodb_create_summary.py +103 -0
  13. disdrodb/cli/disdrodb_create_summary_station.py +91 -0
  14. disdrodb/cli/disdrodb_run_l0.py +1 -1
  15. disdrodb/cli/disdrodb_run_l0_station.py +1 -1
  16. disdrodb/cli/disdrodb_run_l0a_station.py +1 -1
  17. disdrodb/cli/disdrodb_run_l0b.py +1 -1
  18. disdrodb/cli/disdrodb_run_l0b_station.py +3 -3
  19. disdrodb/cli/disdrodb_run_l0c.py +1 -1
  20. disdrodb/cli/disdrodb_run_l0c_station.py +3 -3
  21. disdrodb/cli/disdrodb_run_l1_station.py +2 -2
  22. disdrodb/cli/disdrodb_run_l2e_station.py +2 -2
  23. disdrodb/cli/disdrodb_run_l2m_station.py +2 -2
  24. disdrodb/configs.py +149 -4
  25. disdrodb/constants.py +61 -0
  26. disdrodb/data_transfer/download_data.py +127 -11
  27. disdrodb/etc/configs/attributes.yaml +339 -0
  28. disdrodb/etc/configs/encodings.yaml +473 -0
  29. disdrodb/etc/products/L1/global.yaml +13 -0
  30. disdrodb/etc/products/L2E/10MIN.yaml +12 -0
  31. disdrodb/etc/products/L2E/1MIN.yaml +1 -0
  32. disdrodb/etc/products/L2E/global.yaml +22 -0
  33. disdrodb/etc/products/L2M/10MIN.yaml +12 -0
  34. disdrodb/etc/products/L2M/GAMMA_ML.yaml +8 -0
  35. disdrodb/etc/products/L2M/NGAMMA_GS_LOG_ND_MAE.yaml +6 -0
  36. disdrodb/etc/products/L2M/NGAMMA_GS_ND_MAE.yaml +6 -0
  37. disdrodb/etc/products/L2M/NGAMMA_GS_Z_MAE.yaml +6 -0
  38. disdrodb/etc/products/L2M/global.yaml +26 -0
  39. disdrodb/issue/writer.py +2 -0
  40. disdrodb/l0/__init__.py +13 -0
  41. disdrodb/l0/configs/LPM/l0b_cf_attrs.yml +4 -4
  42. disdrodb/l0/configs/PARSIVEL/l0b_cf_attrs.yml +1 -1
  43. disdrodb/l0/configs/PARSIVEL/l0b_encodings.yml +3 -3
  44. disdrodb/l0/configs/PARSIVEL/raw_data_format.yml +1 -1
  45. disdrodb/l0/configs/PARSIVEL2/l0b_cf_attrs.yml +5 -5
  46. disdrodb/l0/configs/PARSIVEL2/l0b_encodings.yml +3 -3
  47. disdrodb/l0/configs/PARSIVEL2/raw_data_format.yml +1 -1
  48. disdrodb/l0/configs/PWS100/l0b_cf_attrs.yml +4 -4
  49. disdrodb/l0/configs/PWS100/raw_data_format.yml +1 -1
  50. disdrodb/l0/l0a_processing.py +37 -32
  51. disdrodb/l0/l0b_nc_processing.py +118 -8
  52. disdrodb/l0/l0b_processing.py +30 -65
  53. disdrodb/l0/l0c_processing.py +369 -259
  54. disdrodb/l0/readers/LPM/ARM/ARM_LPM.py +7 -0
  55. disdrodb/l0/readers/LPM/NETHERLANDS/DELFT_LPM_NC.py +66 -0
  56. disdrodb/l0/readers/LPM/SLOVENIA/{CRNI_VRH.py → UL.py} +3 -0
  57. disdrodb/l0/readers/LPM/SWITZERLAND/INNERERIZ_LPM.py +195 -0
  58. disdrodb/l0/readers/PARSIVEL/GPM/PIERS.py +0 -2
  59. disdrodb/l0/readers/PARSIVEL/JAPAN/JMA.py +4 -1
  60. disdrodb/l0/readers/PARSIVEL/NCAR/PECAN_MOBILE.py +1 -1
  61. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2009.py +1 -1
  62. disdrodb/l0/readers/PARSIVEL2/ARM/ARM_PARSIVEL2.py +4 -0
  63. disdrodb/l0/readers/PARSIVEL2/BELGIUM/ILVO.py +168 -0
  64. disdrodb/l0/readers/PARSIVEL2/CANADA/UQAM_NC.py +69 -0
  65. disdrodb/l0/readers/PARSIVEL2/DENMARK/DTU.py +165 -0
  66. disdrodb/l0/readers/PARSIVEL2/FINLAND/FMI_PARSIVEL2.py +69 -0
  67. disdrodb/l0/readers/PARSIVEL2/FRANCE/ENPC_PARSIVEL2.py +255 -134
  68. disdrodb/l0/readers/PARSIVEL2/FRANCE/OSUG.py +525 -0
  69. disdrodb/l0/readers/PARSIVEL2/FRANCE/SIRTA_PARSIVEL2.py +1 -1
  70. disdrodb/l0/readers/PARSIVEL2/GPM/GCPEX.py +9 -7
  71. disdrodb/l0/readers/PARSIVEL2/KIT/BURKINA_FASO.py +1 -1
  72. disdrodb/l0/readers/PARSIVEL2/KIT/TEAMX.py +123 -0
  73. disdrodb/l0/readers/PARSIVEL2/{NETHERLANDS/DELFT.py → MPI/BCO_PARSIVEL2.py} +41 -71
  74. disdrodb/l0/readers/PARSIVEL2/MPI/BOWTIE.py +220 -0
  75. disdrodb/l0/readers/PARSIVEL2/NASA/APU.py +120 -0
  76. disdrodb/l0/readers/PARSIVEL2/NASA/LPVEX.py +109 -0
  77. disdrodb/l0/readers/PARSIVEL2/NCAR/FARM_PARSIVEL2.py +1 -0
  78. disdrodb/l0/readers/PARSIVEL2/NCAR/PECAN_FP3.py +1 -1
  79. disdrodb/l0/readers/PARSIVEL2/NCAR/PERILS_MIPS.py +126 -0
  80. disdrodb/l0/readers/PARSIVEL2/NCAR/PERILS_PIPS.py +165 -0
  81. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_P2.py +1 -1
  82. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_PIPS.py +20 -12
  83. disdrodb/l0/readers/PARSIVEL2/NETHERLANDS/DELFT_NC.py +5 -0
  84. disdrodb/l0/readers/PARSIVEL2/SPAIN/CENER.py +144 -0
  85. disdrodb/l0/readers/PARSIVEL2/SPAIN/CR1000DL.py +201 -0
  86. disdrodb/l0/readers/PARSIVEL2/SPAIN/LIAISE.py +137 -0
  87. disdrodb/l0/readers/PARSIVEL2/USA/C3WE.py +146 -0
  88. disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100.py +105 -99
  89. disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100_SIRTA.py +151 -0
  90. disdrodb/l1/__init__.py +5 -0
  91. disdrodb/l1/fall_velocity.py +46 -0
  92. disdrodb/l1/filters.py +34 -20
  93. disdrodb/l1/processing.py +46 -45
  94. disdrodb/l1/resampling.py +77 -66
  95. disdrodb/l1_env/routines.py +18 -3
  96. disdrodb/l2/__init__.py +7 -0
  97. disdrodb/l2/empirical_dsd.py +58 -10
  98. disdrodb/l2/processing.py +268 -117
  99. disdrodb/metadata/checks.py +132 -125
  100. disdrodb/metadata/standards.py +3 -1
  101. disdrodb/psd/fitting.py +631 -345
  102. disdrodb/psd/models.py +9 -6
  103. disdrodb/routines/__init__.py +54 -0
  104. disdrodb/{l0/routines.py → routines/l0.py} +316 -355
  105. disdrodb/{l1/routines.py → routines/l1.py} +76 -116
  106. disdrodb/routines/l2.py +1019 -0
  107. disdrodb/{routines.py → routines/wrappers.py} +98 -10
  108. disdrodb/scattering/__init__.py +16 -4
  109. disdrodb/scattering/axis_ratio.py +61 -37
  110. disdrodb/scattering/permittivity.py +504 -0
  111. disdrodb/scattering/routines.py +746 -184
  112. disdrodb/summary/__init__.py +17 -0
  113. disdrodb/summary/routines.py +4196 -0
  114. disdrodb/utils/archiving.py +434 -0
  115. disdrodb/utils/attrs.py +68 -125
  116. disdrodb/utils/cli.py +5 -5
  117. disdrodb/utils/compression.py +30 -1
  118. disdrodb/utils/dask.py +121 -9
  119. disdrodb/utils/dataframe.py +61 -7
  120. disdrodb/utils/decorators.py +31 -0
  121. disdrodb/utils/directories.py +35 -15
  122. disdrodb/utils/encoding.py +37 -19
  123. disdrodb/{l2 → utils}/event.py +15 -173
  124. disdrodb/utils/logger.py +14 -7
  125. disdrodb/utils/manipulations.py +81 -0
  126. disdrodb/utils/routines.py +166 -0
  127. disdrodb/utils/subsetting.py +214 -0
  128. disdrodb/utils/time.py +35 -177
  129. disdrodb/utils/writer.py +20 -7
  130. disdrodb/utils/xarray.py +5 -4
  131. disdrodb/viz/__init__.py +13 -0
  132. disdrodb/viz/plots.py +398 -0
  133. {disdrodb-0.1.2.dist-info → disdrodb-0.1.4.dist-info}/METADATA +4 -3
  134. {disdrodb-0.1.2.dist-info → disdrodb-0.1.4.dist-info}/RECORD +139 -98
  135. {disdrodb-0.1.2.dist-info → disdrodb-0.1.4.dist-info}/entry_points.txt +2 -0
  136. disdrodb/l1/encoding_attrs.py +0 -642
  137. disdrodb/l2/processing_options.py +0 -213
  138. disdrodb/l2/routines.py +0 -868
  139. /disdrodb/l0/readers/PARSIVEL/SLOVENIA/{UL_FGG.py → UL.py} +0 -0
  140. {disdrodb-0.1.2.dist-info → disdrodb-0.1.4.dist-info}/WHEEL +0 -0
  141. {disdrodb-0.1.2.dist-info → disdrodb-0.1.4.dist-info}/licenses/LICENSE +0 -0
  142. {disdrodb-0.1.2.dist-info → disdrodb-0.1.4.dist-info}/top_level.txt +0 -0
@@ -137,8 +137,6 @@ def _check_metadata_measurement_interval(metadata):
137
137
  """Check metadata ``measurement_interval``."""
138
138
  from disdrodb.api.checks import check_measurement_intervals
139
139
 
140
- if "measurement_interval" not in metadata:
141
- raise ValueError("The metadata file does not contain the 'measurement_interval' key.")
142
140
  measurement_intervals = metadata["measurement_interval"]
143
141
  _ = check_measurement_intervals(measurement_intervals)
144
142
 
@@ -150,28 +148,8 @@ def _check_metadata_sensor_name(metadata):
150
148
  check_sensor_name(sensor_name)
151
149
 
152
150
 
153
- def check_station_metadata(data_source, campaign_name, station_name, metadata_archive_dir=None):
154
- """Check DISDRODB metadata compliance."""
155
- from disdrodb.l0.l0_reader import check_metadata_reader
156
-
157
- metadata = read_station_metadata(
158
- data_source=data_source,
159
- campaign_name=campaign_name,
160
- station_name=station_name,
161
- metadata_archive_dir=metadata_archive_dir,
162
- )
163
- _check_metadata_keys(metadata)
164
- _check_metadata_values(metadata)
165
- _check_metadata_campaign_name(metadata, expected_name=campaign_name)
166
- _check_metadata_data_source(metadata, expected_name=data_source)
167
- _check_metadata_station_name(metadata, expected_name=station_name)
168
- _check_metadata_sensor_name(metadata)
169
- _check_metadata_measurement_interval(metadata)
170
- check_metadata_reader(metadata)
171
-
172
-
173
151
  #### --------------------------------------------------------------------------.
174
- #### Metadata Archive Missing Information
152
+ #### Geolocation Checks
175
153
 
176
154
 
177
155
  def _check_lonlat_type(longitude, latitude):
@@ -185,16 +163,18 @@ def _check_lonlat_type(longitude, latitude):
185
163
  raise ValueError("Unspecified longitude and latitude coordinates.")
186
164
 
187
165
 
188
- def _check_lonlat_validity(longitude, latitude):
166
+ def _check_lonlat_validity(longitude, latitude, raise_error_if_unknown=True):
189
167
  if longitude == -9999 or latitude == -9999:
190
- raise ValueError("Missing lat lon coordinates (-9999).")
168
+ if raise_error_if_unknown:
169
+ raise ValueError("Missing lat lon coordinates (-9999).")
170
+ return
191
171
  if longitude > 180 or longitude < -180:
192
172
  raise ValueError("Invalid longitude (outside [-180, 180])")
193
173
  if latitude > 90 or latitude < -90:
194
174
  raise ValueError("Invalid latitude (outside [-90, 90])")
195
175
 
196
176
 
197
- def check_station_metadata_geolocation(metadata) -> None:
177
+ def check_station_metadata_geolocation(metadata, raise_error_if_unknown=True) -> None:
198
178
  """Identify metadata with missing or wrong geolocation."""
199
179
  # Get longitude, latitude and platform type
200
180
  longitude = metadata.get("longitude")
@@ -209,54 +189,11 @@ def check_station_metadata_geolocation(metadata) -> None:
209
189
  raise ValueError("For mobile platform_type, specify latitude and longitude -9999")
210
190
  # - If fixed platform
211
191
  else:
212
- _check_lonlat_validity(longitude=longitude, latitude=latitude)
213
-
214
-
215
- def identify_missing_metadata_coords(metadata_filepaths: str) -> None:
216
- """Identify missing coordinates.
217
-
218
- Parameters
219
- ----------
220
- metadata_filepaths : str
221
- Input YAML file path.
222
-
223
- Raises
224
- ------
225
- TypeError
226
- Error if ``latitude`` or ``longitude`` coordinates are not present or are wrongly formatted.
227
-
228
- """
229
- for filepath in metadata_filepaths:
230
- metadata = read_yaml(filepath)
231
- check_station_metadata_geolocation(metadata)
232
-
233
-
234
- def identify_empty_metadata_keys(metadata_filepaths: list, keys: Union[str, list]) -> None:
235
- """Identify empty metadata keys.
236
-
237
- Parameters
238
- ----------
239
- metadata_filepaths : str
240
- Input YAML file path.
241
- keys : Union[str,list]
242
- Attributes to verify the presence.
243
- """
244
- if isinstance(keys, str):
245
- keys = [keys]
246
-
247
- for filepath in metadata_filepaths:
248
- for key in keys:
249
- metadata = read_yaml(filepath)
250
- if len(str(metadata.get(key, ""))) == 0: # ensure is string to avoid error
251
- print(f"Empty {key} at: ", filepath)
252
-
253
-
254
- #### --------------------------------------------------------------------------.
255
- #### Check Metadata Archive
192
+ _check_lonlat_validity(longitude=longitude, latitude=latitude, raise_error_if_unknown=raise_error_if_unknown)
256
193
 
257
194
 
258
- def check_metadata_archive_keys(metadata_archive_dir: Optional[str] = None) -> bool:
259
- """Check that all metadata files have valid keys.
195
+ def check_metadata_archive_geolocation(metadata_archive_dir: Optional[str] = None, raise_error_if_unknown=True):
196
+ """Check the metadata files have missing or wrong geolocation..
260
197
 
261
198
  Parameters
262
199
  ----------
@@ -293,17 +230,39 @@ def check_metadata_archive_keys(metadata_archive_dir: Optional[str] = None) -> b
293
230
  station_name=station_name,
294
231
  )
295
232
  try:
296
- _check_metadata_keys(metadata)
233
+ check_station_metadata_geolocation(metadata, raise_error_if_unknown=raise_error_if_unknown)
297
234
  except Exception as e:
298
- print(f"Error for {data_source} {campaign_name} {station_name}.")
299
- print(f"The error is: {e}.")
300
235
  is_valid = False
301
-
236
+ print(f"Missing information for {data_source} {campaign_name} {station_name}.")
237
+ print(f"The error is: {e}.")
302
238
  return is_valid
303
239
 
304
240
 
305
- def check_metadata_archive_campaign_name(metadata_archive_dir: Optional[str] = None) -> bool:
306
- """Check metadata ``campaign_name``.
241
+ ####------------------------------------------------------------------------------------------------------------.
242
+ #### Metadata Station and Archive Checking Routines
243
+ def check_station_metadata(data_source, campaign_name, station_name, metadata_archive_dir=None):
244
+ """Check DISDRODB metadata compliance."""
245
+ from disdrodb.l0.l0_reader import check_metadata_reader
246
+
247
+ metadata = read_station_metadata(
248
+ data_source=data_source,
249
+ campaign_name=campaign_name,
250
+ station_name=station_name,
251
+ metadata_archive_dir=metadata_archive_dir,
252
+ )
253
+ _check_metadata_keys(metadata)
254
+ _check_metadata_values(metadata)
255
+ _check_metadata_campaign_name(metadata, expected_name=campaign_name)
256
+ _check_metadata_data_source(metadata, expected_name=data_source)
257
+ _check_metadata_station_name(metadata, expected_name=station_name)
258
+ _check_metadata_sensor_name(metadata)
259
+ _check_metadata_measurement_interval(metadata)
260
+ check_station_metadata_geolocation(metadata, raise_error_if_unknown=False)
261
+ check_metadata_reader(metadata)
262
+
263
+
264
+ def check_metadata_archive(metadata_archive_dir: Optional[str] = None, raise_error=False):
265
+ """Check the archive metadata compliance.
307
266
 
308
267
  Parameters
309
268
  ----------
@@ -312,6 +271,9 @@ def check_metadata_archive_campaign_name(metadata_archive_dir: Optional[str] = N
312
271
  The directory path must end with ``<...>/DISDRODB``.
313
272
  If ``None``, it uses the ``metadata_archive_dir`` path specified
314
273
  in the DISDRODB active configuration.
274
+ raise_error: bool (optional)
275
+ Whether to raise an error and interrupt the archive check if a
276
+ metadata is not compliant. The default value is ``False``.
315
277
 
316
278
  Returns
317
279
  -------
@@ -332,24 +294,74 @@ def check_metadata_archive_campaign_name(metadata_archive_dir: Optional[str] = N
332
294
  data_source = infer_data_source_from_path(filepath)
333
295
  campaign_name = infer_campaign_name_from_path(filepath)
334
296
  station_name = os.path.basename(filepath).replace(".yml", "")
335
-
336
- metadata = read_station_metadata(
337
- metadata_archive_dir=metadata_archive_dir,
338
- data_source=data_source,
339
- campaign_name=campaign_name,
340
- station_name=station_name,
341
- )
297
+ # Check compliance
342
298
  try:
343
- _check_metadata_campaign_name(metadata, expected_name=campaign_name)
299
+ check_station_metadata(
300
+ metadata_archive_dir=metadata_archive_dir,
301
+ data_source=data_source,
302
+ campaign_name=campaign_name,
303
+ station_name=station_name,
304
+ )
344
305
  except Exception as e:
345
306
  is_valid = False
346
- print(f"Error for {data_source} {campaign_name} {station_name}.")
347
- print(f"The error is: {e}.")
307
+ msg = f"Error for {data_source} {campaign_name} {station_name}."
308
+ msg = msg + f"The error is: {e}."
309
+ if raise_error:
310
+ raise ValueError(msg)
311
+ print(msg)
312
+
348
313
  return is_valid
349
314
 
350
315
 
351
- def check_metadata_archive_data_source(metadata_archive_dir: Optional[str] = None) -> bool:
352
- """Check metadata ``data_source``.
316
+ ####-----------------------------------------------------------------------------------------------.
317
+ #### Utilities
318
+
319
+
320
+ def identify_missing_metadata_coords(metadata_filepaths: str) -> None:
321
+ """Identify missing coordinates.
322
+
323
+ Parameters
324
+ ----------
325
+ metadata_filepaths : str
326
+ Input YAML file path.
327
+
328
+ Raises
329
+ ------
330
+ TypeError
331
+ Error if ``latitude`` or ``longitude`` coordinates are not present or are wrongly formatted.
332
+
333
+ """
334
+ for filepath in metadata_filepaths:
335
+ metadata = read_yaml(filepath)
336
+ check_station_metadata_geolocation(metadata)
337
+
338
+
339
+ def identify_empty_metadata_keys(metadata_filepaths: list, keys: Union[str, list]) -> None:
340
+ """Identify empty metadata keys.
341
+
342
+ Parameters
343
+ ----------
344
+ metadata_filepaths : str
345
+ Input YAML file path.
346
+ keys : Union[str,list]
347
+ Attributes to verify the presence.
348
+ """
349
+ if isinstance(keys, str):
350
+ keys = [keys]
351
+
352
+ for filepath in metadata_filepaths:
353
+ for key in keys:
354
+ metadata = read_yaml(filepath)
355
+ if len(str(metadata.get(key, ""))) == 0: # ensure is string to avoid error
356
+ print(f"Empty {key} at: ", filepath)
357
+
358
+
359
+ #### --------------------------------------------------------------------------.
360
+ #### Metadata Archive Utilities
361
+
362
+
363
+ def check_metadata_archive_keys(metadata_archive_dir: Optional[str] = None) -> bool:
364
+ """Check that all metadata files have valid keys.
353
365
 
354
366
  Parameters
355
367
  ----------
@@ -386,16 +398,17 @@ def check_metadata_archive_data_source(metadata_archive_dir: Optional[str] = Non
386
398
  station_name=station_name,
387
399
  )
388
400
  try:
389
- _check_metadata_data_source(metadata, expected_name=data_source)
401
+ _check_metadata_keys(metadata)
390
402
  except Exception as e:
391
- is_valid = False
392
403
  print(f"Error for {data_source} {campaign_name} {station_name}.")
393
404
  print(f"The error is: {e}.")
405
+ is_valid = False
406
+
394
407
  return is_valid
395
408
 
396
409
 
397
- def check_metadata_archive_sensor_name(metadata_archive_dir: Optional[str] = None) -> bool:
398
- """Check metadata ``sensor_name``.
410
+ def check_metadata_archive_campaign_name(metadata_archive_dir: Optional[str] = None) -> bool:
411
+ """Check metadata ``campaign_name``.
399
412
 
400
413
  Parameters
401
414
  ----------
@@ -432,7 +445,7 @@ def check_metadata_archive_sensor_name(metadata_archive_dir: Optional[str] = Non
432
445
  station_name=station_name,
433
446
  )
434
447
  try:
435
- _check_metadata_sensor_name(metadata)
448
+ _check_metadata_campaign_name(metadata, expected_name=campaign_name)
436
449
  except Exception as e:
437
450
  is_valid = False
438
451
  print(f"Error for {data_source} {campaign_name} {station_name}.")
@@ -440,8 +453,8 @@ def check_metadata_archive_sensor_name(metadata_archive_dir: Optional[str] = Non
440
453
  return is_valid
441
454
 
442
455
 
443
- def check_metadata_archive_station_name(metadata_archive_dir: Optional[str] = None) -> bool:
444
- """Check metadata ``station_name``.
456
+ def check_metadata_archive_data_source(metadata_archive_dir: Optional[str] = None) -> bool:
457
+ """Check metadata ``data_source``.
445
458
 
446
459
  Parameters
447
460
  ----------
@@ -478,7 +491,7 @@ def check_metadata_archive_station_name(metadata_archive_dir: Optional[str] = No
478
491
  station_name=station_name,
479
492
  )
480
493
  try:
481
- _check_metadata_station_name(metadata, expected_name=station_name)
494
+ _check_metadata_data_source(metadata, expected_name=data_source)
482
495
  except Exception as e:
483
496
  is_valid = False
484
497
  print(f"Error for {data_source} {campaign_name} {station_name}.")
@@ -486,8 +499,8 @@ def check_metadata_archive_station_name(metadata_archive_dir: Optional[str] = No
486
499
  return is_valid
487
500
 
488
501
 
489
- def check_metadata_archive_reader(metadata_archive_dir: Optional[str] = None) -> bool:
490
- """Check if the ``reader`` key is available and there is the associated reader.
502
+ def check_metadata_archive_sensor_name(metadata_archive_dir: Optional[str] = None) -> bool:
503
+ """Check metadata ``sensor_name``.
491
504
 
492
505
  Parameters
493
506
  ----------
@@ -502,8 +515,6 @@ def check_metadata_archive_reader(metadata_archive_dir: Optional[str] = None) ->
502
515
  bool
503
516
  If the check succeeds, the result is ``True``, otherwise ``False``.
504
517
  """
505
- from disdrodb.l0.l0_reader import check_metadata_reader
506
-
507
518
  is_valid = True
508
519
  metadata_archive_dir = get_metadata_archive_dir(metadata_archive_dir)
509
520
  list_metadata_paths = get_list_metadata(
@@ -526,7 +537,7 @@ def check_metadata_archive_reader(metadata_archive_dir: Optional[str] = None) ->
526
537
  station_name=station_name,
527
538
  )
528
539
  try:
529
- check_metadata_reader(metadata)
540
+ _check_metadata_sensor_name(metadata)
530
541
  except Exception as e:
531
542
  is_valid = False
532
543
  print(f"Error for {data_source} {campaign_name} {station_name}.")
@@ -534,8 +545,8 @@ def check_metadata_archive_reader(metadata_archive_dir: Optional[str] = None) ->
534
545
  return is_valid
535
546
 
536
547
 
537
- def check_metadata_archive(metadata_archive_dir: Optional[str] = None, raise_error=False):
538
- """Check the archive metadata compliance.
548
+ def check_metadata_archive_station_name(metadata_archive_dir: Optional[str] = None) -> bool:
549
+ """Check metadata ``station_name``.
539
550
 
540
551
  Parameters
541
552
  ----------
@@ -544,9 +555,6 @@ def check_metadata_archive(metadata_archive_dir: Optional[str] = None, raise_err
544
555
  The directory path must end with ``<...>/DISDRODB``.
545
556
  If ``None``, it uses the ``metadata_archive_dir`` path specified
546
557
  in the DISDRODB active configuration.
547
- raise_error: bool (optional)
548
- Whether to raise an error and interrupt the archive check if a
549
- metadata is not compliant. The default value is ``False``.
550
558
 
551
559
  Returns
552
560
  -------
@@ -567,27 +575,24 @@ def check_metadata_archive(metadata_archive_dir: Optional[str] = None, raise_err
567
575
  data_source = infer_data_source_from_path(filepath)
568
576
  campaign_name = infer_campaign_name_from_path(filepath)
569
577
  station_name = os.path.basename(filepath).replace(".yml", "")
570
- # Check compliance
578
+
579
+ metadata = read_station_metadata(
580
+ metadata_archive_dir=metadata_archive_dir,
581
+ data_source=data_source,
582
+ campaign_name=campaign_name,
583
+ station_name=station_name,
584
+ )
571
585
  try:
572
- check_station_metadata(
573
- metadata_archive_dir=metadata_archive_dir,
574
- data_source=data_source,
575
- campaign_name=campaign_name,
576
- station_name=station_name,
577
- )
586
+ _check_metadata_station_name(metadata, expected_name=station_name)
578
587
  except Exception as e:
579
588
  is_valid = False
580
- msg = f"Error for {data_source} {campaign_name} {station_name}."
581
- msg = msg + f"The error is: {e}."
582
- if raise_error:
583
- raise ValueError(msg)
584
- print(msg)
585
-
589
+ print(f"Error for {data_source} {campaign_name} {station_name}.")
590
+ print(f"The error is: {e}.")
586
591
  return is_valid
587
592
 
588
593
 
589
- def check_metadata_archive_geolocation(metadata_archive_dir: Optional[str] = None):
590
- """Check the metadata files have missing or wrong geolocation..
594
+ def check_metadata_archive_reader(metadata_archive_dir: Optional[str] = None) -> bool:
595
+ """Check if the ``reader`` key is available and there is the associated reader.
591
596
 
592
597
  Parameters
593
598
  ----------
@@ -602,6 +607,8 @@ def check_metadata_archive_geolocation(metadata_archive_dir: Optional[str] = Non
602
607
  bool
603
608
  If the check succeeds, the result is ``True``, otherwise ``False``.
604
609
  """
610
+ from disdrodb.l0.l0_reader import check_metadata_reader
611
+
605
612
  is_valid = True
606
613
  metadata_archive_dir = get_metadata_archive_dir(metadata_archive_dir)
607
614
  list_metadata_paths = get_list_metadata(
@@ -624,9 +631,9 @@ def check_metadata_archive_geolocation(metadata_archive_dir: Optional[str] = Non
624
631
  station_name=station_name,
625
632
  )
626
633
  try:
627
- check_station_metadata_geolocation(metadata)
634
+ check_metadata_reader(metadata)
628
635
  except Exception as e:
629
636
  is_valid = False
630
- print(f"Missing information for {data_source} {campaign_name} {station_name}.")
637
+ print(f"Error for {data_source} {campaign_name} {station_name}.")
631
638
  print(f"The error is: {e}.")
632
639
  return is_valid
@@ -24,9 +24,10 @@ the DISDRODB-METADATA repository
24
24
 
25
25
  # Define valid values for specific metadata keys
26
26
  METADATA_VALUES = {
27
+ "raw_data_format": ["txt", "netcdf"],
27
28
  "deployment_status": ["ongoing", "terminated"],
28
- "platform_type": ["fixed", "mobile"],
29
29
  "deployment_mode": ["land", "ship", "truck", "cable"],
30
+ "platform_type": ["fixed", "mobile"],
30
31
  "platform_protection": ["shielded", "unshielded", ""],
31
32
  }
32
33
 
@@ -70,6 +71,7 @@ METADATA_KEYS = [
70
71
  "history",
71
72
  "comment",
72
73
  "station_id",
74
+ "koppen_geiger",
73
75
  "location",
74
76
  "country",
75
77
  "continent",