disdrodb 0.3.0__py3-none-any.whl → 0.5.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.
Files changed (198) hide show
  1. disdrodb/__init__.py +2 -0
  2. disdrodb/_config.py +1 -0
  3. disdrodb/_version.py +2 -2
  4. disdrodb/accessor/__init__.py +1 -0
  5. disdrodb/accessor/methods.py +1 -0
  6. disdrodb/api/checks.py +2 -4
  7. disdrodb/api/io.py +224 -24
  8. disdrodb/api/path.py +2 -4
  9. disdrodb/cli/disdrodb_check_metadata_archive.py +1 -0
  10. disdrodb/cli/disdrodb_check_products_options.py +1 -0
  11. disdrodb/cli/disdrodb_create_summary.py +6 -6
  12. disdrodb/cli/disdrodb_create_summary_station.py +2 -2
  13. disdrodb/cli/disdrodb_data_archive_directory.py +1 -0
  14. disdrodb/cli/disdrodb_download_archive.py +5 -6
  15. disdrodb/cli/disdrodb_download_metadata_archive.py +1 -0
  16. disdrodb/cli/disdrodb_download_station.py +2 -3
  17. disdrodb/cli/disdrodb_initialize_station.py +3 -3
  18. disdrodb/cli/disdrodb_metadata_archive_directory.py +1 -0
  19. disdrodb/cli/disdrodb_open_data_archive.py +1 -2
  20. disdrodb/cli/disdrodb_open_logs_directory.py +2 -3
  21. disdrodb/cli/disdrodb_open_metadata_archive.py +1 -2
  22. disdrodb/cli/disdrodb_open_metadata_directory.py +2 -3
  23. disdrodb/cli/disdrodb_open_product_directory.py +1 -2
  24. disdrodb/cli/disdrodb_open_readers_directory.py +1 -0
  25. disdrodb/cli/disdrodb_run.py +6 -6
  26. disdrodb/cli/disdrodb_run_l0.py +6 -6
  27. disdrodb/cli/disdrodb_run_l0_station.py +3 -3
  28. disdrodb/cli/disdrodb_run_l0a.py +6 -6
  29. disdrodb/cli/disdrodb_run_l0a_station.py +3 -3
  30. disdrodb/cli/disdrodb_run_l0b.py +6 -6
  31. disdrodb/cli/disdrodb_run_l0b_station.py +3 -3
  32. disdrodb/cli/disdrodb_run_l0c.py +6 -6
  33. disdrodb/cli/disdrodb_run_l0c_station.py +3 -3
  34. disdrodb/cli/disdrodb_run_l1.py +6 -6
  35. disdrodb/cli/disdrodb_run_l1_station.py +3 -3
  36. disdrodb/cli/disdrodb_run_l2e.py +6 -6
  37. disdrodb/cli/disdrodb_run_l2e_station.py +3 -3
  38. disdrodb/cli/disdrodb_run_l2m.py +6 -6
  39. disdrodb/cli/disdrodb_run_l2m_station.py +3 -3
  40. disdrodb/cli/disdrodb_run_station.py +3 -3
  41. disdrodb/cli/disdrodb_upload_archive.py +6 -7
  42. disdrodb/cli/disdrodb_upload_station.py +3 -4
  43. disdrodb/configs.py +7 -8
  44. disdrodb/constants.py +1 -0
  45. disdrodb/data_transfer/download_data.py +8 -8
  46. disdrodb/data_transfer/upload_data.py +6 -8
  47. disdrodb/data_transfer/zenodo.py +1 -1
  48. disdrodb/fall_velocity/__init__.py +1 -0
  49. disdrodb/fall_velocity/graupel.py +1 -0
  50. disdrodb/fall_velocity/hail.py +1 -0
  51. disdrodb/fall_velocity/rain.py +1 -0
  52. disdrodb/issue/checks.py +1 -0
  53. disdrodb/issue/reader.py +1 -0
  54. disdrodb/issue/writer.py +1 -2
  55. disdrodb/l0/__init__.py +1 -0
  56. disdrodb/l0/check_configs.py +21 -23
  57. disdrodb/l0/check_standards.py +0 -1
  58. disdrodb/l0/configs/LPM/l0a_encodings.yml +17 -17
  59. disdrodb/l0/configs/LPM/l0b_cf_attrs.yml +55 -55
  60. disdrodb/l0/configs/LPM/l0b_encodings.yml +17 -17
  61. disdrodb/l0/configs/LPM/raw_data_format.yml +17 -17
  62. disdrodb/l0/configs/LPM_V0/l0a_encodings.yml +2 -2
  63. disdrodb/l0/configs/LPM_V0/l0b_cf_attrs.yml +2 -2
  64. disdrodb/l0/configs/LPM_V0/l0b_encodings.yml +2 -2
  65. disdrodb/l0/configs/LPM_V0/raw_data_format.yml +2 -2
  66. disdrodb/l0/l0_reader.py +1 -0
  67. disdrodb/l0/l0a_processing.py +5 -5
  68. disdrodb/l0/l0b_nc_processing.py +1 -2
  69. disdrodb/l0/l0b_processing.py +1 -13
  70. disdrodb/l0/l0c_processing.py +2 -1
  71. disdrodb/l0/readers/LPM/ARM/ARM_LPM.py +1 -0
  72. disdrodb/l0/readers/LPM/AUSTRALIA/MELBOURNE_2007_LPM.py +17 -17
  73. disdrodb/l0/readers/LPM/BRAZIL/CHUVA_LPM.py +17 -17
  74. disdrodb/l0/readers/LPM/BRAZIL/GOAMAZON_LPM.py +17 -17
  75. disdrodb/l0/readers/LPM/GERMANY/DWD.py +55 -52
  76. disdrodb/l0/readers/LPM/ITALY/GID_LPM.py +18 -17
  77. disdrodb/l0/readers/LPM/ITALY/GID_LPM_AQ.py +277 -0
  78. disdrodb/l0/readers/LPM/ITALY/GID_LPM_PI.py +18 -17
  79. disdrodb/l0/readers/LPM/ITALY/GID_LPM_T.py +18 -17
  80. disdrodb/l0/readers/LPM/ITALY/GID_LPM_W.py +18 -18
  81. disdrodb/l0/readers/LPM/KIT/CHWALA.py +18 -17
  82. disdrodb/l0/readers/LPM/NETHERLANDS/DELFT_RWANDA_LPM_NC.py +17 -17
  83. disdrodb/l0/readers/LPM/NORWAY/HAUKELISETER_LPM.py +18 -17
  84. disdrodb/l0/readers/LPM/NORWAY/NMBU_LPM.py +18 -17
  85. disdrodb/l0/readers/LPM/SLOVENIA/ARSO.py +18 -17
  86. disdrodb/l0/readers/LPM/SLOVENIA/UL.py +18 -17
  87. disdrodb/l0/readers/LPM/SWITZERLAND/INNERERIZ_LPM.py +18 -17
  88. disdrodb/l0/readers/LPM/UK/WITHWORTH_LPM.py +18 -17
  89. disdrodb/l0/readers/LPM/USA/CHARLESTON.py +18 -17
  90. disdrodb/l0/readers/LPM/USA/DEVEX.py +255 -0
  91. disdrodb/l0/readers/LPM_V0/BELGIUM/ULIEGE.py +2 -2
  92. disdrodb/l0/readers/LPM_V0/ITALY/GID_LPM_V0.py +3 -2
  93. disdrodb/l0/readers/ODM470/OCEAN/OCEANRAIN.py +1 -0
  94. disdrodb/l0/readers/PARSIVEL/BASQUECOUNTRY/EUSKALMET_OTT.py +1 -0
  95. disdrodb/l0/readers/PARSIVEL/CHINA/CHONGQING.py +1 -0
  96. disdrodb/l0/readers/PARSIVEL/EPFL/ARCTIC_2021.py +1 -0
  97. disdrodb/l0/readers/PARSIVEL/EPFL/COMMON_2011.py +1 -0
  98. disdrodb/l0/readers/PARSIVEL/EPFL/DAVOS_2009_2011.py +1 -0
  99. disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_2009.py +1 -0
  100. disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2008.py +1 -0
  101. disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2010.py +1 -0
  102. disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2011.py +1 -0
  103. disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2012.py +1 -0
  104. disdrodb/l0/readers/PARSIVEL/EPFL/GENEPI_2007.py +1 -0
  105. disdrodb/l0/readers/PARSIVEL/EPFL/GRAND_ST_BERNARD_2007.py +1 -0
  106. disdrodb/l0/readers/PARSIVEL/EPFL/GRAND_ST_BERNARD_2007_2.py +1 -0
  107. disdrodb/l0/readers/PARSIVEL/EPFL/HPICONET_2010.py +1 -0
  108. disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP2.py +1 -0
  109. disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP3.py +1 -0
  110. disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP4.py +1 -0
  111. disdrodb/l0/readers/PARSIVEL/EPFL/PARADISO_2014.py +1 -0
  112. disdrodb/l0/readers/PARSIVEL/EPFL/PARSIVEL_2007.py +1 -0
  113. disdrodb/l0/readers/PARSIVEL/EPFL/RACLETS_2019.py +1 -0
  114. disdrodb/l0/readers/PARSIVEL/EPFL/RACLETS_2019_WJF.py +1 -0
  115. disdrodb/l0/readers/PARSIVEL/EPFL/RIETHOLZBACH_2011.py +1 -0
  116. disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2017.py +1 -0
  117. disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2019.py +1 -0
  118. disdrodb/l0/readers/PARSIVEL/EPFL/UNIL_2022.py +1 -0
  119. disdrodb/l0/readers/PARSIVEL/SLOVENIA/UL.py +1 -0
  120. disdrodb/l0/readers/PARSIVEL2/ARM/ARM_PARSIVEL2.py +1 -0
  121. disdrodb/l0/readers/PARSIVEL2/BASQUECOUNTRY/EUSKALMET_OTT2.py +1 -0
  122. disdrodb/l0/readers/PARSIVEL2/BELGIUM/ILVO.py +1 -0
  123. disdrodb/l0/readers/PARSIVEL2/DENMARK/EROSION_nc.py +1 -0
  124. disdrodb/l0/readers/PARSIVEL2/DENMARK/EROSION_raw.py +1 -0
  125. disdrodb/l0/readers/PARSIVEL2/FRANCE/ENPC_PARSIVEL2.py +1 -0
  126. disdrodb/l0/readers/PARSIVEL2/FRANCE/OSUG.py +1 -1
  127. disdrodb/l0/readers/PARSIVEL2/ITALY/HYDROX.py +1 -0
  128. disdrodb/l0/readers/PARSIVEL2/MEXICO/OH_IIUNAM_nc.py +1 -0
  129. disdrodb/l0/readers/PARSIVEL2/NCAR/FARM_PARSIVEL2.py +1 -0
  130. disdrodb/l0/readers/PARSIVEL2/NCAR/PERILS_MIPS.py +1 -0
  131. disdrodb/l0/readers/PARSIVEL2/NCAR/PERILS_PIPS.py +1 -0
  132. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_P1.py +1 -0
  133. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_PIPS.py +1 -0
  134. disdrodb/l0/readers/PARSIVEL2/PHILIPPINES/PAGASA.py +1 -0
  135. disdrodb/l0/readers/PARSIVEL2/SPAIN/GRANADA.py +1 -0
  136. disdrodb/l0/readers/PARSIVEL2/SWEDEN/SMHI.py +1 -0
  137. disdrodb/l0/readers/PARSIVEL2/USA/CW3E.py +1 -0
  138. disdrodb/l0/readers/PWS100/AUSTRIA/HOAL.py +1 -0
  139. disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100.py +1 -0
  140. disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100_SIRTA.py +1 -0
  141. disdrodb/l0/readers/RD80/NOAA/PSL_RD80.py +1 -0
  142. disdrodb/l0/readers/SWS250/BELGIUM/KMI.py +1 -0
  143. disdrodb/l0/readers/template_reader_raw_netcdf_data.py +1 -0
  144. disdrodb/l0/readers/template_reader_raw_text_data.py +1 -0
  145. disdrodb/l0/template_tools.py +6 -8
  146. disdrodb/l1/__init__.py +1 -0
  147. disdrodb/l1/classification.py +1 -0
  148. disdrodb/l1/resampling.py +5 -0
  149. disdrodb/l1_env/routines.py +1 -0
  150. disdrodb/l2/__init__.py +1 -0
  151. disdrodb/l2/empirical_dsd.py +1 -0
  152. disdrodb/l2/processing.py +1 -0
  153. disdrodb/metadata/checks.py +9 -10
  154. disdrodb/metadata/download.py +1 -0
  155. disdrodb/metadata/geolocation.py +2 -1
  156. disdrodb/metadata/info.py +2 -2
  157. disdrodb/metadata/search.py +0 -1
  158. disdrodb/physics/atmosphere.py +1 -0
  159. disdrodb/physics/water.py +1 -0
  160. disdrodb/physics/wrappers.py +1 -0
  161. disdrodb/psd/__init__.py +0 -1
  162. disdrodb/psd/fitting.py +1 -0
  163. disdrodb/psd/models.py +1 -0
  164. disdrodb/routines/__init__.py +1 -0
  165. disdrodb/routines/l0.py +13 -9
  166. disdrodb/routines/l1.py +17 -12
  167. disdrodb/routines/l2.py +4 -5
  168. disdrodb/routines/options.py +1 -0
  169. disdrodb/routines/options_validation.py +12 -12
  170. disdrodb/routines/wrappers.py +33 -33
  171. disdrodb/scattering/__init__.py +0 -1
  172. disdrodb/scattering/permittivity.py +1 -0
  173. disdrodb/scattering/routines.py +3 -3
  174. disdrodb/summary/routines.py +12 -5
  175. disdrodb/utils/archiving.py +2 -1
  176. disdrodb/utils/attrs.py +3 -2
  177. disdrodb/utils/compression.py +1 -2
  178. disdrodb/utils/coords.py +45 -0
  179. disdrodb/utils/dask.py +5 -2
  180. disdrodb/utils/dataframe.py +4 -3
  181. disdrodb/utils/decorators.py +2 -1
  182. disdrodb/utils/directories.py +2 -2
  183. disdrodb/utils/encoding.py +2 -1
  184. disdrodb/utils/manipulations.py +1 -0
  185. disdrodb/utils/pydantic.py +1 -0
  186. disdrodb/utils/routines.py +1 -0
  187. disdrodb/utils/time.py +3 -2
  188. disdrodb/utils/warnings.py +1 -0
  189. disdrodb/utils/writer.py +4 -0
  190. disdrodb/utils/xarray.py +1 -0
  191. disdrodb/viz/plots.py +1 -0
  192. {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/METADATA +4 -3
  193. disdrodb-0.5.0.dist-info/RECORD +361 -0
  194. {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/WHEEL +1 -1
  195. disdrodb-0.3.0.dist-info/RECORD +0 -358
  196. {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/entry_points.txt +0 -0
  197. {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/licenses/LICENSE +0 -0
  198. {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,45 @@
1
+ # -----------------------------------------------------------------------------.
2
+ # Copyright (c) 2021-2026 DISDRODB developers
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ # -----------------------------------------------------------------------------.
17
+ """DISDRODB coordinates utilities."""
18
+
19
+
20
+ def add_dataset_crs_coords(xr_obj):
21
+ """Add a CF-compliant CRS (WGS84) to an xarray.Dataset."""
22
+ import xarray as xr
23
+
24
+ crs_wkt = (
25
+ 'GEOGCRS["WGS 84",'
26
+ 'DATUM["World Geodetic System 1984",'
27
+ 'ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]]],'
28
+ 'PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]],'
29
+ "CS[ellipsoidal,2],"
30
+ 'AXIS["geodetic latitude",north, ANGLEUNIT["degree",0.0174532925199433]],'
31
+ 'AXIS["geodetic longitude",east, ANGLEUNIT["degree",0.0174532925199433]],'
32
+ 'UNIT["degree",0.0174532925199433]'
33
+ )
34
+ da_crs = xr.DataArray(
35
+ 0,
36
+ attrs={
37
+ "grid_mapping_name": "latitude_longitude",
38
+ "crs_wkt": crs_wkt,
39
+ "epsg_code": "EPSG:4326",
40
+ "semi_major_axis": 6378137.0,
41
+ "inverse_flattening": 298.257223563,
42
+ "longitude_of_prime_meridian": 0.0,
43
+ },
44
+ )
45
+ return xr_obj.assign_coords({"crs": da_crs})
disdrodb/utils/dask.py CHANGED
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """Utilities for Dask Distributed Computations."""
18
+
18
19
  import logging
19
20
  import os
20
21
 
@@ -28,9 +29,9 @@ def check_parallel_validity(parallel):
28
29
  scheduler = dask.config.get("scheduler", None)
29
30
  if scheduler is None:
30
31
  return parallel
31
- if scheduler in ["synchronous", "threads"]:
32
+ if scheduler in ["synchronous", "threads", "single-threaded"]:
32
33
  return False
33
- if scheduler == "distributed":
34
+ if scheduler in ["distributed", "dask.distributed"]:
34
35
  from dask.distributed import default_client
35
36
 
36
37
  client = default_client()
@@ -60,6 +61,8 @@ def initialize_dask_cluster(minimum_memory=None):
60
61
  import psutil
61
62
 
62
63
  # Silence dask warnings
64
+ # dask.config.set({'distributed.worker.multiprocessing-method': 'forkserver'})
65
+ # dask.config.set({"distributed.worker.multiprocessing-method": "spawn"})
63
66
  # dask.config.set({"logging.distributed": "error"})
64
67
  # Import dask.distributed after setting the config
65
68
  from dask.distributed import Client, LocalCluster
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """Dataframe utilities."""
18
+
18
19
  import numpy as np
19
20
  import pandas as pd
20
21
 
@@ -207,7 +208,7 @@ def compute_1d_histogram(df, column, variables=None, bins=10, labels=None, prefi
207
208
 
208
209
  # Reset index and add coordinates/labels
209
210
  df_stats = df_stats.reset_index()
210
- df_stats[f"{column}"] = pd.Categorical(df_stats[f"{column}_binned"].map(dict(zip(intervals, coords, strict=False))))
211
+ df_stats[f"{column}"] = pd.Categorical(df_stats[f"{column}_binned"].map(dict(zip(intervals, coords, strict=True))))
211
212
  df_stats = df_stats.drop(columns=f"{column}_binned")
212
213
 
213
214
  return df_stats
@@ -373,8 +374,8 @@ def compute_2d_histogram(
373
374
 
374
375
  # Reset index and set new coordinates
375
376
  df_stats = df_stats.reset_index()
376
- df_stats[f"{x}"] = pd.Categorical(df_stats[f"{x}_binned"].map(dict(zip(x_intervals, x_coords, strict=False))))
377
- df_stats[f"{y}"] = pd.Categorical(df_stats[f"{y}_binned"].map(dict(zip(y_intervals, y_coords, strict=False))))
377
+ df_stats[f"{x}"] = pd.Categorical(df_stats[f"{x}_binned"].map(dict(zip(x_intervals, x_coords, strict=True))))
378
+ df_stats[f"{y}"] = pd.Categorical(df_stats[f"{y}_binned"].map(dict(zip(y_intervals, y_coords, strict=True))))
378
379
 
379
380
  # Set new MultiIndex with coordinates
380
381
  df_stats = df_stats.set_index([f"{x}", f"{y}"])
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """DISDRODB decorators."""
18
+
18
19
  import functools
19
20
  import importlib
20
21
  import uuid
@@ -84,7 +85,7 @@ def single_threaded_if_parallel(function):
84
85
  if parallel:
85
86
  # Call function with single thread
86
87
  # with dask.config.set(scheduler='single-threaded'):
87
- with dask.config.set(scheduler="synchronous"):
88
+ with dask.config.set(scheduler="single-threaded"): # "synchronous"
88
89
  result = function(*args, **kwargs)
89
90
  else:
90
91
  # Else run the function as usual
@@ -15,13 +15,13 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """Define utilities for Directory/File Checks/Creation/Deletion."""
18
+
18
19
  import glob
19
20
  import logging
20
21
  import os
21
22
  import pathlib
22
23
  import shutil
23
24
  import subprocess
24
- from typing import Union
25
25
 
26
26
  from disdrodb.utils.list import flatten_list
27
27
  from disdrodb.utils.logger import log_info
@@ -79,7 +79,7 @@ def check_glob_pattern(pattern: str) -> None:
79
79
  return pattern
80
80
 
81
81
 
82
- def check_glob_patterns(patterns: Union[str, list]) -> list:
82
+ def check_glob_patterns(patterns: str | list) -> list:
83
83
  """Check if glob patterns are valids."""
84
84
  if not isinstance(patterns, (str, list)):
85
85
  raise ValueError("'glob_patterns' must be a str or list of strings.")
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """DISDRODB netCDF4 encoding utilities."""
18
+
18
19
  import os
19
20
 
20
21
  import numpy as np
@@ -126,7 +127,7 @@ def rechunk_dataset(ds: xr.Dataset, encodings_dict: dict) -> xr.Dataset:
126
127
  chunks = encodings_dict[var].get("chunksizes", None) # .pop("chunksizes", None)
127
128
  if chunks is not None:
128
129
  dims = list(ds[var].dims)
129
- chunks_dict = dict(zip(dims, chunks))
130
+ chunks_dict = dict(zip(dims, chunks, strict=True))
130
131
  ds[var] = ds[var].chunk(chunks_dict)
131
132
  ds[var].encoding["chunksizes"] = chunks
132
133
  return ds
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """Include functions helping for DISDRODB product manipulations."""
18
+
18
19
  import numpy as np
19
20
  import xarray as xr
20
21
 
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """Definition of pydantic validation custom class."""
18
+
18
19
  from pydantic import BaseModel, ConfigDict, ValidationError
19
20
 
20
21
 
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """Utilities for DISDRODB processing routines."""
18
+
18
19
  import os
19
20
  import shutil
20
21
  import tempfile
disdrodb/utils/time.py CHANGED
@@ -15,10 +15,10 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """This module contains utilities related to the processing of temporal dataset."""
18
+
18
19
  import logging
19
20
  import numbers
20
21
  import re
21
- from typing import Optional
22
22
 
23
23
  import numpy as np
24
24
  import pandas as pd
@@ -233,7 +233,7 @@ def regularize_dataset(
233
233
  xr_obj,
234
234
  freq: str,
235
235
  time_dim: str = "time",
236
- method: Optional[str] = None,
236
+ method: str | None = None,
237
237
  fill_value=None,
238
238
  start_time=None,
239
239
  end_time=None,
@@ -484,6 +484,7 @@ def infer_sample_interval(ds, robust=False, verbose=False, logger=None):
484
484
  unexpected_intervals,
485
485
  unexpected_intervals_counts,
486
486
  unexpected_intervals_fractions,
487
+ strict=True,
487
488
  ):
488
489
  msg = f"--> Interval: {interval} seconds, Occurrence: {count}, Frequency: {fraction} %"
489
490
  log_info(logger=logger, msg=msg, verbose=verbose)
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """Warning utilities."""
18
+
18
19
  import warnings
19
20
  from contextlib import contextmanager
20
21
 
disdrodb/utils/writer.py CHANGED
@@ -21,6 +21,7 @@ import os
21
21
  import xarray as xr
22
22
 
23
23
  from disdrodb.utils.attrs import get_attrs_dict, set_attrs, set_disdrodb_attrs
24
+ from disdrodb.utils.coords import add_dataset_crs_coords
24
25
  from disdrodb.utils.directories import create_directory, remove_if_exists
25
26
  from disdrodb.utils.encoding import get_encodings_dict, set_encodings
26
27
 
@@ -35,6 +36,9 @@ def finalize_product(ds, product=None) -> xr.Dataset:
35
36
  encodings_dict = get_encodings_dict()
36
37
  ds = set_encodings(ds, encodings_dict=encodings_dict)
37
38
 
39
+ # Add dataset CRS
40
+ ds = add_dataset_crs_coords(ds)
41
+
38
42
  # Add DISDRODB global attributes
39
43
  # - e.g. in generate_l2_radar it inherit from input dataset !
40
44
  if product is not None:
disdrodb/utils/xarray.py CHANGED
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """Xarray utilities."""
18
+
18
19
  import numpy as np
19
20
  import xarray as xr
20
21
  from xarray.core import dtypes
disdrodb/viz/plots.py CHANGED
@@ -15,6 +15,7 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  # -----------------------------------------------------------------------------.
17
17
  """DISDRODB Plotting Tools."""
18
+
18
19
  import matplotlib.pyplot as plt
19
20
  import numpy as np
20
21
  import pandas as pd
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: disdrodb
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: disdrodb provides tools to download, standardize, share and analyze global disdrometer data.
5
5
  Author: Gionata Ghiggi
6
6
  Project-URL: homepage, https://github.com/ltelab/disdrodb
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Operating System :: Unix
17
17
  Classifier: Operating System :: MacOS :: MacOS X
18
18
  Classifier: Operating System :: Microsoft :: Windows
19
- Requires-Python: >=3.9
19
+ Requires-Python: >=3.11
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: click
@@ -34,6 +34,7 @@ Requires-Dist: scipy
34
34
  Requires-Dist: dask[distributed]
35
35
  Requires-Dist: xarray
36
36
  Requires-Dist: bottleneck
37
+ Requires-Dist: flox
37
38
  Requires-Dist: matplotlib
38
39
  Provides-Extra: dev
39
40
  Requires-Dist: jupyter; extra == "dev"
@@ -55,7 +56,7 @@ Dynamic: license-file
55
56
  | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
56
57
  | Deployment | [![PyPI](https://badge.fury.io/py/disdrodb.svg?style=flat)](https://pypi.org/project/disdrodb/) [![Conda](https://img.shields.io/conda/vn/conda-forge/disdrodb.svg?logo=conda-forge&logoColor=white&style=flat)](https://anaconda.org/conda-forge/disdrodb) |
57
58
  | Activity | [![PyPI Downloads](https://img.shields.io/pypi/dm/disdrodb.svg?label=PyPI%20downloads&style=flat)](https://pypi.org/project/disdrodb/) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/disdrodb.svg?label=Conda%20downloads&style=flat)](https://anaconda.org/conda-forge/disdrodb) |
58
- | Python Versions | [![Python Versions](https://img.shields.io/badge/Python-3.10%20%203.11%20%203.12-blue?style=flat)](https://www.python.org/downloads/) |
59
+ | Python Versions | [![Python Versions](https://img.shields.io/badge/Python-3.11%20%203.12%20%203.13%20%203.14-blue?style=flat)](https://www.python.org/downloads/) |
59
60
  | Supported Systems | [![Linux](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests.yml?label=Linux&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [![macOS](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests.yml?label=macOS&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [![Windows](https://img.shields.io/github/actions/workflow/status/ltelab/disdrodb/.github/workflows/tests_windows.yml?label=Windows&style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests_windows.yml) |
60
61
  | Project Status | [![Project Status](https://www.repostatus.org/badges/latest/active.svg?style=flat)](https://www.repostatus.org/#active) |
61
62
  | Build Status | [![Tests](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml/badge.svg?style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [![Lint](https://github.com/ltelab/disdrodb/actions/workflows/lint.yml/badge.svg?style=flat)](https://github.com/ltelab/disdrodb/actions/workflows/lint.yml) [![Docs](https://readthedocs.org/projects/disdrodb/badge/?version=latest&style=flat)](https://disdrodb.readthedocs.io/en/latest/) |