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
|
@@ -0,0 +1,277 @@
|
|
|
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 reader for GID LPM sensors not measuring wind."""
|
|
18
|
+
|
|
19
|
+
import os
|
|
20
|
+
|
|
21
|
+
import numpy as np
|
|
22
|
+
import pandas as pd
|
|
23
|
+
|
|
24
|
+
from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
|
|
25
|
+
from disdrodb.l0.l0a_processing import read_raw_text_file
|
|
26
|
+
from disdrodb.utils.logger import log_warning
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@is_documented_by(reader_generic_docstring)
|
|
30
|
+
def reader(
|
|
31
|
+
filepath,
|
|
32
|
+
logger=None,
|
|
33
|
+
):
|
|
34
|
+
"""Reader."""
|
|
35
|
+
##------------------------------------------------------------------------.
|
|
36
|
+
#### - Define raw data headers
|
|
37
|
+
column_names = ["TO_PARSE"]
|
|
38
|
+
|
|
39
|
+
##------------------------------------------------------------------------.
|
|
40
|
+
#### Define reader options
|
|
41
|
+
# - For more info: https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
|
|
42
|
+
reader_kwargs = {}
|
|
43
|
+
|
|
44
|
+
# - Define delimiter
|
|
45
|
+
reader_kwargs["delimiter"] = "\\n"
|
|
46
|
+
|
|
47
|
+
# - Avoid first column to become df index !!!
|
|
48
|
+
reader_kwargs["index_col"] = False
|
|
49
|
+
|
|
50
|
+
# Since column names are expected to be passed explicitly, header is set to None
|
|
51
|
+
reader_kwargs["header"] = None
|
|
52
|
+
|
|
53
|
+
# - Number of rows to be skipped at the beginning of the file
|
|
54
|
+
reader_kwargs["skiprows"] = None
|
|
55
|
+
|
|
56
|
+
# - Define encoding
|
|
57
|
+
reader_kwargs["encoding"] = "latin"
|
|
58
|
+
|
|
59
|
+
# - Define behaviour when encountering bad lines
|
|
60
|
+
reader_kwargs["on_bad_lines"] = "skip"
|
|
61
|
+
|
|
62
|
+
# - Define reader engine
|
|
63
|
+
# - C engine is faster
|
|
64
|
+
# - Python engine is more feature-complete
|
|
65
|
+
reader_kwargs["engine"] = "python"
|
|
66
|
+
|
|
67
|
+
# - Define on-the-fly decompression of on-disk data
|
|
68
|
+
# - Available: gzip, bz2, zip
|
|
69
|
+
reader_kwargs["compression"] = "infer"
|
|
70
|
+
|
|
71
|
+
# - Strings to recognize as NA/NaN and replace with standard NA flags
|
|
72
|
+
# - Already included: '#N/A', '#N/A N/A', '#NA', '-1.#IND', '-1.#QNAN',
|
|
73
|
+
# '-NaN', '-nan', '1.#IND', '1.#QNAN', '<NA>', 'N/A',
|
|
74
|
+
# 'NA', 'NULL', 'NaN', 'n/a', 'nan', 'null'
|
|
75
|
+
reader_kwargs["na_values"] = ["na", "", "error"]
|
|
76
|
+
|
|
77
|
+
##------------------------------------------------------------------------.
|
|
78
|
+
#### Read the data
|
|
79
|
+
df = read_raw_text_file(
|
|
80
|
+
filepath=filepath,
|
|
81
|
+
column_names=column_names,
|
|
82
|
+
reader_kwargs=reader_kwargs,
|
|
83
|
+
logger=logger,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
##------------------------------------------------------------------------.
|
|
87
|
+
#### Adapt the dataframe to adhere to DISDRODB L0 standards
|
|
88
|
+
# Raise error if empty file
|
|
89
|
+
if len(df) == 0:
|
|
90
|
+
raise ValueError(f"{filepath} is empty.")
|
|
91
|
+
|
|
92
|
+
# Select only rows with expected number of delimiters
|
|
93
|
+
df = df[df["TO_PARSE"].str.count(";").isin([519, 520, 523])]
|
|
94
|
+
|
|
95
|
+
# Check there are still valid rows
|
|
96
|
+
if len(df) == 0:
|
|
97
|
+
raise ValueError(f"No valid rows in {filepath}.")
|
|
98
|
+
|
|
99
|
+
# Split by ; delimiter (before raw drop number)
|
|
100
|
+
df = df["TO_PARSE"].str.split(";", expand=True, n=79)
|
|
101
|
+
|
|
102
|
+
# Assign column names
|
|
103
|
+
names = [
|
|
104
|
+
"start_identifier",
|
|
105
|
+
"device_address",
|
|
106
|
+
"sensor_serial_number",
|
|
107
|
+
"sensor_date",
|
|
108
|
+
"sensor_time",
|
|
109
|
+
"weather_code_synop_4677_5min",
|
|
110
|
+
"weather_code_synop_4680_5min",
|
|
111
|
+
"weather_code_metar_4678_5min",
|
|
112
|
+
"precipitation_rate_5min",
|
|
113
|
+
"weather_code_synop_4677",
|
|
114
|
+
"weather_code_synop_4680",
|
|
115
|
+
"weather_code_metar_4678",
|
|
116
|
+
"precipitation_rate",
|
|
117
|
+
"rainfall_rate",
|
|
118
|
+
"snowfall_rate",
|
|
119
|
+
"precipitation_accumulated",
|
|
120
|
+
"mor_visibility",
|
|
121
|
+
"reflectivity",
|
|
122
|
+
"quality_index",
|
|
123
|
+
"max_hail_diameter",
|
|
124
|
+
"laser_status",
|
|
125
|
+
"static_signal_status",
|
|
126
|
+
"laser_temperature_analog_status",
|
|
127
|
+
"laser_temperature_digital_status",
|
|
128
|
+
"laser_current_analog_status",
|
|
129
|
+
"laser_current_digital_status",
|
|
130
|
+
"sensor_voltage_supply_status",
|
|
131
|
+
"current_heating_pane_transmitter_head_status",
|
|
132
|
+
"current_heating_pane_receiver_head_status",
|
|
133
|
+
"temperature_sensor_status",
|
|
134
|
+
"current_heating_voltage_supply_status",
|
|
135
|
+
"current_heating_house_status",
|
|
136
|
+
"current_heating_heads_status",
|
|
137
|
+
"current_heating_carriers_status",
|
|
138
|
+
"control_output_laser_power_status",
|
|
139
|
+
"reserved_status",
|
|
140
|
+
"temperature_interior",
|
|
141
|
+
"laser_temperature",
|
|
142
|
+
"laser_current_average",
|
|
143
|
+
"control_voltage",
|
|
144
|
+
"optical_control_voltage_output",
|
|
145
|
+
"sensor_voltage_supply",
|
|
146
|
+
"current_heating_pane_transmitter_head",
|
|
147
|
+
"current_heating_pane_receiver_head",
|
|
148
|
+
"temperature_ambient",
|
|
149
|
+
"current_heating_voltage_supply",
|
|
150
|
+
"current_heating_house",
|
|
151
|
+
"current_heating_heads",
|
|
152
|
+
"current_heating_carriers",
|
|
153
|
+
"number_particles",
|
|
154
|
+
"number_particles_internal_data",
|
|
155
|
+
"number_particles_min_speed",
|
|
156
|
+
"number_particles_min_speed_internal_data",
|
|
157
|
+
"number_particles_max_speed",
|
|
158
|
+
"number_particles_max_speed_internal_data",
|
|
159
|
+
"number_particles_min_diameter",
|
|
160
|
+
"number_particles_min_diameter_internal_data",
|
|
161
|
+
"number_particles_no_hydrometeor",
|
|
162
|
+
"number_particles_no_hydrometeor_internal_data",
|
|
163
|
+
"number_particles_unknown_classification",
|
|
164
|
+
"total_gross_volume_unknown_classification",
|
|
165
|
+
"number_particles_hail",
|
|
166
|
+
"total_gross_volume_hail",
|
|
167
|
+
"number_particles_solid_precipitation",
|
|
168
|
+
"total_gross_volume_solid_precipitation",
|
|
169
|
+
"number_particles_large_pellet",
|
|
170
|
+
"total_gross_volume_large_pellet",
|
|
171
|
+
"number_particles_small_pellet",
|
|
172
|
+
"total_gross_volume_small_pellet",
|
|
173
|
+
"number_particles_snowgrain",
|
|
174
|
+
"total_gross_volume_snowgrain",
|
|
175
|
+
"number_particles_rain",
|
|
176
|
+
"total_gross_volume_rain",
|
|
177
|
+
"number_particles_small_rain",
|
|
178
|
+
"total_gross_volume_small_rain",
|
|
179
|
+
"number_particles_drizzle",
|
|
180
|
+
"total_gross_volume_drizzle",
|
|
181
|
+
"number_particles_class_9",
|
|
182
|
+
"number_particles_class_9_internal_data",
|
|
183
|
+
"TO_BE_FURTHER_PROCESSED",
|
|
184
|
+
]
|
|
185
|
+
df.columns = names
|
|
186
|
+
|
|
187
|
+
# Extract the last variables remained in raw_drop_number
|
|
188
|
+
if df["TO_BE_FURTHER_PROCESSED"].iloc[0].count(";") == 444:
|
|
189
|
+
df_parsed = df["TO_BE_FURTHER_PROCESSED"].str.rsplit(";", n=5, expand=True)
|
|
190
|
+
df_parsed.columns = [
|
|
191
|
+
"raw_drop_number",
|
|
192
|
+
"air_temperature", # only values between 0 and 2
|
|
193
|
+
"relative_humidity", # 999
|
|
194
|
+
"wind_speed",
|
|
195
|
+
"wind_direction",
|
|
196
|
+
"checksum",
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
else: # 440
|
|
200
|
+
df_parsed = df["TO_BE_FURTHER_PROCESSED"].str.rsplit(";", n=1, expand=True)
|
|
201
|
+
df_parsed.columns = [
|
|
202
|
+
"raw_drop_number",
|
|
203
|
+
"checksum",
|
|
204
|
+
]
|
|
205
|
+
# Add missing met variables columns
|
|
206
|
+
met_vars = [
|
|
207
|
+
"air_temperature",
|
|
208
|
+
"relative_humidity",
|
|
209
|
+
"wind_speed",
|
|
210
|
+
"wind_direction",
|
|
211
|
+
]
|
|
212
|
+
for var in met_vars:
|
|
213
|
+
df_parsed[var] = "NaN"
|
|
214
|
+
|
|
215
|
+
# Assign columns to the original dataframe
|
|
216
|
+
df[df_parsed.columns] = df_parsed
|
|
217
|
+
|
|
218
|
+
# Identify rows with bad sensor date (compared to file name)
|
|
219
|
+
filename = os.path.basename(filepath)
|
|
220
|
+
file_date_str = filename[0:8]
|
|
221
|
+
idx_bad_date = df["sensor_date"] != pd.to_datetime(file_date_str, format="%Y%m%d").strftime("%d.%m.%y")
|
|
222
|
+
|
|
223
|
+
# If all rows have bad sensor_date, use the one of the file name
|
|
224
|
+
if idx_bad_date.all():
|
|
225
|
+
# - Infer and define "time" column
|
|
226
|
+
start_time_str = filename[0:10]
|
|
227
|
+
start_time = pd.to_datetime(start_time_str, format="%Y%m%d%H")
|
|
228
|
+
|
|
229
|
+
# - Define timedelta based on sensor_time
|
|
230
|
+
# --> Add +24h to subsequent times when time resets
|
|
231
|
+
dt = pd.to_timedelta(df["sensor_time"]).to_numpy().astype("m8[s]")
|
|
232
|
+
rollover_indices = np.where(np.diff(dt) < np.timedelta64(0, "s"))[0]
|
|
233
|
+
if rollover_indices.size > 0:
|
|
234
|
+
for idx in rollover_indices:
|
|
235
|
+
dt[idx + 1 :] += np.timedelta64(24, "h")
|
|
236
|
+
dt = dt - dt[0]
|
|
237
|
+
|
|
238
|
+
# - Define approximate time
|
|
239
|
+
df["time"] = start_time + dt
|
|
240
|
+
|
|
241
|
+
# - Keep rows where time increment is between 00 and 59 minutes
|
|
242
|
+
valid_rows = dt <= np.timedelta64(3540, "s")
|
|
243
|
+
df = df[valid_rows]
|
|
244
|
+
|
|
245
|
+
# If only some rows have bad sensor date, just drop such bad rows
|
|
246
|
+
else:
|
|
247
|
+
if idx_bad_date.any():
|
|
248
|
+
# Remove rows with bad dates
|
|
249
|
+
bad_dates = df[idx_bad_date]["sensor_date"].unique().tolist()
|
|
250
|
+
df = df[~idx_bad_date]
|
|
251
|
+
msg = f"{filepath} contain rows with the following unexpected sensor_date values {bad_dates}"
|
|
252
|
+
log_warning(msg=msg, logger=logger)
|
|
253
|
+
|
|
254
|
+
# Define datetime "time" column
|
|
255
|
+
df["time"] = df["sensor_date"] + "-" + df["sensor_time"]
|
|
256
|
+
df["time"] = pd.to_datetime(df["time"], format="%d.%m.%y-%H:%M:%S", errors="coerce")
|
|
257
|
+
|
|
258
|
+
# Drop row if start_identifier different than 00
|
|
259
|
+
df = df[df["start_identifier"].astype(str) == "00"]
|
|
260
|
+
|
|
261
|
+
# Drop rows with invalid raw_drop_number
|
|
262
|
+
df = df[df["raw_drop_number"].astype(str).str.len() == 1759]
|
|
263
|
+
|
|
264
|
+
# Drop columns not agreeing with DISDRODB L0 standards
|
|
265
|
+
columns_to_drop = [
|
|
266
|
+
"start_identifier",
|
|
267
|
+
"device_address",
|
|
268
|
+
"sensor_serial_number",
|
|
269
|
+
"sensor_date",
|
|
270
|
+
"sensor_time",
|
|
271
|
+
"air_temperature",
|
|
272
|
+
"relative_humidity",
|
|
273
|
+
"TO_BE_FURTHER_PROCESSED",
|
|
274
|
+
"checksum",
|
|
275
|
+
]
|
|
276
|
+
df = df.drop(columns=columns_to_drop)
|
|
277
|
+
return df
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
# -----------------------------------------------------------------------------.
|
|
17
17
|
"""DISDRODB reader for GID LPM sensor TC-PI with incorrect reported time."""
|
|
18
|
+
|
|
18
19
|
import pandas as pd
|
|
19
20
|
|
|
20
21
|
from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
|
|
@@ -152,23 +153,23 @@ def read_txt_file(file, filename, logger):
|
|
|
152
153
|
"number_particles_no_hydrometeor",
|
|
153
154
|
"number_particles_no_hydrometeor_internal_data",
|
|
154
155
|
"number_particles_unknown_classification",
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
156
|
+
"total_gross_volume_unknown_classification",
|
|
157
|
+
"number_particles_hail",
|
|
158
|
+
"total_gross_volume_hail",
|
|
159
|
+
"number_particles_solid_precipitation",
|
|
160
|
+
"total_gross_volume_solid_precipitation",
|
|
161
|
+
"number_particles_large_pellet",
|
|
162
|
+
"total_gross_volume_large_pellet",
|
|
163
|
+
"number_particles_small_pellet",
|
|
164
|
+
"total_gross_volume_small_pellet",
|
|
165
|
+
"number_particles_snowgrain",
|
|
166
|
+
"total_gross_volume_snowgrain",
|
|
167
|
+
"number_particles_rain",
|
|
168
|
+
"total_gross_volume_rain",
|
|
169
|
+
"number_particles_small_rain",
|
|
170
|
+
"total_gross_volume_small_rain",
|
|
171
|
+
"number_particles_drizzle",
|
|
172
|
+
"total_gross_volume_drizzle",
|
|
172
173
|
"number_particles_class_9",
|
|
173
174
|
"number_particles_class_9_internal_data",
|
|
174
175
|
"TO_BE_FURTHER_PROCESSED",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
# -----------------------------------------------------------------------------.
|
|
17
17
|
"""DISDRODB reader for GID LPM sensors not reporting time (TC-MI2, TC-MI3, TC-ER e TC-FI)."""
|
|
18
|
+
|
|
18
19
|
import numpy as np
|
|
19
20
|
import pandas as pd
|
|
20
21
|
|
|
@@ -146,23 +147,23 @@ def read_txt_file(file, filename, logger):
|
|
|
146
147
|
"number_particles_no_hydrometeor",
|
|
147
148
|
"number_particles_no_hydrometeor_internal_data",
|
|
148
149
|
"number_particles_unknown_classification",
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
150
|
+
"total_gross_volume_unknown_classification",
|
|
151
|
+
"number_particles_hail",
|
|
152
|
+
"total_gross_volume_hail",
|
|
153
|
+
"number_particles_solid_precipitation",
|
|
154
|
+
"total_gross_volume_solid_precipitation",
|
|
155
|
+
"number_particles_large_pellet",
|
|
156
|
+
"total_gross_volume_large_pellet",
|
|
157
|
+
"number_particles_small_pellet",
|
|
158
|
+
"total_gross_volume_small_pellet",
|
|
159
|
+
"number_particles_snowgrain",
|
|
160
|
+
"total_gross_volume_snowgrain",
|
|
161
|
+
"number_particles_rain",
|
|
162
|
+
"total_gross_volume_rain",
|
|
163
|
+
"number_particles_small_rain",
|
|
164
|
+
"total_gross_volume_small_rain",
|
|
165
|
+
"number_particles_drizzle",
|
|
166
|
+
"total_gross_volume_drizzle",
|
|
166
167
|
"number_particles_class_9",
|
|
167
168
|
"number_particles_class_9_internal_data",
|
|
168
169
|
"raw_drop_number",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
# -----------------------------------------------------------------------------.
|
|
17
17
|
"""DISDRODB reader for GID LPM sensors measuring also wind."""
|
|
18
|
+
|
|
18
19
|
import pandas as pd
|
|
19
20
|
|
|
20
21
|
from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
|
|
@@ -145,23 +146,23 @@ def reader(
|
|
|
145
146
|
"number_particles_no_hydrometeor",
|
|
146
147
|
"number_particles_no_hydrometeor_internal_data",
|
|
147
148
|
"number_particles_unknown_classification",
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
149
|
+
"total_gross_volume_unknown_classification",
|
|
150
|
+
"number_particles_hail",
|
|
151
|
+
"total_gross_volume_hail",
|
|
152
|
+
"number_particles_solid_precipitation",
|
|
153
|
+
"total_gross_volume_solid_precipitation",
|
|
154
|
+
"number_particles_large_pellet",
|
|
155
|
+
"total_gross_volume_large_pellet",
|
|
156
|
+
"number_particles_small_pellet",
|
|
157
|
+
"total_gross_volume_small_pellet",
|
|
158
|
+
"number_particles_snowgrain",
|
|
159
|
+
"total_gross_volume_snowgrain",
|
|
160
|
+
"number_particles_rain",
|
|
161
|
+
"total_gross_volume_rain",
|
|
162
|
+
"number_particles_small_rain",
|
|
163
|
+
"total_gross_volume_small_rain",
|
|
164
|
+
"number_particles_drizzle",
|
|
165
|
+
"total_gross_volume_drizzle",
|
|
165
166
|
"number_particles_class_9",
|
|
166
167
|
"number_particles_class_9_internal_data",
|
|
167
168
|
"TO_BE_FURTHER_PROCESSED",
|
|
@@ -204,5 +205,4 @@ def reader(
|
|
|
204
205
|
"TO_BE_FURTHER_PROCESSED",
|
|
205
206
|
]
|
|
206
207
|
df = df.drop(columns=columns_to_drop)
|
|
207
|
-
|
|
208
208
|
return df
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
# -----------------------------------------------------------------------------.
|
|
17
17
|
"""DISDRODB reader for GID LPM sensors not measuring wind."""
|
|
18
|
+
|
|
18
19
|
import os
|
|
19
20
|
|
|
20
21
|
import pandas as pd
|
|
@@ -149,23 +150,23 @@ def reader(
|
|
|
149
150
|
"number_particles_no_hydrometeor",
|
|
150
151
|
"number_particles_no_hydrometeor_internal_data",
|
|
151
152
|
"number_particles_unknown_classification",
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
153
|
+
"total_gross_volume_unknown_classification",
|
|
154
|
+
"number_particles_hail",
|
|
155
|
+
"total_gross_volume_hail",
|
|
156
|
+
"number_particles_solid_precipitation",
|
|
157
|
+
"total_gross_volume_solid_precipitation",
|
|
158
|
+
"number_particles_large_pellet",
|
|
159
|
+
"total_gross_volume_large_pellet",
|
|
160
|
+
"number_particles_small_pellet",
|
|
161
|
+
"total_gross_volume_small_pellet",
|
|
162
|
+
"number_particles_snowgrain",
|
|
163
|
+
"total_gross_volume_snowgrain",
|
|
164
|
+
"number_particles_rain",
|
|
165
|
+
"total_gross_volume_rain",
|
|
166
|
+
"number_particles_small_rain",
|
|
167
|
+
"total_gross_volume_small_rain",
|
|
168
|
+
"number_particles_drizzle",
|
|
169
|
+
"total_gross_volume_drizzle",
|
|
169
170
|
"number_particles_class_9",
|
|
170
171
|
"number_particles_class_9_internal_data",
|
|
171
172
|
"raw_drop_number",
|
|
@@ -74,23 +74,23 @@ def reader(
|
|
|
74
74
|
"number_of_particles_faster_than_20": "number_particles_max_speed",
|
|
75
75
|
"number_of_particles_smaller_than_0.15": "number_particles_min_diameter",
|
|
76
76
|
"number_of_particles_with_unknown_classification": "number_particles_unknown_classification",
|
|
77
|
-
"total_volume_gross_particles_unknown_classification": "
|
|
78
|
-
"number_of_particles_class_1": "
|
|
79
|
-
"total_volume_gross_of_class_1": "
|
|
80
|
-
"number_of_particles_class_2": "
|
|
81
|
-
"total_volume_gross_of_class_2": "
|
|
82
|
-
"number_of_particles_class_3": "
|
|
83
|
-
"total_volume_gross_of_class_3": "
|
|
84
|
-
"number_of_particles_class_4": "
|
|
85
|
-
"total_volume_gross_of_class_4": "
|
|
86
|
-
"number_of_particles_class_5": "
|
|
87
|
-
"total_volume_gross_of_class_5": "
|
|
88
|
-
"number_of_particles_class_6": "
|
|
89
|
-
"total_volume_gross_of_class_6": "
|
|
90
|
-
"number_of_particles_class_7": "
|
|
91
|
-
"total_volume_gross_of_class_7": "
|
|
92
|
-
"number_of_particles_class_8": "
|
|
93
|
-
"total_volume_gross_of_class_8": "
|
|
77
|
+
"total_volume_gross_particles_unknown_classification": "total_gross_volume_unknown_classification",
|
|
78
|
+
"number_of_particles_class_1": "number_particles_hail",
|
|
79
|
+
"total_volume_gross_of_class_1": "total_gross_volume_hail",
|
|
80
|
+
"number_of_particles_class_2": "number_particles_solid_precipitation",
|
|
81
|
+
"total_volume_gross_of_class_2": "total_gross_volume_solid_precipitation",
|
|
82
|
+
"number_of_particles_class_3": "number_particles_large_pellet",
|
|
83
|
+
"total_volume_gross_of_class_3": "total_gross_volume_large_pellet",
|
|
84
|
+
"number_of_particles_class_4": "number_particles_small_pellet",
|
|
85
|
+
"total_volume_gross_of_class_4": "total_gross_volume_small_pellet",
|
|
86
|
+
"number_of_particles_class_5": "number_particles_snowgrain",
|
|
87
|
+
"total_volume_gross_of_class_5": "total_gross_volume_snowgrain",
|
|
88
|
+
"number_of_particles_class_6": "number_particles_rain",
|
|
89
|
+
"total_volume_gross_of_class_6": "total_gross_volume_rain",
|
|
90
|
+
"number_of_particles_class_7": "number_particles_small_rain",
|
|
91
|
+
"total_volume_gross_of_class_7": "total_gross_volume_small_rain",
|
|
92
|
+
"number_of_particles_class_8": "number_particles_drizzle",
|
|
93
|
+
"total_volume_gross_of_class_8": "total_gross_volume_drizzle",
|
|
94
94
|
"number_of_particles_class_9": "number_particles_class_9",
|
|
95
95
|
"total_volume_gross_of_class_9": "number_particles_class_9_internal_data",
|
|
96
96
|
"raw_data": "raw_drop_number",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
# -----------------------------------------------------------------------------.
|
|
17
17
|
"""DISDRODB reader for Haukeliseter Test Site LPM sensors."""
|
|
18
|
+
|
|
18
19
|
import numpy as np
|
|
19
20
|
import pandas as pd
|
|
20
21
|
|
|
@@ -167,23 +168,23 @@ def reader(
|
|
|
167
168
|
"number_particles_no_hydrometeor",
|
|
168
169
|
"number_particles_no_hydrometeor_internal_data",
|
|
169
170
|
"number_particles_unknown_classification",
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
171
|
+
"total_gross_volume_unknown_classification",
|
|
172
|
+
"number_particles_hail",
|
|
173
|
+
"total_gross_volume_hail",
|
|
174
|
+
"number_particles_solid_precipitation",
|
|
175
|
+
"total_gross_volume_solid_precipitation",
|
|
176
|
+
"number_particles_large_pellet",
|
|
177
|
+
"total_gross_volume_large_pellet",
|
|
178
|
+
"number_particles_small_pellet",
|
|
179
|
+
"total_gross_volume_small_pellet",
|
|
180
|
+
"number_particles_snowgrain",
|
|
181
|
+
"total_gross_volume_snowgrain",
|
|
182
|
+
"number_particles_rain",
|
|
183
|
+
"total_gross_volume_rain",
|
|
184
|
+
"number_particles_small_rain",
|
|
185
|
+
"total_gross_volume_small_rain",
|
|
186
|
+
"number_particles_drizzle",
|
|
187
|
+
"total_gross_volume_drizzle",
|
|
187
188
|
"number_particles_class_9",
|
|
188
189
|
"number_particles_class_9_internal_data",
|
|
189
190
|
"raw_drop_number",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
# -----------------------------------------------------------------------------.
|
|
17
17
|
"""DISDRODB reader for NMBU BIOKLIM LPM sensor."""
|
|
18
|
+
|
|
18
19
|
import os
|
|
19
20
|
|
|
20
21
|
import pandas as pd
|
|
@@ -156,23 +157,23 @@ def reader(
|
|
|
156
157
|
"number_particles_no_hydrometeor",
|
|
157
158
|
"number_particles_no_hydrometeor_internal_data",
|
|
158
159
|
"number_particles_unknown_classification",
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
160
|
+
"total_gross_volume_unknown_classification",
|
|
161
|
+
"number_particles_hail",
|
|
162
|
+
"total_gross_volume_hail",
|
|
163
|
+
"number_particles_solid_precipitation",
|
|
164
|
+
"total_gross_volume_solid_precipitation",
|
|
165
|
+
"number_particles_large_pellet",
|
|
166
|
+
"total_gross_volume_large_pellet",
|
|
167
|
+
"number_particles_small_pellet",
|
|
168
|
+
"total_gross_volume_small_pellet",
|
|
169
|
+
"number_particles_snowgrain",
|
|
170
|
+
"total_gross_volume_snowgrain",
|
|
171
|
+
"number_particles_rain",
|
|
172
|
+
"total_gross_volume_rain",
|
|
173
|
+
"number_particles_small_rain",
|
|
174
|
+
"total_gross_volume_small_rain",
|
|
175
|
+
"number_particles_drizzle",
|
|
176
|
+
"total_gross_volume_drizzle",
|
|
176
177
|
"number_particles_class_9",
|
|
177
178
|
"number_particles_class_9_internal_data",
|
|
178
179
|
"raw_drop_number",
|