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.
- disdrodb/__init__.py +2 -0
- disdrodb/_config.py +1 -0
- disdrodb/_version.py +2 -2
- disdrodb/accessor/__init__.py +1 -0
- disdrodb/accessor/methods.py +1 -0
- disdrodb/api/checks.py +2 -4
- disdrodb/api/io.py +224 -24
- disdrodb/api/path.py +2 -4
- disdrodb/cli/disdrodb_check_metadata_archive.py +1 -0
- disdrodb/cli/disdrodb_check_products_options.py +1 -0
- disdrodb/cli/disdrodb_create_summary.py +6 -6
- disdrodb/cli/disdrodb_create_summary_station.py +2 -2
- disdrodb/cli/disdrodb_data_archive_directory.py +1 -0
- disdrodb/cli/disdrodb_download_archive.py +5 -6
- disdrodb/cli/disdrodb_download_metadata_archive.py +1 -0
- disdrodb/cli/disdrodb_download_station.py +2 -3
- disdrodb/cli/disdrodb_initialize_station.py +3 -3
- disdrodb/cli/disdrodb_metadata_archive_directory.py +1 -0
- disdrodb/cli/disdrodb_open_data_archive.py +1 -2
- disdrodb/cli/disdrodb_open_logs_directory.py +2 -3
- disdrodb/cli/disdrodb_open_metadata_archive.py +1 -2
- disdrodb/cli/disdrodb_open_metadata_directory.py +2 -3
- disdrodb/cli/disdrodb_open_product_directory.py +1 -2
- disdrodb/cli/disdrodb_open_readers_directory.py +1 -0
- disdrodb/cli/disdrodb_run.py +6 -6
- disdrodb/cli/disdrodb_run_l0.py +6 -6
- disdrodb/cli/disdrodb_run_l0_station.py +3 -3
- disdrodb/cli/disdrodb_run_l0a.py +6 -6
- disdrodb/cli/disdrodb_run_l0a_station.py +3 -3
- disdrodb/cli/disdrodb_run_l0b.py +6 -6
- disdrodb/cli/disdrodb_run_l0b_station.py +3 -3
- disdrodb/cli/disdrodb_run_l0c.py +6 -6
- disdrodb/cli/disdrodb_run_l0c_station.py +3 -3
- disdrodb/cli/disdrodb_run_l1.py +6 -6
- disdrodb/cli/disdrodb_run_l1_station.py +3 -3
- disdrodb/cli/disdrodb_run_l2e.py +6 -6
- disdrodb/cli/disdrodb_run_l2e_station.py +3 -3
- disdrodb/cli/disdrodb_run_l2m.py +6 -6
- disdrodb/cli/disdrodb_run_l2m_station.py +3 -3
- disdrodb/cli/disdrodb_run_station.py +3 -3
- disdrodb/cli/disdrodb_upload_archive.py +6 -7
- disdrodb/cli/disdrodb_upload_station.py +3 -4
- disdrodb/configs.py +7 -8
- disdrodb/constants.py +1 -0
- disdrodb/data_transfer/download_data.py +8 -8
- disdrodb/data_transfer/upload_data.py +6 -8
- disdrodb/data_transfer/zenodo.py +1 -1
- disdrodb/fall_velocity/__init__.py +1 -0
- disdrodb/fall_velocity/graupel.py +1 -0
- disdrodb/fall_velocity/hail.py +1 -0
- disdrodb/fall_velocity/rain.py +1 -0
- disdrodb/issue/checks.py +1 -0
- disdrodb/issue/reader.py +1 -0
- disdrodb/issue/writer.py +1 -2
- disdrodb/l0/__init__.py +1 -0
- disdrodb/l0/check_configs.py +21 -23
- disdrodb/l0/check_standards.py +0 -1
- disdrodb/l0/configs/LPM/l0a_encodings.yml +17 -17
- disdrodb/l0/configs/LPM/l0b_cf_attrs.yml +55 -55
- disdrodb/l0/configs/LPM/l0b_encodings.yml +17 -17
- disdrodb/l0/configs/LPM/raw_data_format.yml +17 -17
- disdrodb/l0/configs/LPM_V0/l0a_encodings.yml +2 -2
- disdrodb/l0/configs/LPM_V0/l0b_cf_attrs.yml +2 -2
- disdrodb/l0/configs/LPM_V0/l0b_encodings.yml +2 -2
- disdrodb/l0/configs/LPM_V0/raw_data_format.yml +2 -2
- disdrodb/l0/l0_reader.py +1 -0
- disdrodb/l0/l0a_processing.py +5 -5
- disdrodb/l0/l0b_nc_processing.py +1 -2
- disdrodb/l0/l0b_processing.py +1 -13
- disdrodb/l0/l0c_processing.py +2 -1
- disdrodb/l0/readers/LPM/ARM/ARM_LPM.py +1 -0
- disdrodb/l0/readers/LPM/AUSTRALIA/MELBOURNE_2007_LPM.py +17 -17
- disdrodb/l0/readers/LPM/BRAZIL/CHUVA_LPM.py +17 -17
- disdrodb/l0/readers/LPM/BRAZIL/GOAMAZON_LPM.py +17 -17
- disdrodb/l0/readers/LPM/GERMANY/DWD.py +55 -52
- disdrodb/l0/readers/LPM/ITALY/GID_LPM.py +18 -17
- disdrodb/l0/readers/LPM/ITALY/GID_LPM_AQ.py +277 -0
- disdrodb/l0/readers/LPM/ITALY/GID_LPM_PI.py +18 -17
- disdrodb/l0/readers/LPM/ITALY/GID_LPM_T.py +18 -17
- disdrodb/l0/readers/LPM/ITALY/GID_LPM_W.py +18 -18
- disdrodb/l0/readers/LPM/KIT/CHWALA.py +18 -17
- disdrodb/l0/readers/LPM/NETHERLANDS/DELFT_RWANDA_LPM_NC.py +17 -17
- disdrodb/l0/readers/LPM/NORWAY/HAUKELISETER_LPM.py +18 -17
- disdrodb/l0/readers/LPM/NORWAY/NMBU_LPM.py +18 -17
- disdrodb/l0/readers/LPM/SLOVENIA/ARSO.py +18 -17
- disdrodb/l0/readers/LPM/SLOVENIA/UL.py +18 -17
- disdrodb/l0/readers/LPM/SWITZERLAND/INNERERIZ_LPM.py +18 -17
- disdrodb/l0/readers/LPM/UK/WITHWORTH_LPM.py +18 -17
- disdrodb/l0/readers/LPM/USA/CHARLESTON.py +18 -17
- disdrodb/l0/readers/LPM/USA/DEVEX.py +255 -0
- disdrodb/l0/readers/LPM_V0/BELGIUM/ULIEGE.py +2 -2
- disdrodb/l0/readers/LPM_V0/ITALY/GID_LPM_V0.py +3 -2
- disdrodb/l0/readers/ODM470/OCEAN/OCEANRAIN.py +1 -0
- disdrodb/l0/readers/PARSIVEL/BASQUECOUNTRY/EUSKALMET_OTT.py +1 -0
- disdrodb/l0/readers/PARSIVEL/CHINA/CHONGQING.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/ARCTIC_2021.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/COMMON_2011.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/DAVOS_2009_2011.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_2009.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2008.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2010.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2011.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2012.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/GENEPI_2007.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/GRAND_ST_BERNARD_2007.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/GRAND_ST_BERNARD_2007_2.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/HPICONET_2010.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP2.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP3.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP4.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/PARADISO_2014.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/PARSIVEL_2007.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/RACLETS_2019.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/RACLETS_2019_WJF.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/RIETHOLZBACH_2011.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2017.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2019.py +1 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/UNIL_2022.py +1 -0
- disdrodb/l0/readers/PARSIVEL/SLOVENIA/UL.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/ARM/ARM_PARSIVEL2.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/BASQUECOUNTRY/EUSKALMET_OTT2.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/BELGIUM/ILVO.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/DENMARK/EROSION_nc.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/DENMARK/EROSION_raw.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/FRANCE/ENPC_PARSIVEL2.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/FRANCE/OSUG.py +1 -1
- disdrodb/l0/readers/PARSIVEL2/ITALY/HYDROX.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/MEXICO/OH_IIUNAM_nc.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/FARM_PARSIVEL2.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/PERILS_MIPS.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/PERILS_PIPS.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_P1.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_PIPS.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/PHILIPPINES/PAGASA.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/SPAIN/GRANADA.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/SWEDEN/SMHI.py +1 -0
- disdrodb/l0/readers/PARSIVEL2/USA/CW3E.py +1 -0
- disdrodb/l0/readers/PWS100/AUSTRIA/HOAL.py +1 -0
- disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100.py +1 -0
- disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100_SIRTA.py +1 -0
- disdrodb/l0/readers/RD80/NOAA/PSL_RD80.py +1 -0
- disdrodb/l0/readers/SWS250/BELGIUM/KMI.py +1 -0
- disdrodb/l0/readers/template_reader_raw_netcdf_data.py +1 -0
- disdrodb/l0/readers/template_reader_raw_text_data.py +1 -0
- disdrodb/l0/template_tools.py +6 -8
- disdrodb/l1/__init__.py +1 -0
- disdrodb/l1/classification.py +1 -0
- disdrodb/l1/resampling.py +5 -0
- disdrodb/l1_env/routines.py +1 -0
- disdrodb/l2/__init__.py +1 -0
- disdrodb/l2/empirical_dsd.py +1 -0
- disdrodb/l2/processing.py +1 -0
- disdrodb/metadata/checks.py +9 -10
- disdrodb/metadata/download.py +1 -0
- disdrodb/metadata/geolocation.py +2 -1
- disdrodb/metadata/info.py +2 -2
- disdrodb/metadata/search.py +0 -1
- disdrodb/physics/atmosphere.py +1 -0
- disdrodb/physics/water.py +1 -0
- disdrodb/physics/wrappers.py +1 -0
- disdrodb/psd/__init__.py +0 -1
- disdrodb/psd/fitting.py +1 -0
- disdrodb/psd/models.py +1 -0
- disdrodb/routines/__init__.py +1 -0
- disdrodb/routines/l0.py +13 -9
- disdrodb/routines/l1.py +17 -12
- disdrodb/routines/l2.py +4 -5
- disdrodb/routines/options.py +1 -0
- disdrodb/routines/options_validation.py +12 -12
- disdrodb/routines/wrappers.py +33 -33
- disdrodb/scattering/__init__.py +0 -1
- disdrodb/scattering/permittivity.py +1 -0
- disdrodb/scattering/routines.py +3 -3
- disdrodb/summary/routines.py +12 -5
- disdrodb/utils/archiving.py +2 -1
- disdrodb/utils/attrs.py +3 -2
- disdrodb/utils/compression.py +1 -2
- disdrodb/utils/coords.py +45 -0
- disdrodb/utils/dask.py +5 -2
- disdrodb/utils/dataframe.py +4 -3
- disdrodb/utils/decorators.py +2 -1
- disdrodb/utils/directories.py +2 -2
- disdrodb/utils/encoding.py +2 -1
- disdrodb/utils/manipulations.py +1 -0
- disdrodb/utils/pydantic.py +1 -0
- disdrodb/utils/routines.py +1 -0
- disdrodb/utils/time.py +3 -2
- disdrodb/utils/warnings.py +1 -0
- disdrodb/utils/writer.py +4 -0
- disdrodb/utils/xarray.py +1 -0
- disdrodb/viz/plots.py +1 -0
- {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/METADATA +4 -3
- disdrodb-0.5.0.dist-info/RECORD +361 -0
- {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/WHEEL +1 -1
- disdrodb-0.3.0.dist-info/RECORD +0 -358
- {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/entry_points.txt +0 -0
- {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/licenses/LICENSE +0 -0
- {disdrodb-0.3.0.dist-info → disdrodb-0.5.0.dist-info}/top_level.txt +0 -0
disdrodb/utils/coords.py
ADDED
|
@@ -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
|
|
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
|
disdrodb/utils/dataframe.py
CHANGED
|
@@ -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=
|
|
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=
|
|
377
|
-
df_stats[f"{y}"] = pd.Categorical(df_stats[f"{y}_binned"].map(dict(zip(y_intervals, y_coords, strict=
|
|
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}"])
|
disdrodb/utils/decorators.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 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="
|
|
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
|
disdrodb/utils/directories.py
CHANGED
|
@@ -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:
|
|
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.")
|
disdrodb/utils/encoding.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 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
|
disdrodb/utils/manipulations.py
CHANGED
|
@@ -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
|
|
disdrodb/utils/pydantic.py
CHANGED
|
@@ -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
|
|
disdrodb/utils/routines.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 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:
|
|
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)
|
disdrodb/utils/warnings.py
CHANGED
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
|
+
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.
|
|
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 | [](https://pypi.org/project/disdrodb/) [](https://anaconda.org/conda-forge/disdrodb) |
|
|
57
58
|
| Activity | [](https://pypi.org/project/disdrodb/) [](https://anaconda.org/conda-forge/disdrodb) |
|
|
58
|
-
| Python Versions | [](https://www.python.org/downloads/) |
|
|
59
60
|
| Supported Systems | [](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [](https://github.com/ltelab/disdrodb/actions/workflows/tests_windows.yml) |
|
|
60
61
|
| Project Status | [](https://www.repostatus.org/#active) |
|
|
61
62
|
| Build Status | [](https://github.com/ltelab/disdrodb/actions/workflows/tests.yml) [](https://github.com/ltelab/disdrodb/actions/workflows/lint.yml) [](https://disdrodb.readthedocs.io/en/latest/) |
|