disdrodb 0.0.21__py3-none-any.whl → 0.1.1__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 +132 -15
- disdrodb/_config.py +4 -2
- disdrodb/_version.py +9 -4
- disdrodb/api/checks.py +264 -237
- disdrodb/api/configs.py +4 -8
- disdrodb/api/create_directories.py +235 -290
- disdrodb/api/info.py +217 -26
- disdrodb/api/io.py +306 -270
- disdrodb/api/path.py +597 -173
- disdrodb/api/search.py +486 -0
- disdrodb/{metadata/scripts → cli}/disdrodb_check_metadata_archive.py +12 -7
- disdrodb/{utils/pandas.py → cli/disdrodb_data_archive_directory.py} +9 -18
- disdrodb/cli/disdrodb_download_archive.py +86 -0
- disdrodb/cli/disdrodb_download_metadata_archive.py +53 -0
- disdrodb/cli/disdrodb_download_station.py +84 -0
- disdrodb/{api/scripts → cli}/disdrodb_initialize_station.py +22 -10
- disdrodb/cli/disdrodb_metadata_archive_directory.py +32 -0
- disdrodb/{data_transfer/scripts/disdrodb_download_station.py → cli/disdrodb_open_data_archive.py} +22 -22
- disdrodb/cli/disdrodb_open_logs_directory.py +69 -0
- disdrodb/{data_transfer/scripts/disdrodb_upload_station.py → cli/disdrodb_open_metadata_archive.py} +22 -24
- disdrodb/cli/disdrodb_open_metadata_directory.py +71 -0
- disdrodb/cli/disdrodb_open_product_directory.py +74 -0
- disdrodb/cli/disdrodb_open_readers_directory.py +32 -0
- disdrodb/{l0/scripts → cli}/disdrodb_run_l0.py +38 -31
- disdrodb/{l0/scripts → cli}/disdrodb_run_l0_station.py +32 -30
- disdrodb/{l0/scripts → cli}/disdrodb_run_l0a.py +30 -21
- disdrodb/{l0/scripts → cli}/disdrodb_run_l0a_station.py +24 -33
- disdrodb/{l0/scripts → cli}/disdrodb_run_l0b.py +30 -21
- disdrodb/{l0/scripts → cli}/disdrodb_run_l0b_station.py +25 -34
- disdrodb/cli/disdrodb_run_l0c.py +130 -0
- disdrodb/cli/disdrodb_run_l0c_station.py +129 -0
- disdrodb/cli/disdrodb_run_l1.py +122 -0
- disdrodb/cli/disdrodb_run_l1_station.py +121 -0
- disdrodb/cli/disdrodb_run_l2e.py +122 -0
- disdrodb/cli/disdrodb_run_l2e_station.py +122 -0
- disdrodb/cli/disdrodb_run_l2m.py +122 -0
- disdrodb/cli/disdrodb_run_l2m_station.py +122 -0
- disdrodb/cli/disdrodb_upload_archive.py +105 -0
- disdrodb/cli/disdrodb_upload_station.py +98 -0
- disdrodb/configs.py +90 -25
- disdrodb/data_transfer/__init__.py +22 -0
- disdrodb/data_transfer/download_data.py +87 -90
- disdrodb/data_transfer/upload_data.py +64 -37
- disdrodb/data_transfer/zenodo.py +15 -18
- disdrodb/docs.py +1 -1
- disdrodb/issue/__init__.py +17 -4
- disdrodb/issue/checks.py +10 -23
- disdrodb/issue/reader.py +9 -12
- disdrodb/issue/writer.py +14 -17
- disdrodb/l0/__init__.py +17 -26
- disdrodb/l0/check_configs.py +35 -23
- disdrodb/l0/check_standards.py +46 -51
- disdrodb/l0/configs/{Thies_LPM → LPM}/bins_diameter.yml +44 -44
- disdrodb/l0/configs/{Thies_LPM → LPM}/bins_velocity.yml +40 -40
- disdrodb/l0/configs/LPM/l0a_encodings.yml +80 -0
- disdrodb/l0/configs/{Thies_LPM → LPM}/l0b_cf_attrs.yml +84 -65
- disdrodb/l0/configs/{Thies_LPM → LPM}/l0b_encodings.yml +50 -9
- disdrodb/l0/configs/{Thies_LPM → LPM}/raw_data_format.yml +285 -245
- disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/bins_diameter.yml +66 -66
- disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/bins_velocity.yml +64 -64
- disdrodb/l0/configs/PARSIVEL/l0a_encodings.yml +32 -0
- disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/l0b_cf_attrs.yml +23 -21
- disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/l0b_encodings.yml +17 -17
- disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/raw_data_format.yml +77 -77
- disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/bins_diameter.yml +64 -64
- disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/bins_velocity.yml +64 -64
- disdrodb/l0/configs/PARSIVEL2/l0a_encodings.yml +39 -0
- disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/l0b_cf_attrs.yml +28 -26
- disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/l0b_encodings.yml +20 -20
- disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/raw_data_format.yml +107 -107
- disdrodb/l0/configs/PWS100/bins_diameter.yml +173 -0
- disdrodb/l0/configs/PWS100/bins_velocity.yml +173 -0
- disdrodb/l0/configs/PWS100/l0a_encodings.yml +19 -0
- disdrodb/l0/configs/PWS100/l0b_cf_attrs.yml +76 -0
- disdrodb/l0/configs/PWS100/l0b_encodings.yml +176 -0
- disdrodb/l0/configs/PWS100/raw_data_format.yml +182 -0
- disdrodb/l0/configs/{RD_80 → RD80}/bins_diameter.yml +40 -40
- disdrodb/l0/configs/RD80/l0a_encodings.yml +16 -0
- disdrodb/l0/configs/{RD_80 → RD80}/l0b_cf_attrs.yml +3 -3
- disdrodb/l0/configs/RD80/l0b_encodings.yml +135 -0
- disdrodb/l0/configs/{RD_80 → RD80}/raw_data_format.yml +46 -50
- disdrodb/l0/l0_reader.py +216 -340
- disdrodb/l0/l0a_processing.py +237 -208
- disdrodb/l0/l0b_nc_processing.py +227 -80
- disdrodb/l0/l0b_processing.py +96 -174
- disdrodb/l0/l0c_processing.py +627 -0
- disdrodb/l0/readers/{ARM → LPM/ARM}/ARM_LPM.py +36 -58
- disdrodb/l0/readers/LPM/AUSTRALIA/MELBOURNE_2007_LPM.py +236 -0
- disdrodb/l0/readers/LPM/BRAZIL/CHUVA_LPM.py +185 -0
- disdrodb/l0/readers/LPM/BRAZIL/GOAMAZON_LPM.py +185 -0
- disdrodb/l0/readers/LPM/ITALY/GID_LPM.py +195 -0
- disdrodb/l0/readers/LPM/ITALY/GID_LPM_W.py +210 -0
- disdrodb/l0/readers/{BRAZIL/GOAMAZON_LPM.py → LPM/KIT/CHWALA.py} +97 -76
- disdrodb/l0/readers/LPM/SLOVENIA/ARSO.py +197 -0
- disdrodb/l0/readers/LPM/SLOVENIA/CRNI_VRH.py +197 -0
- disdrodb/l0/readers/{UK → LPM/UK}/DIVEN.py +14 -35
- disdrodb/l0/readers/PARSIVEL/AUSTRALIA/MELBOURNE_2007_PARSIVEL.py +157 -0
- disdrodb/l0/readers/PARSIVEL/CHINA/CHONGQING.py +113 -0
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/ARCTIC_2021.py +40 -57
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/COMMON_2011.py +37 -54
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/DAVOS_2009_2011.py +34 -51
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_2009.py +34 -51
- disdrodb/l0/readers/{EPFL/PARADISO_2014.py → PARSIVEL/EPFL/EPFL_ROOF_2008.py} +38 -50
- disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2010.py +105 -0
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_ROOF_2011.py +34 -51
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_ROOF_2012.py +33 -51
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GENEPI_2007.py +25 -44
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GRAND_ST_BERNARD_2007.py +25 -44
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GRAND_ST_BERNARD_2007_2.py +25 -44
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/HPICONET_2010.py +34 -51
- disdrodb/l0/readers/{EPFL/EPFL_ROOF_2010.py → PARSIVEL/EPFL/HYMEX_LTE_SOP2.py} +37 -50
- disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP3.py +111 -0
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/HYMEX_LTE_SOP4.py +36 -54
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/LOCARNO_2018.py +34 -52
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/LOCARNO_2019.py +38 -56
- disdrodb/l0/readers/PARSIVEL/EPFL/PARADISO_2014.py +105 -0
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/PARSIVEL_2007.py +27 -45
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/PLATO_2019.py +24 -44
- disdrodb/l0/readers/PARSIVEL/EPFL/RACLETS_2019.py +140 -0
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/RACLETS_2019_WJF.py +41 -59
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/RIETHOLZBACH_2011.py +34 -51
- disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2017.py +117 -0
- disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2019.py +137 -0
- disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/UNIL_2022.py +42 -55
- disdrodb/l0/readers/PARSIVEL/GPM/IFLOODS.py +104 -0
- disdrodb/l0/readers/{GPM → PARSIVEL/GPM}/LPVEX.py +29 -48
- disdrodb/l0/readers/PARSIVEL/GPM/MC3E.py +184 -0
- disdrodb/l0/readers/PARSIVEL/KIT/BURKINA_FASO.py +133 -0
- disdrodb/l0/readers/PARSIVEL/NCAR/CCOPE_2015.py +113 -0
- disdrodb/l0/readers/{NCAR/VORTEX_SE_2016_P1.py → PARSIVEL/NCAR/OWLES_MIPS.py} +46 -72
- disdrodb/l0/readers/PARSIVEL/NCAR/PECAN_MOBILE.py +125 -0
- disdrodb/l0/readers/{NCAR/OWLES_MIPS.py → PARSIVEL/NCAR/PLOWS_MIPS.py} +45 -64
- disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2009.py +114 -0
- disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2010.py +176 -0
- disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2010_UF.py +183 -0
- disdrodb/l0/readers/PARSIVEL/SLOVENIA/UL_FGG.py +121 -0
- disdrodb/l0/readers/{ARM/ARM_LD.py → PARSIVEL2/ARM/ARM_PARSIVEL2.py} +27 -50
- disdrodb/l0/readers/PARSIVEL2/BRAZIL/CHUVA_PARSIVEL2.py +163 -0
- disdrodb/l0/readers/PARSIVEL2/BRAZIL/GOAMAZON_PARSIVEL2.py +163 -0
- disdrodb/l0/readers/{DENMARK → PARSIVEL2/DENMARK}/EROSION_nc.py +14 -35
- disdrodb/l0/readers/PARSIVEL2/FRANCE/ENPC_PARSIVEL2.py +189 -0
- disdrodb/l0/readers/PARSIVEL2/FRANCE/SIRTA_PARSIVEL2.py +119 -0
- disdrodb/l0/readers/PARSIVEL2/GPM/GCPEX.py +104 -0
- disdrodb/l0/readers/PARSIVEL2/GPM/NSSTC.py +176 -0
- disdrodb/l0/readers/PARSIVEL2/ITALY/GID_PARSIVEL2.py +32 -0
- disdrodb/l0/readers/PARSIVEL2/MEXICO/OH_IIUNAM_nc.py +56 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/PECAN_FP3.py +120 -0
- disdrodb/l0/readers/{NCAR → PARSIVEL2/NCAR}/PECAN_MIPS.py +45 -64
- disdrodb/l0/readers/PARSIVEL2/NCAR/RELAMPAGO_PARSIVEL2.py +181 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/SNOWIE_PJ.py +160 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/SNOWIE_SB.py +160 -0
- disdrodb/l0/readers/{NCAR/PLOWS_MIPS.py → PARSIVEL2/NCAR/VORTEX_SE_2016_P1.py} +49 -66
- disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_P2.py +118 -0
- disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_PIPS.py +152 -0
- disdrodb/l0/readers/PARSIVEL2/NETHERLANDS/DELFT.py +166 -0
- disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100.py +150 -0
- disdrodb/l0/readers/{NCAR/RELAMPAGO_RD80.py → RD80/BRAZIL/CHUVA_RD80.py} +36 -60
- disdrodb/l0/readers/{BRAZIL → RD80/BRAZIL}/GOAMAZON_RD80.py +36 -55
- disdrodb/l0/readers/{NCAR → RD80/NCAR}/CINDY_2011_RD80.py +35 -54
- disdrodb/l0/readers/{BRAZIL/CHUVA_RD80.py → RD80/NCAR/RELAMPAGO_RD80.py} +40 -54
- disdrodb/l0/readers/RD80/NOAA/PSL_RD80.py +274 -0
- disdrodb/l0/readers/template_reader_raw_netcdf_data.py +62 -0
- disdrodb/l0/readers/{reader_template.py → template_reader_raw_text_data.py} +20 -44
- disdrodb/l0/routines.py +885 -581
- disdrodb/l0/standards.py +77 -238
- disdrodb/l0/template_tools.py +105 -110
- disdrodb/l1/__init__.py +17 -0
- disdrodb/l1/beard_model.py +716 -0
- disdrodb/l1/encoding_attrs.py +635 -0
- disdrodb/l1/fall_velocity.py +260 -0
- disdrodb/l1/filters.py +192 -0
- disdrodb/l1/processing.py +202 -0
- disdrodb/l1/resampling.py +236 -0
- disdrodb/l1/routines.py +358 -0
- disdrodb/l1_env/__init__.py +17 -0
- disdrodb/l1_env/routines.py +38 -0
- disdrodb/l2/__init__.py +17 -0
- disdrodb/l2/empirical_dsd.py +1833 -0
- disdrodb/l2/event.py +388 -0
- disdrodb/l2/processing.py +528 -0
- disdrodb/l2/processing_options.py +213 -0
- disdrodb/l2/routines.py +868 -0
- disdrodb/metadata/__init__.py +9 -2
- disdrodb/metadata/checks.py +180 -124
- disdrodb/metadata/download.py +81 -0
- disdrodb/metadata/geolocation.py +146 -0
- disdrodb/metadata/info.py +20 -13
- disdrodb/metadata/manipulation.py +3 -3
- disdrodb/metadata/reader.py +59 -8
- disdrodb/metadata/search.py +77 -144
- disdrodb/metadata/standards.py +83 -80
- disdrodb/metadata/writer.py +10 -16
- disdrodb/psd/__init__.py +38 -0
- disdrodb/psd/fitting.py +2146 -0
- disdrodb/psd/models.py +774 -0
- disdrodb/routines.py +1412 -0
- disdrodb/scattering/__init__.py +28 -0
- disdrodb/scattering/axis_ratio.py +344 -0
- disdrodb/scattering/routines.py +456 -0
- disdrodb/utils/__init__.py +17 -0
- disdrodb/utils/attrs.py +208 -0
- disdrodb/utils/cli.py +269 -0
- disdrodb/utils/compression.py +60 -42
- disdrodb/utils/dask.py +62 -0
- disdrodb/utils/dataframe.py +342 -0
- disdrodb/utils/decorators.py +110 -0
- disdrodb/utils/directories.py +107 -46
- disdrodb/utils/encoding.py +127 -0
- disdrodb/utils/list.py +29 -0
- disdrodb/utils/logger.py +168 -46
- disdrodb/utils/time.py +657 -0
- disdrodb/utils/warnings.py +30 -0
- disdrodb/utils/writer.py +57 -0
- disdrodb/utils/xarray.py +138 -47
- disdrodb/utils/yaml.py +0 -1
- disdrodb/viz/__init__.py +17 -0
- disdrodb/viz/plots.py +17 -0
- disdrodb-0.1.1.dist-info/METADATA +294 -0
- disdrodb-0.1.1.dist-info/RECORD +232 -0
- {disdrodb-0.0.21.dist-info → disdrodb-0.1.1.dist-info}/WHEEL +1 -1
- disdrodb-0.1.1.dist-info/entry_points.txt +30 -0
- disdrodb/data_transfer/scripts/disdrodb_download_archive.py +0 -53
- disdrodb/data_transfer/scripts/disdrodb_upload_archive.py +0 -57
- disdrodb/l0/configs/OTT_Parsivel/l0a_encodings.yml +0 -32
- disdrodb/l0/configs/OTT_Parsivel2/l0a_encodings.yml +0 -39
- disdrodb/l0/configs/RD_80/l0a_encodings.yml +0 -16
- disdrodb/l0/configs/RD_80/l0b_encodings.yml +0 -135
- disdrodb/l0/configs/Thies_LPM/l0a_encodings.yml +0 -80
- disdrodb/l0/io.py +0 -257
- disdrodb/l0/l0_processing.py +0 -1091
- disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_OTT.py +0 -178
- disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_THIES.py +0 -247
- disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py +0 -204
- disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py +0 -183
- disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py +0 -183
- disdrodb/l0/readers/CHINA/CHONGQING.py +0 -131
- disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py +0 -128
- disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py +0 -127
- disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py +0 -129
- disdrodb/l0/readers/EPFL/RACLETS_2019.py +0 -158
- disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py +0 -136
- disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py +0 -158
- disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py +0 -138
- disdrodb/l0/readers/GPM/GCPEX.py +0 -123
- disdrodb/l0/readers/GPM/IFLOODS.py +0 -123
- disdrodb/l0/readers/GPM/MC3E.py +0 -123
- disdrodb/l0/readers/GPM/NSSTC.py +0 -164
- disdrodb/l0/readers/ITALY/GID.py +0 -199
- disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py +0 -92
- disdrodb/l0/readers/NCAR/CCOPE_2015.py +0 -133
- disdrodb/l0/readers/NCAR/PECAN_FP3.py +0 -137
- disdrodb/l0/readers/NCAR/PECAN_MOBILE.py +0 -144
- disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py +0 -195
- disdrodb/l0/readers/NCAR/SNOWIE_PJ.py +0 -172
- disdrodb/l0/readers/NCAR/SNOWIE_SB.py +0 -179
- disdrodb/l0/readers/NCAR/VORTEX2_2009.py +0 -133
- disdrodb/l0/readers/NCAR/VORTEX2_2010.py +0 -188
- disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py +0 -191
- disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py +0 -135
- disdrodb/l0/readers/NCAR/VORTEX_SE_2016_PIPS.py +0 -170
- disdrodb/l0/readers/NETHERLANDS/DELFT.py +0 -187
- disdrodb/l0/readers/SPAIN/SBEGUERIA.py +0 -179
- disdrodb/l0/scripts/disdrodb_run_l0b_concat.py +0 -93
- disdrodb/l0/scripts/disdrodb_run_l0b_concat_station.py +0 -85
- disdrodb/utils/netcdf.py +0 -452
- disdrodb/utils/scripts.py +0 -102
- disdrodb-0.0.21.dist-info/AUTHORS.md +0 -18
- disdrodb-0.0.21.dist-info/METADATA +0 -186
- disdrodb-0.0.21.dist-info/RECORD +0 -168
- disdrodb-0.0.21.dist-info/entry_points.txt +0 -15
- /disdrodb/l0/configs/{RD_80 → RD80}/bins_velocity.yml +0 -0
- /disdrodb/l0/manuals/{Thies_LPM.pdf → LPM.pdf} +0 -0
- /disdrodb/l0/manuals/{ODM_470.pdf → ODM470.pdf} +0 -0
- /disdrodb/l0/manuals/{OTT_Parsivel.pdf → PARSIVEL.pdf} +0 -0
- /disdrodb/l0/manuals/{OTT_Parsivel2.pdf → PARSIVEL2.pdf} +0 -0
- /disdrodb/l0/manuals/{PWS_100.pdf → PWS100.pdf} +0 -0
- /disdrodb/l0/manuals/{RD_80.pdf → RD80.pdf} +0 -0
- {disdrodb-0.0.21.dist-info → disdrodb-0.1.1.dist-info/licenses}/LICENSE +0 -0
- {disdrodb-0.0.21.dist-info → disdrodb-0.1.1.dist-info}/top_level.txt +0 -0
disdrodb/l0/standards.py
CHANGED
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
# -----------------------------------------------------------------------------.
|
|
19
19
|
"""Retrieve L0 sensor standards."""
|
|
20
20
|
|
|
21
|
-
import datetime
|
|
22
|
-
import importlib
|
|
23
21
|
import logging
|
|
24
22
|
|
|
25
23
|
import numpy as np
|
|
@@ -29,10 +27,34 @@ from disdrodb.api.configs import read_config_file
|
|
|
29
27
|
|
|
30
28
|
logger = logging.getLogger(__name__)
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
|
|
31
|
+
####-------------------------------------------------------------------------.
|
|
32
|
+
#### Sensor variables
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_sensor_logged_variables(sensor_name: str) -> list:
|
|
36
|
+
"""Get the sensor logged variables list.
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
sensor_name : str
|
|
41
|
+
Name of the sensor.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
list
|
|
46
|
+
List of the variables logged by the sensor.
|
|
47
|
+
"""
|
|
48
|
+
return list(get_data_format_dict(sensor_name).keys())
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def allowed_l0_variables(sensor_name: str) -> list:
|
|
52
|
+
"""Get the list of allowed L0 variables for a given sensor."""
|
|
53
|
+
sensor_variables = list(get_l0a_dtype(sensor_name))
|
|
54
|
+
weather_variables = ["air_temperature", "relative_humidity", "wind_speed", "wind_direction"]
|
|
55
|
+
allowed_variables = [*sensor_variables, *weather_variables, "time", "latitude", "longitude", "altitude"]
|
|
56
|
+
allowed_variables = sorted(np.unique(allowed_variables).tolist())
|
|
57
|
+
return allowed_variables
|
|
36
58
|
|
|
37
59
|
|
|
38
60
|
####--------------------------------------------------------------------------.
|
|
@@ -59,27 +81,9 @@ def get_data_format_dict(sensor_name: str) -> dict:
|
|
|
59
81
|
dict
|
|
60
82
|
Data format of each sensor variable.
|
|
61
83
|
"""
|
|
62
|
-
|
|
63
84
|
return read_config_file(sensor_name=sensor_name, product="L0A", filename="raw_data_format.yml")
|
|
64
85
|
|
|
65
86
|
|
|
66
|
-
def get_sensor_logged_variables(sensor_name: str) -> list:
|
|
67
|
-
"""Get the sensor logged variables list.
|
|
68
|
-
|
|
69
|
-
Parameters
|
|
70
|
-
----------
|
|
71
|
-
sensor_name : str
|
|
72
|
-
Name of the sensor.
|
|
73
|
-
|
|
74
|
-
Returns
|
|
75
|
-
-------
|
|
76
|
-
list
|
|
77
|
-
List of the variables logged by the sensor.
|
|
78
|
-
"""
|
|
79
|
-
|
|
80
|
-
return list(get_data_format_dict(sensor_name).keys())
|
|
81
|
-
|
|
82
|
-
|
|
83
87
|
def get_data_range_dict(sensor_name: str) -> dict:
|
|
84
88
|
"""Get the variable data range.
|
|
85
89
|
|
|
@@ -94,10 +98,9 @@ def get_data_range_dict(sensor_name: str) -> dict:
|
|
|
94
98
|
Dictionary with the expected data value range for each data field.
|
|
95
99
|
It excludes variables without specified data_range key.
|
|
96
100
|
"""
|
|
97
|
-
|
|
98
101
|
data_format_dict = get_data_format_dict(sensor_name)
|
|
99
102
|
dict_data_range = {}
|
|
100
|
-
for k in data_format_dict
|
|
103
|
+
for k in data_format_dict:
|
|
101
104
|
data_range = data_format_dict[k].get("data_range", None)
|
|
102
105
|
if data_range is not None:
|
|
103
106
|
dict_data_range[k] = data_range
|
|
@@ -118,10 +121,9 @@ def get_nan_flags_dict(sensor_name: str) -> dict:
|
|
|
118
121
|
Dictionary with the expected nan_flags list for each data field.
|
|
119
122
|
It excludes variables without specified nan_flags key.
|
|
120
123
|
"""
|
|
121
|
-
|
|
122
124
|
data_format_dict = get_data_format_dict(sensor_name)
|
|
123
125
|
dict_nan_flags = {}
|
|
124
|
-
for k in data_format_dict
|
|
126
|
+
for k in data_format_dict:
|
|
125
127
|
nan_flags = data_format_dict[k].get("nan_flags", None)
|
|
126
128
|
if nan_flags is not None:
|
|
127
129
|
dict_nan_flags[k] = _ensure_list_value(nan_flags)
|
|
@@ -144,7 +146,7 @@ def get_valid_values_dict(sensor_name: str) -> dict:
|
|
|
144
146
|
"""
|
|
145
147
|
data_format_dict = get_data_format_dict(sensor_name)
|
|
146
148
|
dict_valid_values = {}
|
|
147
|
-
for k in data_format_dict
|
|
149
|
+
for k in data_format_dict:
|
|
148
150
|
valid_values = data_format_dict[k].get("valid_values", None)
|
|
149
151
|
if valid_values is not None:
|
|
150
152
|
dict_valid_values[k] = _ensure_list_value(valid_values)
|
|
@@ -156,7 +158,7 @@ def get_valid_values_dict(sensor_name: str) -> dict:
|
|
|
156
158
|
def get_field_ndigits_natural_dict(sensor_name: str) -> dict:
|
|
157
159
|
"""Get number of digits on the left side of the comma from the instrument default string standards.
|
|
158
160
|
|
|
159
|
-
Example: 123,45 -> 123 --> 3 natural digits
|
|
161
|
+
Example: 123,45 -> 123 --> 3 natural digits.
|
|
160
162
|
|
|
161
163
|
Parameters
|
|
162
164
|
----------
|
|
@@ -168,7 +170,6 @@ def get_field_ndigits_natural_dict(sensor_name: str) -> dict:
|
|
|
168
170
|
dict
|
|
169
171
|
Dictionary with the expected number of natural digits for each data field.
|
|
170
172
|
"""
|
|
171
|
-
|
|
172
173
|
data_dict = get_data_format_dict(sensor_name)
|
|
173
174
|
d = {k: v["n_naturals"] for k, v in data_dict.items()}
|
|
174
175
|
return d
|
|
@@ -177,7 +178,8 @@ def get_field_ndigits_natural_dict(sensor_name: str) -> dict:
|
|
|
177
178
|
def get_field_ndigits_decimals_dict(sensor_name: dict) -> dict:
|
|
178
179
|
"""Get number of digits on the right side of the comma from the instrument default string standards.
|
|
179
180
|
|
|
180
|
-
Example: 123,45 -> 45 --> 2 decimal digits
|
|
181
|
+
Example: 123,45 -> 45 --> 2 decimal digits.
|
|
182
|
+
|
|
181
183
|
Parameters
|
|
182
184
|
----------
|
|
183
185
|
sensor_name : dict
|
|
@@ -188,7 +190,6 @@ def get_field_ndigits_decimals_dict(sensor_name: dict) -> dict:
|
|
|
188
190
|
dict
|
|
189
191
|
Dictionary with the expected number of decimal digits for each data field.
|
|
190
192
|
"""
|
|
191
|
-
|
|
192
193
|
data_dict = get_data_format_dict(sensor_name)
|
|
193
194
|
d = {k: v["n_decimals"] for k, v in data_dict.items()}
|
|
194
195
|
return d
|
|
@@ -204,12 +205,12 @@ def get_field_ndigits_dict(sensor_name: str) -> dict:
|
|
|
204
205
|
----------
|
|
205
206
|
sensor_name : str
|
|
206
207
|
Name of the sensor.
|
|
208
|
+
|
|
207
209
|
Returns
|
|
208
210
|
-------
|
|
209
211
|
dict
|
|
210
212
|
Dictionary with the expected number of digits for each data field.
|
|
211
213
|
"""
|
|
212
|
-
|
|
213
214
|
data_dict = get_data_format_dict(sensor_name)
|
|
214
215
|
d = {k: v["n_digits"] for k, v in data_dict.items()}
|
|
215
216
|
return d
|
|
@@ -231,7 +232,6 @@ def get_field_nchar_dict(sensor_name: str) -> dict:
|
|
|
231
232
|
dict
|
|
232
233
|
Dictionary with the expected number of characters for each data field.
|
|
233
234
|
"""
|
|
234
|
-
|
|
235
235
|
data_dict = get_data_format_dict(sensor_name)
|
|
236
236
|
d = {k: v["n_characters"] for k, v in data_dict.items()}
|
|
237
237
|
return d
|
|
@@ -258,156 +258,12 @@ def get_l0b_cf_attrs_dict(sensor_name: str) -> dict:
|
|
|
258
258
|
return read_config_file(sensor_name=sensor_name, product="L0A", filename="l0b_cf_attrs.yml")
|
|
259
259
|
|
|
260
260
|
|
|
261
|
-
####-------------------------------------------------------------------------.
|
|
262
|
-
#### Coordinates attributes
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
def get_coords_attrs_dict(ds):
|
|
266
|
-
"""Return dictionary with DISDRODB coordinates attributes."""
|
|
267
|
-
attrs_dict = {}
|
|
268
|
-
# Define diameter attributes
|
|
269
|
-
attrs_dict["diameter_bin_center"] = {
|
|
270
|
-
"name": "diameter_bin_center",
|
|
271
|
-
"standard_name": "diameter_bin_center",
|
|
272
|
-
"long_name": "diameter_bin_center",
|
|
273
|
-
"units": "mm",
|
|
274
|
-
"description": "Bin center drop diameter value",
|
|
275
|
-
}
|
|
276
|
-
attrs_dict["diameter_bin_width"] = {
|
|
277
|
-
"name": "diameter_bin_width",
|
|
278
|
-
"standard_name": "diameter_bin_width",
|
|
279
|
-
"long_name": "diameter_bin_width",
|
|
280
|
-
"units": "mm",
|
|
281
|
-
"description": "Drop diameter bin width",
|
|
282
|
-
}
|
|
283
|
-
attrs_dict["diameter_bin_upper"] = {
|
|
284
|
-
"name": "diameter_bin_upper",
|
|
285
|
-
"standard_name": "diameter_bin_upper",
|
|
286
|
-
"long_name": "diameter_bin_upper",
|
|
287
|
-
"units": "mm",
|
|
288
|
-
"description": "Bin upper bound drop diameter value",
|
|
289
|
-
}
|
|
290
|
-
attrs_dict["velocity_bin_lower"] = {
|
|
291
|
-
"name": "velocity_bin_lower",
|
|
292
|
-
"standard_name": "velocity_bin_lower",
|
|
293
|
-
"long_name": "velocity_bin_lower",
|
|
294
|
-
"units": "mm",
|
|
295
|
-
"description": "Bin lower bound drop diameter value",
|
|
296
|
-
}
|
|
297
|
-
# Define velocity attributes
|
|
298
|
-
attrs_dict["velocity_bin_center"] = {
|
|
299
|
-
"name": "velocity_bin_center",
|
|
300
|
-
"standard_name": "velocity_bin_center",
|
|
301
|
-
"long_name": "velocity_bin_center",
|
|
302
|
-
"units": "m/s",
|
|
303
|
-
"description": "Bin center drop fall velocity value",
|
|
304
|
-
}
|
|
305
|
-
attrs_dict["velocity_bin_width"] = {
|
|
306
|
-
"name": "velocity_bin_width",
|
|
307
|
-
"standard_name": "velocity_bin_width",
|
|
308
|
-
"long_name": "velocity_bin_width",
|
|
309
|
-
"units": "m/s",
|
|
310
|
-
"description": "Drop fall velocity bin width",
|
|
311
|
-
}
|
|
312
|
-
attrs_dict["velocity_bin_upper"] = {
|
|
313
|
-
"name": "velocity_bin_upper",
|
|
314
|
-
"standard_name": "velocity_bin_upper",
|
|
315
|
-
"long_name": "velocity_bin_upper",
|
|
316
|
-
"units": "m/s",
|
|
317
|
-
"description": "Bin upper bound drop fall velocity value",
|
|
318
|
-
}
|
|
319
|
-
attrs_dict["velocity_bin_lower"] = {
|
|
320
|
-
"name": "velocity_bin_lower",
|
|
321
|
-
"standard_name": "velocity_bin_lower",
|
|
322
|
-
"long_name": "velocity_bin_lower",
|
|
323
|
-
"units": "m/s",
|
|
324
|
-
"description": "Bin lower bound drop fall velocity value",
|
|
325
|
-
}
|
|
326
|
-
# Define geolocation attributes
|
|
327
|
-
attrs_dict["latitude"] = {
|
|
328
|
-
"name": "latitude",
|
|
329
|
-
"standard_name": "latitude",
|
|
330
|
-
"long_name": "Latitude",
|
|
331
|
-
"units": "degrees_north",
|
|
332
|
-
}
|
|
333
|
-
attrs_dict["longitude"] = {
|
|
334
|
-
"name": "longitude",
|
|
335
|
-
"standard_name": "longitude",
|
|
336
|
-
"long_name": "Longitude",
|
|
337
|
-
"units": "degrees_east",
|
|
338
|
-
}
|
|
339
|
-
attrs_dict["altitude"] = {
|
|
340
|
-
"name": "altitude",
|
|
341
|
-
"standard_name": "altitude",
|
|
342
|
-
"long_name": "Altitude",
|
|
343
|
-
"units": "m",
|
|
344
|
-
"description": "Elevation above sea level",
|
|
345
|
-
}
|
|
346
|
-
# Define time attributes
|
|
347
|
-
attrs_dict["time"] = {
|
|
348
|
-
"name": "time",
|
|
349
|
-
"standard_name": "time",
|
|
350
|
-
"long_name": "time",
|
|
351
|
-
"description": "UTC Time",
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
return attrs_dict
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
####-------------------------------------------------------------------------.
|
|
358
|
-
#### DISDRODB attributes
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
def set_disdrodb_attrs(ds, product: str):
|
|
362
|
-
"""Add DISDRODB processing information to the netCDF global attributes.
|
|
363
|
-
|
|
364
|
-
It assumes stations metadata are already added the dataset.
|
|
365
|
-
|
|
366
|
-
Parameters
|
|
367
|
-
----------
|
|
368
|
-
ds : xarray dataset
|
|
369
|
-
Dataset
|
|
370
|
-
product: str
|
|
371
|
-
DISDRODB product
|
|
372
|
-
|
|
373
|
-
Returns
|
|
374
|
-
-------
|
|
375
|
-
xarray dataset
|
|
376
|
-
Dataset
|
|
377
|
-
"""
|
|
378
|
-
# Add dataset conventions
|
|
379
|
-
ds.attrs["Conventions"] = CONVENTIONS
|
|
380
|
-
|
|
381
|
-
# Add featureType
|
|
382
|
-
platform_type = ds.attrs["platform_type"]
|
|
383
|
-
if platform_type == "fixed":
|
|
384
|
-
ds.attrs["featureType"] = "timeSeries"
|
|
385
|
-
else:
|
|
386
|
-
ds.attrs["featureType"] = "trajectory"
|
|
387
|
-
|
|
388
|
-
# Add time_coverage_start and time_coverage_end
|
|
389
|
-
ds.attrs["time_coverage_start"] = str(ds["time"].data[0])
|
|
390
|
-
ds.attrs["time_coverage_end"] = str(ds["time"].data[-1])
|
|
391
|
-
|
|
392
|
-
# DISDRODDB attributes
|
|
393
|
-
# - Add DISDRODB processing info
|
|
394
|
-
now = datetime.datetime.utcnow()
|
|
395
|
-
current_time = now.strftime("%Y-%m-%d %H:%M:%S")
|
|
396
|
-
ds.attrs["disdrodb_processing_date"] = current_time
|
|
397
|
-
# - Add DISDRODB product and version
|
|
398
|
-
ds.attrs["disdrodb_product_version"] = PRODUCT_VERSION
|
|
399
|
-
ds.attrs["disdrodb_software_version"] = SOFTWARE_VERSION
|
|
400
|
-
ds.attrs["disdrodb_product"] = product
|
|
401
|
-
|
|
402
|
-
return ds
|
|
403
|
-
|
|
404
|
-
|
|
405
261
|
####-------------------------------------------------------------------------.
|
|
406
262
|
#### Bin Coordinates Information
|
|
407
263
|
|
|
408
264
|
|
|
409
265
|
def get_diameter_bins_dict(sensor_name: str) -> dict:
|
|
410
|
-
"""Get dictionary with sensor_name diameter bins information.
|
|
266
|
+
"""Get dictionary with ``sensor_name`` diameter bins information.
|
|
411
267
|
|
|
412
268
|
Parameters
|
|
413
269
|
----------
|
|
@@ -417,7 +273,7 @@ def get_diameter_bins_dict(sensor_name: str) -> dict:
|
|
|
417
273
|
Returns
|
|
418
274
|
-------
|
|
419
275
|
dict
|
|
420
|
-
|
|
276
|
+
Sensor diameter bins information.
|
|
421
277
|
"""
|
|
422
278
|
d = read_config_file(sensor_name=sensor_name, product="L0A", filename="bins_diameter.yml")
|
|
423
279
|
return d
|
|
@@ -429,12 +285,12 @@ def get_diameter_bin_center(sensor_name: str) -> list:
|
|
|
429
285
|
Parameters
|
|
430
286
|
----------
|
|
431
287
|
sensor_name : str
|
|
432
|
-
Name of the sensor
|
|
288
|
+
Name of the sensor.
|
|
433
289
|
|
|
434
290
|
Returns
|
|
435
291
|
-------
|
|
436
292
|
list
|
|
437
|
-
Diameter bin center
|
|
293
|
+
Diameter bin center.
|
|
438
294
|
"""
|
|
439
295
|
diameter_dict = get_diameter_bins_dict(sensor_name)
|
|
440
296
|
diameter_bin_center = list(diameter_dict["center"].values())
|
|
@@ -447,12 +303,12 @@ def get_diameter_bin_lower(sensor_name: str) -> list:
|
|
|
447
303
|
Parameters
|
|
448
304
|
----------
|
|
449
305
|
sensor_name : str
|
|
450
|
-
Name of the sensor
|
|
306
|
+
Name of the sensor.
|
|
451
307
|
|
|
452
308
|
Returns
|
|
453
309
|
-------
|
|
454
310
|
list
|
|
455
|
-
Diameter bin lower bound
|
|
311
|
+
Diameter bin lower bound.
|
|
456
312
|
"""
|
|
457
313
|
diameter_dict = get_diameter_bins_dict(sensor_name)
|
|
458
314
|
lower_bounds = [v[0] for v in diameter_dict["bounds"].values()]
|
|
@@ -465,12 +321,12 @@ def get_diameter_bin_upper(sensor_name: str) -> list:
|
|
|
465
321
|
Parameters
|
|
466
322
|
----------
|
|
467
323
|
sensor_name : str
|
|
468
|
-
Name of the sensor
|
|
324
|
+
Name of the sensor.
|
|
469
325
|
|
|
470
326
|
Returns
|
|
471
327
|
-------
|
|
472
328
|
list
|
|
473
|
-
Diameter bin upper bound
|
|
329
|
+
Diameter bin upper bound.
|
|
474
330
|
"""
|
|
475
331
|
diameter_dict = get_diameter_bins_dict(sensor_name)
|
|
476
332
|
upper_bounds = [v[1] for v in diameter_dict["bounds"].values()]
|
|
@@ -483,12 +339,12 @@ def get_diameter_bin_width(sensor_name: str) -> list:
|
|
|
483
339
|
Parameters
|
|
484
340
|
----------
|
|
485
341
|
sensor_name : str
|
|
486
|
-
Name of the sensor
|
|
342
|
+
Name of the sensor.
|
|
487
343
|
|
|
488
344
|
Returns
|
|
489
345
|
-------
|
|
490
346
|
list
|
|
491
|
-
Diameter bin width
|
|
347
|
+
Diameter bin width.
|
|
492
348
|
"""
|
|
493
349
|
diameter_dict = get_diameter_bins_dict(sensor_name)
|
|
494
350
|
diameter_bin_width = list(diameter_dict["width"].values())
|
|
@@ -496,7 +352,7 @@ def get_diameter_bin_width(sensor_name: str) -> list:
|
|
|
496
352
|
|
|
497
353
|
|
|
498
354
|
def get_velocity_bins_dict(sensor_name: str) -> dict:
|
|
499
|
-
"""Get velocity with sensor_name diameter bins information.
|
|
355
|
+
"""Get velocity with ``sensor_name`` diameter bins information.
|
|
500
356
|
|
|
501
357
|
Parameters
|
|
502
358
|
----------
|
|
@@ -506,7 +362,7 @@ def get_velocity_bins_dict(sensor_name: str) -> dict:
|
|
|
506
362
|
Returns
|
|
507
363
|
-------
|
|
508
364
|
dict
|
|
509
|
-
|
|
365
|
+
Sensor velocity bins information.
|
|
510
366
|
"""
|
|
511
367
|
d = read_config_file(sensor_name=sensor_name, product="L0A", filename="bins_velocity.yml")
|
|
512
368
|
return d
|
|
@@ -518,12 +374,12 @@ def get_velocity_bin_center(sensor_name: str) -> list:
|
|
|
518
374
|
Parameters
|
|
519
375
|
----------
|
|
520
376
|
sensor_name : str
|
|
521
|
-
Name of the sensor
|
|
377
|
+
Name of the sensor.
|
|
522
378
|
|
|
523
379
|
Returns
|
|
524
380
|
-------
|
|
525
381
|
list
|
|
526
|
-
Velocity bin center
|
|
382
|
+
Velocity bin center.
|
|
527
383
|
"""
|
|
528
384
|
velocity_dict = get_velocity_bins_dict(sensor_name)
|
|
529
385
|
if velocity_dict is not None:
|
|
@@ -539,7 +395,7 @@ def get_velocity_bin_lower(sensor_name: str) -> list:
|
|
|
539
395
|
Parameters
|
|
540
396
|
----------
|
|
541
397
|
sensor_name : str
|
|
542
|
-
Name of the sensor
|
|
398
|
+
Name of the sensor.
|
|
543
399
|
|
|
544
400
|
Returns
|
|
545
401
|
-------
|
|
@@ -560,14 +416,13 @@ def get_velocity_bin_upper(sensor_name: str) -> list:
|
|
|
560
416
|
Parameters
|
|
561
417
|
----------
|
|
562
418
|
sensor_name : str
|
|
563
|
-
Name of the sensor
|
|
419
|
+
Name of the sensor.
|
|
564
420
|
|
|
565
421
|
Returns
|
|
566
422
|
-------
|
|
567
423
|
list
|
|
568
|
-
Velocity bin upper bound
|
|
424
|
+
Velocity bin upper bound.
|
|
569
425
|
"""
|
|
570
|
-
|
|
571
426
|
velocity_dict = get_velocity_bins_dict(sensor_name)
|
|
572
427
|
if velocity_dict is not None:
|
|
573
428
|
upper_bounds = [v[1] for v in velocity_dict["bounds"].values()]
|
|
@@ -582,14 +437,13 @@ def get_velocity_bin_width(sensor_name: str) -> list:
|
|
|
582
437
|
Parameters
|
|
583
438
|
----------
|
|
584
439
|
sensor_name : str
|
|
585
|
-
Name of the sensor
|
|
440
|
+
Name of the sensor.
|
|
586
441
|
|
|
587
442
|
Returns
|
|
588
443
|
-------
|
|
589
444
|
list
|
|
590
|
-
Velocity bin width
|
|
445
|
+
Velocity bin width.
|
|
591
446
|
"""
|
|
592
|
-
|
|
593
447
|
velocity_dict = get_velocity_bins_dict(sensor_name)
|
|
594
448
|
if velocity_dict is not None:
|
|
595
449
|
velocity_bin_width = list(velocity_dict["width"].values())
|
|
@@ -609,10 +463,9 @@ def get_bin_coords_dict(sensor_name: str) -> dict:
|
|
|
609
463
|
Returns
|
|
610
464
|
-------
|
|
611
465
|
dict
|
|
612
|
-
Dictionary with
|
|
466
|
+
Dictionary with coordinates arrays.
|
|
613
467
|
"""
|
|
614
|
-
|
|
615
|
-
check_sensor_name(sensor_name=sensor_name)
|
|
468
|
+
check_sensor_name(sensor_name)
|
|
616
469
|
coords = {}
|
|
617
470
|
# Retrieve diameter coords
|
|
618
471
|
coords["diameter_bin_center"] = get_diameter_bin_center(sensor_name=sensor_name)
|
|
@@ -661,10 +514,7 @@ def get_n_velocity_bins(sensor_name):
|
|
|
661
514
|
"""Get the number of velocity bins."""
|
|
662
515
|
# Retrieve number of bins
|
|
663
516
|
velocity_dict = get_velocity_bins_dict(sensor_name)
|
|
664
|
-
if velocity_dict is None
|
|
665
|
-
n_velocity_bins = 0
|
|
666
|
-
else:
|
|
667
|
-
n_velocity_bins = len(velocity_dict["center"])
|
|
517
|
+
n_velocity_bins = 0 if velocity_dict is None else len(velocity_dict["center"])
|
|
668
518
|
return n_velocity_bins
|
|
669
519
|
|
|
670
520
|
|
|
@@ -683,16 +533,15 @@ def get_l0a_dtype(sensor_name: str) -> dict:
|
|
|
683
533
|
Returns
|
|
684
534
|
-------
|
|
685
535
|
dict
|
|
686
|
-
L0A dtype
|
|
536
|
+
Dictionary with the L0A dtype.
|
|
687
537
|
"""
|
|
688
|
-
|
|
689
538
|
# Note: This function could extract the info from l0a_encodings in future.
|
|
690
539
|
d = read_config_file(sensor_name=sensor_name, product="L0A", filename="l0a_encodings.yml")
|
|
691
540
|
return d
|
|
692
541
|
|
|
693
542
|
|
|
694
543
|
def get_l0a_encodings_dict(sensor_name: str) -> dict:
|
|
695
|
-
"""Get a dictionary containing the L0A encodings
|
|
544
|
+
"""Get a dictionary containing the L0A encodings.
|
|
696
545
|
|
|
697
546
|
Parameters
|
|
698
547
|
----------
|
|
@@ -702,9 +551,8 @@ def get_l0a_encodings_dict(sensor_name: str) -> dict:
|
|
|
702
551
|
Returns
|
|
703
552
|
-------
|
|
704
553
|
dict
|
|
705
|
-
L0A encodings
|
|
554
|
+
L0A encodings.
|
|
706
555
|
"""
|
|
707
|
-
|
|
708
556
|
# - l0a_encodings.yml currently specify only the dtype. This could be expanded in the future.
|
|
709
557
|
d = read_config_file(sensor_name=sensor_name, product="L0A", filename="l0a_encodings.yml")
|
|
710
558
|
return d
|
|
@@ -715,15 +563,17 @@ def _check_contiguous_chunksize_agrees(encoding_dict, var):
|
|
|
715
563
|
contiguous = encoding_dict[var].get("contiguous", False)
|
|
716
564
|
if isinstance(chunksizes, list) and len(chunksizes) >= 1 and contiguous:
|
|
717
565
|
raise ValueError(
|
|
718
|
-
f"Invalid encodings for variable {var}. 'chunksizes' are specified but 'contiguous' is set to True !"
|
|
566
|
+
f"Invalid encodings for variable {var}. 'chunksizes' are specified but 'contiguous' is set to True !",
|
|
719
567
|
)
|
|
720
568
|
|
|
721
569
|
|
|
722
570
|
def _if_no_chunksizes_set_contiguous(encoding_dict, var):
|
|
723
|
-
if isinstance(encoding_dict[var].get("chunksizes", None), type(None))
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
571
|
+
if isinstance(encoding_dict[var].get("chunksizes", None), type(None)) and not encoding_dict[var].get(
|
|
572
|
+
"contiguous",
|
|
573
|
+
False,
|
|
574
|
+
):
|
|
575
|
+
encoding_dict[var]["contiguous"] = True
|
|
576
|
+
print(f"Set contiguous=True for variable {var} because chunksizes=None")
|
|
727
577
|
return encoding_dict
|
|
728
578
|
|
|
729
579
|
|
|
@@ -746,7 +596,7 @@ def _ensure_valid_chunksizes(encoding_dict, var):
|
|
|
746
596
|
|
|
747
597
|
|
|
748
598
|
def _ensure_valid_netcdf_encoding_dict(encoding_dict):
|
|
749
|
-
for var in encoding_dict
|
|
599
|
+
for var in encoding_dict:
|
|
750
600
|
_check_contiguous_chunksize_agrees(encoding_dict, var)
|
|
751
601
|
# Ensure valid arguments for contiguous (unchunked) arrays
|
|
752
602
|
encoding_dict = _if_no_chunksizes_set_contiguous(encoding_dict, var)
|
|
@@ -774,20 +624,6 @@ def get_l0b_encodings_dict(sensor_name: str) -> dict:
|
|
|
774
624
|
return encoding_dict
|
|
775
625
|
|
|
776
626
|
|
|
777
|
-
def get_time_encoding() -> dict:
|
|
778
|
-
"""Create time encoding
|
|
779
|
-
|
|
780
|
-
Returns
|
|
781
|
-
-------
|
|
782
|
-
dict
|
|
783
|
-
Time encoding
|
|
784
|
-
"""
|
|
785
|
-
encoding = {}
|
|
786
|
-
encoding["units"] = EPOCH
|
|
787
|
-
encoding["calendar"] = "proleptic_gregorian"
|
|
788
|
-
return encoding
|
|
789
|
-
|
|
790
|
-
|
|
791
627
|
####-------------------------------------------------------------------------.
|
|
792
628
|
#### L0B processing tools
|
|
793
629
|
|
|
@@ -822,21 +658,24 @@ def get_raw_array_dims_order(sensor_name: str) -> dict:
|
|
|
822
658
|
The order of dimension specified for raw_drop_number controls the
|
|
823
659
|
reshaping of the precipitation raw spectrum.
|
|
824
660
|
|
|
825
|
-
Examples
|
|
826
|
-
|
|
661
|
+
Examples
|
|
662
|
+
--------
|
|
663
|
+
OTT Parsivel spectrum [d1v1 ... d32v1, d1v2, ..., d32v2] (diameter increases first)
|
|
827
664
|
--> dimension_order = ["velocity_bin_center", "diameter_bin_center"]
|
|
828
|
-
Thies LPM spectrum [v1d1 ... v20d1, v1d2, ..., v20d2]
|
|
665
|
+
Thies LPM spectrum [v1d1 ... v20d1, v1d2, ..., v20d2] (velocity increases first)
|
|
666
|
+
--> dimension_order = ["diameter_bin_center", "velocity_bin_center"]
|
|
667
|
+
PWS 100 spectrum [d1v1 ... d1v34, d2v1, ..., d2v34] (velocity increases first)
|
|
829
668
|
--> dimension_order = ["diameter_bin_center", "velocity_bin_center"]
|
|
830
669
|
|
|
831
670
|
Parameters
|
|
832
671
|
----------
|
|
833
672
|
sensor_name : str
|
|
834
|
-
Name of the sensor
|
|
673
|
+
Name of the sensor.
|
|
835
674
|
|
|
836
675
|
Returns
|
|
837
676
|
-------
|
|
838
677
|
dict
|
|
839
|
-
Dimension order dictionary
|
|
678
|
+
Dimension order dictionary.
|
|
840
679
|
|
|
841
680
|
"""
|
|
842
681
|
# Retrieve data format dictionary
|
|
@@ -906,7 +745,7 @@ def get_valid_dimension_names(sensor_name):
|
|
|
906
745
|
list_dimensions = list(dims_dict.values()) # for each array variable
|
|
907
746
|
list_dimensions = [item for sublist in list_dimensions for item in sublist]
|
|
908
747
|
valid_dims = np.unique(list_dimensions).tolist()
|
|
909
|
-
dimensions = ["time"
|
|
748
|
+
dimensions = ["time", *valid_dims]
|
|
910
749
|
return dimensions
|
|
911
750
|
|
|
912
751
|
|