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
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
# -----------------------------------------------------------------------------.
|
|
4
|
+
# Copyright (c) 2021-2023 DISDRODB developers
|
|
5
|
+
#
|
|
6
|
+
# This program is free software: you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU General Public License
|
|
17
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
# -----------------------------------------------------------------------------.
|
|
19
|
+
"""DISDRODB reader for ENPC PWS100 raw text data."""
|
|
20
|
+
import zipfile
|
|
21
|
+
|
|
22
|
+
import pandas as pd
|
|
23
|
+
|
|
24
|
+
from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
|
|
25
|
+
from disdrodb.utils.logger import log_error, log_warning
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@is_documented_by(reader_generic_docstring)
|
|
29
|
+
def reader(
|
|
30
|
+
filepath,
|
|
31
|
+
logger=None,
|
|
32
|
+
):
|
|
33
|
+
"""Reader."""
|
|
34
|
+
|
|
35
|
+
##------------------------------------------------------------------------.
|
|
36
|
+
#### Define function to read each txt file inside each daily zip file
|
|
37
|
+
def read_txt_file(file, filename, logger): # noqa PLR0911
|
|
38
|
+
"""Parse a single txt file within the daily zip file."""
|
|
39
|
+
# Read file
|
|
40
|
+
try:
|
|
41
|
+
txt = file.readline().decode("utf-8")
|
|
42
|
+
except Exception:
|
|
43
|
+
log_warning(logger=logger, msg=f"{filename} is corrupted", verbose=False)
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
# Check file is not empty
|
|
47
|
+
if txt == "":
|
|
48
|
+
log_warning(logger=logger, msg=f"{filename} is empty", verbose=False)
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
if "PSU voltage too low" in txt or "volt" in txt:
|
|
52
|
+
log_warning(logger=logger, msg=f"PSU voltage too low in {filename}", verbose=False)
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
if "Error - message" in txt:
|
|
56
|
+
log_warning(logger=logger, msg=f"Error message in {filename}", verbose=False)
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
# Clean up the line
|
|
60
|
+
txt = txt.replace(" 00 ", " 0 0 ")
|
|
61
|
+
txt = txt.replace(" ", " 0 ")
|
|
62
|
+
txt = txt[1:-8]
|
|
63
|
+
|
|
64
|
+
# Split the cleaned line
|
|
65
|
+
buf = txt.split(" ")
|
|
66
|
+
|
|
67
|
+
# Helper to convert list of floats to comma-separated string
|
|
68
|
+
def int_list_to_str(lst):
|
|
69
|
+
return ",".join(f"{int(i)}" for i in lst)
|
|
70
|
+
|
|
71
|
+
# Try to get the drop_size distribution:
|
|
72
|
+
try:
|
|
73
|
+
drop_size_distribution = int_list_to_str(buf[30:330]) # Drop size distribution (message field 42)
|
|
74
|
+
except Exception:
|
|
75
|
+
log_warning(logger, msg=f"Corrupted drop_size_distribution field in {filename}", verbose=False)
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
# Try to get peak_to_pedestal_hist
|
|
79
|
+
try:
|
|
80
|
+
peak_to_pedestal_hist = int_list_to_str(buf[1499:1549])
|
|
81
|
+
except Exception:
|
|
82
|
+
log_warning(
|
|
83
|
+
logger,
|
|
84
|
+
msg=f"Corrupted raw_drop_number or peak_to_pedestal_hist field in {filename}",
|
|
85
|
+
verbose=False,
|
|
86
|
+
)
|
|
87
|
+
return None
|
|
88
|
+
# Parse fields
|
|
89
|
+
data = {
|
|
90
|
+
"mor_visibility": float(buf[2]), # Visibility Range (message field 20)
|
|
91
|
+
"weather_code_synop_4680": float(buf[3]), # Present Weather Code (WMO) (message field 21)
|
|
92
|
+
"weather_code_metar_4678": buf[4], # Present Weather Code (METAR) (message field 22)
|
|
93
|
+
"weather_code_nws": buf[5], # Present Weather Code (NWS) (message field 23)
|
|
94
|
+
"alarms": int_list_to_str(buf[6:22]), # Alarms (message field (24))
|
|
95
|
+
"sensor_status": buf[22], # Fault status of PWS100 (message field 25)
|
|
96
|
+
"air_temperature": float(buf[23]), # Temperature (°C) (message field 30)
|
|
97
|
+
"relative_humidity": float(buf[24]), # Sampled relative humidity (%) (message field 30)
|
|
98
|
+
"wetbulb_temperature": float(buf[25]), # Average wetbulb temperature (°C)(message field 30)
|
|
99
|
+
"air_temperature_max": float(buf[26]), # Maximum temperature (°C)(message field 31)
|
|
100
|
+
"air_temperature_min": float(buf[27]), # Minimum temperature (°C)(message field 31)
|
|
101
|
+
"rainfall_rate": float(buf[28]), # Precipitation rate (mm/h)(message field 40)
|
|
102
|
+
"rainfall_accumulated": float(buf[29]), # Precipitation accumulation (mm/h)(message field 41)
|
|
103
|
+
"drop_size_distribution": drop_size_distribution, # Drop size distribution (message field 42)
|
|
104
|
+
"average_drop_velocity": float(buf[330]), # Average velocity (mm/s)(message field 43)
|
|
105
|
+
"average_drop_size": float(buf[331]), # Average size (mm/h)(message field 43)
|
|
106
|
+
"type_distribution": int_list_to_str(buf[332:343]), # Type distribution (message field 44)
|
|
107
|
+
"raw_drop_number": int_list_to_str(buf[343:1499]), # Size/velocity spectrum (34*34) (message field 47)
|
|
108
|
+
"peak_to_pedestal_hist": (
|
|
109
|
+
peak_to_pedestal_hist # Peak to pedestal ratio distribution histogram (message field 48)
|
|
110
|
+
),
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
# Convert to single-row DataFrame
|
|
114
|
+
df = pd.DataFrame([data])
|
|
115
|
+
|
|
116
|
+
# Define datetime "time" column from filename
|
|
117
|
+
datetime_str = " ".join(filename.replace(".txt", "").split("_")[-6:])
|
|
118
|
+
df["time"] = pd.to_datetime(datetime_str, format="%Y %m %d %H %M %S")
|
|
119
|
+
|
|
120
|
+
# # Drop columns not agreeing with DISDRODB L0 standards
|
|
121
|
+
# columns_to_drop = [
|
|
122
|
+
# "peak_to_pedestal_hist",
|
|
123
|
+
# "type_distribution",
|
|
124
|
+
# ]
|
|
125
|
+
# df = df.drop(columns=columns_to_drop)
|
|
126
|
+
return df
|
|
127
|
+
|
|
128
|
+
# ---------------------------------------------------------------------.
|
|
129
|
+
#### Iterate over all files (aka timesteps) in the daily zip archive
|
|
130
|
+
# - Each file contain a single timestep !
|
|
131
|
+
list_df = []
|
|
132
|
+
with zipfile.ZipFile(filepath, "r") as zip_ref:
|
|
133
|
+
filenames = sorted(zip_ref.namelist())
|
|
134
|
+
for filename in filenames:
|
|
135
|
+
if filename.endswith(".txt"):
|
|
136
|
+
# Open file
|
|
137
|
+
with zip_ref.open(filename) as f:
|
|
138
|
+
try:
|
|
139
|
+
df = read_txt_file(file=f, filename=filename, logger=logger)
|
|
140
|
+
if df is not None:
|
|
141
|
+
list_df.append(df)
|
|
142
|
+
except Exception as e:
|
|
143
|
+
msg = f"An error occurred while reading {filename}. The error is: {e}."
|
|
144
|
+
log_error(logger=logger, msg=msg, verbose=True)
|
|
145
|
+
|
|
146
|
+
# Concatenate all dataframes into a single one
|
|
147
|
+
df = pd.concat(list_df)
|
|
148
|
+
|
|
149
|
+
# ---------------------------------------------------------------------.
|
|
150
|
+
return df
|
|
@@ -16,28 +16,25 @@
|
|
|
16
16
|
# You should have received a copy of the GNU General Public License
|
|
17
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
# -----------------------------------------------------------------------------.
|
|
19
|
-
|
|
19
|
+
import pandas as pd
|
|
20
|
+
|
|
20
21
|
from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
|
|
22
|
+
from disdrodb.l0.l0a_processing import read_raw_text_file
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
@is_documented_by(reader_generic_docstring)
|
|
24
26
|
def reader(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
station_name,
|
|
28
|
-
# Processing options
|
|
29
|
-
force=False,
|
|
30
|
-
verbose=False,
|
|
31
|
-
parallel=False,
|
|
32
|
-
debugging_mode=False,
|
|
27
|
+
filepath,
|
|
28
|
+
logger=None,
|
|
33
29
|
):
|
|
30
|
+
"""Reader."""
|
|
34
31
|
##------------------------------------------------------------------------.
|
|
35
|
-
####
|
|
32
|
+
#### Define column names
|
|
36
33
|
column_names = [
|
|
37
34
|
"date",
|
|
38
35
|
"time",
|
|
39
36
|
"sensor_status",
|
|
40
|
-
"
|
|
37
|
+
"sample_interval",
|
|
41
38
|
"n1",
|
|
42
39
|
"n2",
|
|
43
40
|
"n3",
|
|
@@ -64,7 +61,7 @@ def reader(
|
|
|
64
61
|
]
|
|
65
62
|
|
|
66
63
|
##------------------------------------------------------------------------.
|
|
67
|
-
####
|
|
64
|
+
#### Define reader options
|
|
68
65
|
reader_kwargs = {}
|
|
69
66
|
# - Define delimiter
|
|
70
67
|
reader_kwargs["delimiter"] = "\\t"
|
|
@@ -86,59 +83,38 @@ def reader(
|
|
|
86
83
|
# - Available: gzip, bz2, zip
|
|
87
84
|
reader_kwargs["compression"] = "infer"
|
|
88
85
|
# - Strings to recognize as NA/NaN and replace with standard NA flags
|
|
89
|
-
# - Already included:
|
|
90
|
-
#
|
|
91
|
-
#
|
|
86
|
+
# - Already included: '#N/A', '#N/A N/A', '#NA', '-1.#IND', '-1.#QNAN',
|
|
87
|
+
# '-NaN', '-nan', '1.#IND', '1.#QNAN', '<NA>', 'N/A',
|
|
88
|
+
# 'NA', 'NULL', 'NaN', 'n/a', 'nan', 'null'
|
|
92
89
|
reader_kwargs["na_values"] = ["na", "", "error"]
|
|
93
90
|
|
|
94
91
|
##------------------------------------------------------------------------.
|
|
95
|
-
####
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# - Replace all ',' with '.' in RI, RA, RAT
|
|
104
|
-
df["RI"] = df["RI"].replace({",": "."}, regex=True)
|
|
105
|
-
df["RA"] = df["RA"].replace({",": "."}, regex=True)
|
|
106
|
-
df["RAT"] = df["RAT"].replace({",": "."}, regex=True)
|
|
107
|
-
|
|
108
|
-
# - Define 'time' datetime column
|
|
109
|
-
df["time"] = df["date"].astype(str) + " " + df["time"].astype(str)
|
|
110
|
-
df["time"] = pd.to_datetime(df["time"], format="%Y-%m-%d %H:%M:%S", errors="coerce")
|
|
111
|
-
df = df.drop(columns=["date"])
|
|
92
|
+
#### Read the data
|
|
93
|
+
df = read_raw_text_file(
|
|
94
|
+
filepath=filepath,
|
|
95
|
+
column_names=column_names,
|
|
96
|
+
reader_kwargs=reader_kwargs,
|
|
97
|
+
logger=logger,
|
|
98
|
+
)
|
|
112
99
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
df["raw_drop_number"] = df_raw_drop_number
|
|
100
|
+
##------------------------------------------------------------------------.
|
|
101
|
+
#### Adapt the dataframe to adhere to DISDRODB L0 standards
|
|
102
|
+
# Replace 'status' NaN with 0
|
|
103
|
+
df["sensor_status"] = df["sensor_status"].astype(float).fillna(value=0).astype(int)
|
|
118
104
|
|
|
119
|
-
|
|
120
|
-
|
|
105
|
+
# Define 'time' datetime column
|
|
106
|
+
df["time"] = df["date"].astype(str) + " " + df["time"].astype(str)
|
|
107
|
+
df["time"] = pd.to_datetime(df["time"], format="%Y-%m-%d %H:%M:%S", errors="coerce")
|
|
108
|
+
df = df.drop(columns=["date"])
|
|
121
109
|
|
|
122
|
-
|
|
110
|
+
# Create raw_drop_number column
|
|
111
|
+
bin_columns = ["n" + str(i) for i in range(1, 21)]
|
|
112
|
+
df_arr = df[bin_columns]
|
|
113
|
+
df_raw_drop_number = df_arr.agg(";".join, axis=1)
|
|
114
|
+
df["raw_drop_number"] = df_raw_drop_number
|
|
123
115
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
glob_patterns = "*.txt"
|
|
116
|
+
# Remove bins columns
|
|
117
|
+
df = df.drop(columns=bin_columns)
|
|
127
118
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
run_l0a(
|
|
131
|
-
raw_dir=raw_dir,
|
|
132
|
-
processed_dir=processed_dir,
|
|
133
|
-
station_name=station_name,
|
|
134
|
-
# Custom arguments of the reader for L0A processing
|
|
135
|
-
glob_patterns=glob_patterns,
|
|
136
|
-
column_names=column_names,
|
|
137
|
-
reader_kwargs=reader_kwargs,
|
|
138
|
-
df_sanitizer_fun=df_sanitizer_fun,
|
|
139
|
-
# Processing options
|
|
140
|
-
force=force,
|
|
141
|
-
verbose=verbose,
|
|
142
|
-
parallel=parallel,
|
|
143
|
-
debugging_mode=debugging_mode,
|
|
144
|
-
)
|
|
119
|
+
# Return the dataframe adhering to DISDRODB L0 standards
|
|
120
|
+
return df
|
|
@@ -16,28 +16,25 @@
|
|
|
16
16
|
# You should have received a copy of the GNU General Public License
|
|
17
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
# -----------------------------------------------------------------------------.
|
|
19
|
-
|
|
19
|
+
import pandas as pd
|
|
20
|
+
|
|
20
21
|
from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
|
|
22
|
+
from disdrodb.l0.l0a_processing import read_raw_text_file
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
@is_documented_by(reader_generic_docstring)
|
|
24
26
|
def reader(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
station_name,
|
|
28
|
-
# Processing options
|
|
29
|
-
force=False,
|
|
30
|
-
verbose=False,
|
|
31
|
-
parallel=False,
|
|
32
|
-
debugging_mode=False,
|
|
27
|
+
filepath,
|
|
28
|
+
logger=None,
|
|
33
29
|
):
|
|
30
|
+
"""Reader."""
|
|
34
31
|
##------------------------------------------------------------------------.
|
|
35
|
-
####
|
|
32
|
+
#### Define column names
|
|
36
33
|
column_names = [
|
|
37
34
|
"date",
|
|
38
35
|
"time",
|
|
39
36
|
"sensor_status",
|
|
40
|
-
"
|
|
37
|
+
"sample_interval",
|
|
41
38
|
"n1",
|
|
42
39
|
"n2",
|
|
43
40
|
"n3",
|
|
@@ -64,7 +61,7 @@ def reader(
|
|
|
64
61
|
]
|
|
65
62
|
|
|
66
63
|
##------------------------------------------------------------------------.
|
|
67
|
-
####
|
|
64
|
+
#### Define reader options
|
|
68
65
|
reader_kwargs = {}
|
|
69
66
|
# - Define delimiter
|
|
70
67
|
reader_kwargs["delimiter"] = "\\t"
|
|
@@ -86,54 +83,38 @@ def reader(
|
|
|
86
83
|
# - Available: gzip, bz2, zip
|
|
87
84
|
reader_kwargs["compression"] = "infer"
|
|
88
85
|
# - Strings to recognize as NA/NaN and replace with standard NA flags
|
|
89
|
-
# - Already included:
|
|
90
|
-
#
|
|
91
|
-
#
|
|
86
|
+
# - Already included: '#N/A', '#N/A N/A', '#NA', '-1.#IND', '-1.#QNAN',
|
|
87
|
+
# '-NaN', '-nan', '1.#IND', '1.#QNAN', '<NA>', 'N/A',
|
|
88
|
+
# 'NA', 'NULL', 'NaN', 'n/a', 'nan', 'null'
|
|
92
89
|
reader_kwargs["na_values"] = ["na", "", "error"]
|
|
93
90
|
|
|
94
91
|
##------------------------------------------------------------------------.
|
|
95
|
-
####
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# - Define 'time' datetime column
|
|
104
|
-
df["time"] = df["date"].astype(str) + " " + df["time"].astype(str)
|
|
105
|
-
df["time"] = pd.to_datetime(df["time"], format="%Y-%m-%d %H:%M:%S", errors="coerce")
|
|
106
|
-
df = df.drop(columns=["date"])
|
|
92
|
+
#### Read the data
|
|
93
|
+
df = read_raw_text_file(
|
|
94
|
+
filepath=filepath,
|
|
95
|
+
column_names=column_names,
|
|
96
|
+
reader_kwargs=reader_kwargs,
|
|
97
|
+
logger=logger,
|
|
98
|
+
)
|
|
107
99
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
df["raw_drop_number"] = df_raw_drop_number
|
|
100
|
+
##------------------------------------------------------------------------.
|
|
101
|
+
#### Adapt the dataframe to adhere to DISDRODB L0 standards
|
|
102
|
+
# Replace 'status' NaN with 0
|
|
103
|
+
df["sensor_status"] = df["sensor_status"].astype(float).fillna(value=0).astype(int)
|
|
113
104
|
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
# Define 'time' datetime column
|
|
106
|
+
df["time"] = df["date"].astype(str) + " " + df["time"].astype(str)
|
|
107
|
+
df["time"] = pd.to_datetime(df["time"], format="%Y-%m-%d %H:%M:%S", errors="coerce")
|
|
108
|
+
df = df.drop(columns=["date"])
|
|
116
109
|
|
|
117
|
-
|
|
110
|
+
# Create raw_drop_number column
|
|
111
|
+
bin_columns = ["n" + str(i) for i in range(1, 21)]
|
|
112
|
+
df_arr = df[bin_columns]
|
|
113
|
+
df_raw_drop_number = df_arr.agg(";".join, axis=1)
|
|
114
|
+
df["raw_drop_number"] = df_raw_drop_number
|
|
118
115
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
glob_patterns = "*/*/DISL*" # <year>/<month>
|
|
116
|
+
# Remove bins columns
|
|
117
|
+
df = df.drop(columns=bin_columns)
|
|
122
118
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
run_l0a(
|
|
126
|
-
raw_dir=raw_dir,
|
|
127
|
-
processed_dir=processed_dir,
|
|
128
|
-
station_name=station_name,
|
|
129
|
-
# Custom arguments of the reader for L0A processing
|
|
130
|
-
glob_patterns=glob_patterns,
|
|
131
|
-
column_names=column_names,
|
|
132
|
-
reader_kwargs=reader_kwargs,
|
|
133
|
-
df_sanitizer_fun=df_sanitizer_fun,
|
|
134
|
-
# Processing options
|
|
135
|
-
force=force,
|
|
136
|
-
verbose=verbose,
|
|
137
|
-
parallel=parallel,
|
|
138
|
-
debugging_mode=debugging_mode,
|
|
139
|
-
)
|
|
119
|
+
# Return the dataframe adhering to DISDRODB L0 standards
|
|
120
|
+
return df
|
|
@@ -16,23 +16,20 @@
|
|
|
16
16
|
# You should have received a copy of the GNU General Public License
|
|
17
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
# -----------------------------------------------------------------------------.
|
|
19
|
-
|
|
19
|
+
import pandas as pd
|
|
20
|
+
|
|
20
21
|
from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
|
|
22
|
+
from disdrodb.l0.l0a_processing import read_raw_text_file
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
@is_documented_by(reader_generic_docstring)
|
|
24
26
|
def reader(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
station_name,
|
|
28
|
-
# Processing options
|
|
29
|
-
force=False,
|
|
30
|
-
verbose=False,
|
|
31
|
-
parallel=False,
|
|
32
|
-
debugging_mode=False,
|
|
27
|
+
filepath,
|
|
28
|
+
logger=None,
|
|
33
29
|
):
|
|
30
|
+
"""Reader."""
|
|
34
31
|
##------------------------------------------------------------------------.
|
|
35
|
-
####
|
|
32
|
+
#### Define column names
|
|
36
33
|
column_names = [
|
|
37
34
|
"date",
|
|
38
35
|
"time",
|
|
@@ -67,7 +64,7 @@ def reader(
|
|
|
67
64
|
]
|
|
68
65
|
|
|
69
66
|
##------------------------------------------------------------------------.
|
|
70
|
-
####
|
|
67
|
+
#### Define reader options
|
|
71
68
|
reader_kwargs = {}
|
|
72
69
|
# - Define delimiter
|
|
73
70
|
reader_kwargs["delimiter"] = "\\t"
|
|
@@ -89,54 +86,38 @@ def reader(
|
|
|
89
86
|
# - Available: gzip, bz2, zip
|
|
90
87
|
reader_kwargs["compression"] = "infer"
|
|
91
88
|
# - Strings to recognize as NA/NaN and replace with standard NA flags
|
|
92
|
-
# - Already included:
|
|
93
|
-
#
|
|
94
|
-
#
|
|
89
|
+
# - Already included: '#N/A', '#N/A N/A', '#NA', '-1.#IND', '-1.#QNAN',
|
|
90
|
+
# '-NaN', '-nan', '1.#IND', '1.#QNAN', '<NA>', 'N/A',
|
|
91
|
+
# 'NA', 'NULL', 'NaN', 'n/a', 'nan', 'null'
|
|
95
92
|
reader_kwargs["na_values"] = ["na", "", "error"]
|
|
96
93
|
|
|
97
94
|
##------------------------------------------------------------------------.
|
|
98
|
-
####
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
# - Define 'time' datetime column
|
|
107
|
-
df["time"] = df["date"].astype(str) + " " + df["time"].astype(str)
|
|
108
|
-
df["time"] = pd.to_datetime(df["time"], format="%Y-%m-%d %H:%M:%S", errors="coerce")
|
|
109
|
-
df = df.drop(columns=["date"])
|
|
95
|
+
#### Read the data
|
|
96
|
+
df = read_raw_text_file(
|
|
97
|
+
filepath=filepath,
|
|
98
|
+
column_names=column_names,
|
|
99
|
+
reader_kwargs=reader_kwargs,
|
|
100
|
+
logger=logger,
|
|
101
|
+
)
|
|
110
102
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
df["raw_drop_number"] = df_raw_drop_number
|
|
103
|
+
##------------------------------------------------------------------------.
|
|
104
|
+
#### Adapt the dataframe to adhere to DISDRODB L0 standards
|
|
105
|
+
# Replace 'Z' -Inf with NaN
|
|
106
|
+
df["Z"] = df["Z"].str.replace("-Inf", "NaN")
|
|
116
107
|
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
# Define 'time' datetime column
|
|
109
|
+
df["time"] = df["date"].astype(str) + " " + df["time"].astype(str)
|
|
110
|
+
df["time"] = pd.to_datetime(df["time"], format="%Y-%m-%d %H:%M:%S", errors="coerce")
|
|
111
|
+
df = df.drop(columns=["date"])
|
|
119
112
|
|
|
120
|
-
|
|
113
|
+
# Create raw_drop_number column
|
|
114
|
+
bin_columns = ["n" + str(i) for i in range(1, 21)]
|
|
115
|
+
df_arr = df[bin_columns]
|
|
116
|
+
df_raw_drop_number = df_arr.agg(";".join, axis=1)
|
|
117
|
+
df["raw_drop_number"] = df_raw_drop_number
|
|
121
118
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
glob_patterns = "*.txt"
|
|
119
|
+
# Remove bins columns
|
|
120
|
+
df = df.drop(columns=bin_columns)
|
|
125
121
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
run_l0a(
|
|
129
|
-
raw_dir=raw_dir,
|
|
130
|
-
processed_dir=processed_dir,
|
|
131
|
-
station_name=station_name,
|
|
132
|
-
# Custom arguments of the reader for L0A processing
|
|
133
|
-
glob_patterns=glob_patterns,
|
|
134
|
-
column_names=column_names,
|
|
135
|
-
reader_kwargs=reader_kwargs,
|
|
136
|
-
df_sanitizer_fun=df_sanitizer_fun,
|
|
137
|
-
# Processing options
|
|
138
|
-
force=force,
|
|
139
|
-
verbose=verbose,
|
|
140
|
-
parallel=parallel,
|
|
141
|
-
debugging_mode=debugging_mode,
|
|
142
|
-
)
|
|
122
|
+
# Return the dataframe adhering to DISDRODB L0 standards
|
|
123
|
+
return df
|