disdrodb 0.0.21__py3-none-any.whl → 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. disdrodb/__init__.py +132 -15
  2. disdrodb/_config.py +4 -2
  3. disdrodb/_version.py +9 -4
  4. disdrodb/api/checks.py +264 -237
  5. disdrodb/api/configs.py +4 -8
  6. disdrodb/api/create_directories.py +235 -290
  7. disdrodb/api/info.py +217 -26
  8. disdrodb/api/io.py +295 -269
  9. disdrodb/api/path.py +597 -173
  10. disdrodb/api/search.py +486 -0
  11. disdrodb/{metadata/scripts → cli}/disdrodb_check_metadata_archive.py +12 -7
  12. disdrodb/{utils/pandas.py → cli/disdrodb_data_archive_directory.py} +9 -18
  13. disdrodb/cli/disdrodb_download_archive.py +86 -0
  14. disdrodb/cli/disdrodb_download_metadata_archive.py +53 -0
  15. disdrodb/cli/disdrodb_download_station.py +84 -0
  16. disdrodb/{api/scripts → cli}/disdrodb_initialize_station.py +22 -10
  17. disdrodb/cli/disdrodb_metadata_archive_directory.py +32 -0
  18. disdrodb/{data_transfer/scripts/disdrodb_download_station.py → cli/disdrodb_open_data_archive.py} +22 -22
  19. disdrodb/cli/disdrodb_open_logs_directory.py +69 -0
  20. disdrodb/{data_transfer/scripts/disdrodb_upload_station.py → cli/disdrodb_open_metadata_archive.py} +22 -24
  21. disdrodb/cli/disdrodb_open_metadata_directory.py +71 -0
  22. disdrodb/cli/disdrodb_open_product_directory.py +74 -0
  23. disdrodb/cli/disdrodb_open_readers_directory.py +32 -0
  24. disdrodb/{l0/scripts → cli}/disdrodb_run_l0.py +38 -31
  25. disdrodb/{l0/scripts → cli}/disdrodb_run_l0_station.py +32 -30
  26. disdrodb/{l0/scripts → cli}/disdrodb_run_l0a.py +30 -21
  27. disdrodb/{l0/scripts → cli}/disdrodb_run_l0a_station.py +24 -33
  28. disdrodb/{l0/scripts → cli}/disdrodb_run_l0b.py +30 -21
  29. disdrodb/{l0/scripts → cli}/disdrodb_run_l0b_station.py +25 -34
  30. disdrodb/cli/disdrodb_run_l0c.py +130 -0
  31. disdrodb/cli/disdrodb_run_l0c_station.py +129 -0
  32. disdrodb/cli/disdrodb_run_l1.py +122 -0
  33. disdrodb/cli/disdrodb_run_l1_station.py +121 -0
  34. disdrodb/cli/disdrodb_run_l2e.py +122 -0
  35. disdrodb/cli/disdrodb_run_l2e_station.py +122 -0
  36. disdrodb/cli/disdrodb_run_l2m.py +122 -0
  37. disdrodb/cli/disdrodb_run_l2m_station.py +122 -0
  38. disdrodb/cli/disdrodb_upload_archive.py +105 -0
  39. disdrodb/cli/disdrodb_upload_station.py +98 -0
  40. disdrodb/configs.py +90 -25
  41. disdrodb/data_transfer/__init__.py +22 -0
  42. disdrodb/data_transfer/download_data.py +87 -90
  43. disdrodb/data_transfer/upload_data.py +64 -37
  44. disdrodb/data_transfer/zenodo.py +15 -18
  45. disdrodb/docs.py +1 -1
  46. disdrodb/issue/__init__.py +17 -4
  47. disdrodb/issue/checks.py +10 -23
  48. disdrodb/issue/reader.py +9 -12
  49. disdrodb/issue/writer.py +14 -17
  50. disdrodb/l0/__init__.py +17 -26
  51. disdrodb/l0/check_configs.py +35 -23
  52. disdrodb/l0/check_standards.py +32 -42
  53. disdrodb/l0/configs/{Thies_LPM → LPM}/bins_diameter.yml +44 -44
  54. disdrodb/l0/configs/{Thies_LPM → LPM}/bins_velocity.yml +40 -40
  55. disdrodb/l0/configs/LPM/l0a_encodings.yml +80 -0
  56. disdrodb/l0/configs/{Thies_LPM → LPM}/l0b_cf_attrs.yml +62 -59
  57. disdrodb/l0/configs/{Thies_LPM → LPM}/l0b_encodings.yml +9 -9
  58. disdrodb/l0/configs/{Thies_LPM → LPM}/raw_data_format.yml +245 -245
  59. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/bins_diameter.yml +66 -66
  60. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/bins_velocity.yml +64 -64
  61. disdrodb/l0/configs/PARSIVEL/l0a_encodings.yml +32 -0
  62. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/l0b_cf_attrs.yml +22 -20
  63. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/l0b_encodings.yml +17 -17
  64. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/raw_data_format.yml +77 -77
  65. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/bins_diameter.yml +64 -64
  66. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/bins_velocity.yml +64 -64
  67. disdrodb/l0/configs/PARSIVEL2/l0a_encodings.yml +39 -0
  68. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/l0b_cf_attrs.yml +24 -22
  69. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/l0b_encodings.yml +20 -20
  70. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/raw_data_format.yml +98 -98
  71. disdrodb/l0/configs/{RD_80 → RD80}/bins_diameter.yml +40 -40
  72. disdrodb/l0/configs/RD80/l0a_encodings.yml +16 -0
  73. disdrodb/l0/configs/{RD_80 → RD80}/l0b_cf_attrs.yml +3 -3
  74. disdrodb/l0/configs/RD80/l0b_encodings.yml +135 -0
  75. disdrodb/l0/configs/{RD_80 → RD80}/raw_data_format.yml +48 -48
  76. disdrodb/l0/l0_reader.py +216 -340
  77. disdrodb/l0/l0a_processing.py +237 -208
  78. disdrodb/l0/l0b_nc_processing.py +227 -80
  79. disdrodb/l0/l0b_processing.py +93 -173
  80. disdrodb/l0/l0c_processing.py +627 -0
  81. disdrodb/l0/readers/{ARM → LPM/ARM}/ARM_LPM.py +36 -58
  82. disdrodb/l0/readers/LPM/AUSTRALIA/MELBOURNE_2007_LPM.py +226 -0
  83. disdrodb/l0/readers/LPM/BRAZIL/CHUVA_LPM.py +185 -0
  84. disdrodb/l0/readers/LPM/BRAZIL/GOAMAZON_LPM.py +183 -0
  85. disdrodb/l0/readers/LPM/ITALY/GID_LPM.py +179 -0
  86. disdrodb/l0/readers/{UK → LPM/UK}/DIVEN.py +14 -35
  87. disdrodb/l0/readers/PARSIVEL/AUSTRALIA/MELBOURNE_2007_PARSIVEL.py +157 -0
  88. disdrodb/l0/readers/PARSIVEL/CHINA/CHONGQING.py +113 -0
  89. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/ARCTIC_2021.py +40 -57
  90. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/COMMON_2011.py +37 -54
  91. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/DAVOS_2009_2011.py +34 -51
  92. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_2009.py +34 -51
  93. disdrodb/l0/readers/{EPFL/PARADISO_2014.py → PARSIVEL/EPFL/EPFL_ROOF_2008.py} +38 -50
  94. disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2010.py +105 -0
  95. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_ROOF_2011.py +34 -51
  96. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_ROOF_2012.py +33 -51
  97. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GENEPI_2007.py +25 -44
  98. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GRAND_ST_BERNARD_2007.py +25 -44
  99. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GRAND_ST_BERNARD_2007_2.py +25 -44
  100. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/HPICONET_2010.py +34 -51
  101. disdrodb/l0/readers/{EPFL/EPFL_ROOF_2010.py → PARSIVEL/EPFL/HYMEX_LTE_SOP2.py} +37 -50
  102. disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP3.py +111 -0
  103. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/HYMEX_LTE_SOP4.py +36 -54
  104. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/LOCARNO_2018.py +34 -52
  105. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/LOCARNO_2019.py +38 -56
  106. disdrodb/l0/readers/PARSIVEL/EPFL/PARADISO_2014.py +105 -0
  107. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/PARSIVEL_2007.py +27 -45
  108. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/PLATO_2019.py +24 -44
  109. disdrodb/l0/readers/PARSIVEL/EPFL/RACLETS_2019.py +140 -0
  110. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/RACLETS_2019_WJF.py +41 -59
  111. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/RIETHOLZBACH_2011.py +34 -51
  112. disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2017.py +117 -0
  113. disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2019.py +137 -0
  114. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/UNIL_2022.py +42 -55
  115. disdrodb/l0/readers/PARSIVEL/GPM/IFLOODS.py +104 -0
  116. disdrodb/l0/readers/{GPM → PARSIVEL/GPM}/LPVEX.py +29 -48
  117. disdrodb/l0/readers/PARSIVEL/GPM/MC3E.py +184 -0
  118. disdrodb/l0/readers/PARSIVEL/NCAR/CCOPE_2015.py +113 -0
  119. disdrodb/l0/readers/{NCAR/VORTEX_SE_2016_P1.py → PARSIVEL/NCAR/OWLES_MIPS.py} +46 -72
  120. disdrodb/l0/readers/PARSIVEL/NCAR/PECAN_MOBILE.py +125 -0
  121. disdrodb/l0/readers/{NCAR/OWLES_MIPS.py → PARSIVEL/NCAR/PLOWS_MIPS.py} +45 -64
  122. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2009.py +114 -0
  123. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2010.py +176 -0
  124. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2010_UF.py +183 -0
  125. disdrodb/l0/readers/{ARM/ARM_LD.py → PARSIVEL2/ARM/ARM_PARSIVEL2.py} +27 -50
  126. disdrodb/l0/readers/PARSIVEL2/BRAZIL/CHUVA_PARSIVEL2.py +163 -0
  127. disdrodb/l0/readers/PARSIVEL2/BRAZIL/GOAMAZON_PARSIVEL2.py +163 -0
  128. disdrodb/l0/readers/{DENMARK → PARSIVEL2/DENMARK}/EROSION_nc.py +14 -35
  129. disdrodb/l0/readers/PARSIVEL2/FRANCE/SIRTA_PARSIVEL2.py +119 -0
  130. disdrodb/l0/readers/PARSIVEL2/GPM/GCPEX.py +104 -0
  131. disdrodb/l0/readers/PARSIVEL2/GPM/NSSTC.py +176 -0
  132. disdrodb/l0/readers/PARSIVEL2/ITALY/GID_PARSIVEL2.py +32 -0
  133. disdrodb/l0/readers/PARSIVEL2/MEXICO/OH_IIUNAM_nc.py +56 -0
  134. disdrodb/l0/readers/PARSIVEL2/NCAR/PECAN_FP3.py +120 -0
  135. disdrodb/l0/readers/{NCAR → PARSIVEL2/NCAR}/PECAN_MIPS.py +45 -64
  136. disdrodb/l0/readers/PARSIVEL2/NCAR/RELAMPAGO_PARSIVEL2.py +181 -0
  137. disdrodb/l0/readers/PARSIVEL2/NCAR/SNOWIE_PJ.py +160 -0
  138. disdrodb/l0/readers/PARSIVEL2/NCAR/SNOWIE_SB.py +160 -0
  139. disdrodb/l0/readers/{NCAR/PLOWS_MIPS.py → PARSIVEL2/NCAR/VORTEX_SE_2016_P1.py} +49 -66
  140. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_P2.py +118 -0
  141. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_PIPS.py +152 -0
  142. disdrodb/l0/readers/PARSIVEL2/NETHERLANDS/DELFT.py +166 -0
  143. disdrodb/l0/readers/{NCAR/RELAMPAGO_RD80.py → RD80/BRAZIL/CHUVA_RD80.py} +36 -60
  144. disdrodb/l0/readers/{BRAZIL → RD80/BRAZIL}/GOAMAZON_RD80.py +36 -55
  145. disdrodb/l0/readers/{NCAR → RD80/NCAR}/CINDY_2011_RD80.py +35 -54
  146. disdrodb/l0/readers/{BRAZIL/CHUVA_RD80.py → RD80/NCAR/RELAMPAGO_RD80.py} +40 -54
  147. disdrodb/l0/readers/template_reader_raw_netcdf_data.py +62 -0
  148. disdrodb/l0/readers/{reader_template.py → template_reader_raw_text_data.py} +20 -44
  149. disdrodb/l0/routines.py +885 -581
  150. disdrodb/l0/standards.py +72 -236
  151. disdrodb/l0/template_tools.py +104 -109
  152. disdrodb/l1/__init__.py +17 -0
  153. disdrodb/l1/beard_model.py +716 -0
  154. disdrodb/l1/encoding_attrs.py +620 -0
  155. disdrodb/l1/fall_velocity.py +260 -0
  156. disdrodb/l1/filters.py +192 -0
  157. disdrodb/l1/processing.py +200 -0
  158. disdrodb/l1/resampling.py +236 -0
  159. disdrodb/l1/routines.py +357 -0
  160. disdrodb/l1_env/__init__.py +17 -0
  161. disdrodb/l1_env/routines.py +38 -0
  162. disdrodb/l2/__init__.py +17 -0
  163. disdrodb/l2/empirical_dsd.py +1735 -0
  164. disdrodb/l2/event.py +388 -0
  165. disdrodb/l2/processing.py +519 -0
  166. disdrodb/l2/processing_options.py +213 -0
  167. disdrodb/l2/routines.py +868 -0
  168. disdrodb/metadata/__init__.py +9 -2
  169. disdrodb/metadata/checks.py +165 -118
  170. disdrodb/metadata/download.py +81 -0
  171. disdrodb/metadata/geolocation.py +146 -0
  172. disdrodb/metadata/info.py +20 -13
  173. disdrodb/metadata/manipulation.py +1 -1
  174. disdrodb/metadata/reader.py +59 -8
  175. disdrodb/metadata/search.py +77 -144
  176. disdrodb/metadata/standards.py +7 -8
  177. disdrodb/metadata/writer.py +8 -14
  178. disdrodb/psd/__init__.py +38 -0
  179. disdrodb/psd/fitting.py +2146 -0
  180. disdrodb/psd/models.py +774 -0
  181. disdrodb/routines.py +1176 -0
  182. disdrodb/scattering/__init__.py +28 -0
  183. disdrodb/scattering/axis_ratio.py +344 -0
  184. disdrodb/scattering/routines.py +456 -0
  185. disdrodb/utils/__init__.py +17 -0
  186. disdrodb/utils/attrs.py +208 -0
  187. disdrodb/utils/cli.py +269 -0
  188. disdrodb/utils/compression.py +60 -42
  189. disdrodb/utils/dask.py +62 -0
  190. disdrodb/utils/decorators.py +110 -0
  191. disdrodb/utils/directories.py +107 -46
  192. disdrodb/utils/encoding.py +127 -0
  193. disdrodb/utils/list.py +29 -0
  194. disdrodb/utils/logger.py +168 -46
  195. disdrodb/utils/time.py +657 -0
  196. disdrodb/utils/warnings.py +30 -0
  197. disdrodb/utils/writer.py +57 -0
  198. disdrodb/utils/xarray.py +138 -47
  199. disdrodb/utils/yaml.py +0 -1
  200. disdrodb/viz/__init__.py +17 -0
  201. disdrodb/viz/plots.py +17 -0
  202. disdrodb-0.1.0.dist-info/METADATA +321 -0
  203. disdrodb-0.1.0.dist-info/RECORD +216 -0
  204. {disdrodb-0.0.21.dist-info → disdrodb-0.1.0.dist-info}/WHEEL +1 -1
  205. disdrodb-0.1.0.dist-info/entry_points.txt +30 -0
  206. disdrodb/data_transfer/scripts/disdrodb_download_archive.py +0 -53
  207. disdrodb/data_transfer/scripts/disdrodb_upload_archive.py +0 -57
  208. disdrodb/l0/configs/OTT_Parsivel/l0a_encodings.yml +0 -32
  209. disdrodb/l0/configs/OTT_Parsivel2/l0a_encodings.yml +0 -39
  210. disdrodb/l0/configs/RD_80/l0a_encodings.yml +0 -16
  211. disdrodb/l0/configs/RD_80/l0b_encodings.yml +0 -135
  212. disdrodb/l0/configs/Thies_LPM/l0a_encodings.yml +0 -80
  213. disdrodb/l0/io.py +0 -257
  214. disdrodb/l0/l0_processing.py +0 -1091
  215. disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_OTT.py +0 -178
  216. disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_THIES.py +0 -247
  217. disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py +0 -204
  218. disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py +0 -183
  219. disdrodb/l0/readers/BRAZIL/GOAMAZON_LPM.py +0 -204
  220. disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py +0 -183
  221. disdrodb/l0/readers/CHINA/CHONGQING.py +0 -131
  222. disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py +0 -128
  223. disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py +0 -127
  224. disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py +0 -129
  225. disdrodb/l0/readers/EPFL/RACLETS_2019.py +0 -158
  226. disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py +0 -136
  227. disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py +0 -158
  228. disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py +0 -138
  229. disdrodb/l0/readers/GPM/GCPEX.py +0 -123
  230. disdrodb/l0/readers/GPM/IFLOODS.py +0 -123
  231. disdrodb/l0/readers/GPM/MC3E.py +0 -123
  232. disdrodb/l0/readers/GPM/NSSTC.py +0 -164
  233. disdrodb/l0/readers/ITALY/GID.py +0 -199
  234. disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py +0 -92
  235. disdrodb/l0/readers/NCAR/CCOPE_2015.py +0 -133
  236. disdrodb/l0/readers/NCAR/PECAN_FP3.py +0 -137
  237. disdrodb/l0/readers/NCAR/PECAN_MOBILE.py +0 -144
  238. disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py +0 -195
  239. disdrodb/l0/readers/NCAR/SNOWIE_PJ.py +0 -172
  240. disdrodb/l0/readers/NCAR/SNOWIE_SB.py +0 -179
  241. disdrodb/l0/readers/NCAR/VORTEX2_2009.py +0 -133
  242. disdrodb/l0/readers/NCAR/VORTEX2_2010.py +0 -188
  243. disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py +0 -191
  244. disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py +0 -135
  245. disdrodb/l0/readers/NCAR/VORTEX_SE_2016_PIPS.py +0 -170
  246. disdrodb/l0/readers/NETHERLANDS/DELFT.py +0 -187
  247. disdrodb/l0/readers/SPAIN/SBEGUERIA.py +0 -179
  248. disdrodb/l0/scripts/disdrodb_run_l0b_concat.py +0 -93
  249. disdrodb/l0/scripts/disdrodb_run_l0b_concat_station.py +0 -85
  250. disdrodb/utils/netcdf.py +0 -452
  251. disdrodb/utils/scripts.py +0 -102
  252. disdrodb-0.0.21.dist-info/AUTHORS.md +0 -18
  253. disdrodb-0.0.21.dist-info/METADATA +0 -186
  254. disdrodb-0.0.21.dist-info/RECORD +0 -168
  255. disdrodb-0.0.21.dist-info/entry_points.txt +0 -15
  256. /disdrodb/l0/configs/{RD_80 → RD80}/bins_velocity.yml +0 -0
  257. /disdrodb/l0/manuals/{Thies_LPM.pdf → LPM.pdf} +0 -0
  258. /disdrodb/l0/manuals/{ODM_470.pdf → ODM470.pdf} +0 -0
  259. /disdrodb/l0/manuals/{OTT_Parsivel.pdf → PARSIVEL.pdf} +0 -0
  260. /disdrodb/l0/manuals/{OTT_Parsivel2.pdf → PARSIVEL2.pdf} +0 -0
  261. /disdrodb/l0/manuals/{PWS_100.pdf → PWS100.pdf} +0 -0
  262. /disdrodb/l0/manuals/{RD_80.pdf → RD80.pdf} +0 -0
  263. {disdrodb-0.0.21.dist-info → disdrodb-0.1.0.dist-info/licenses}/LICENSE +0 -0
  264. {disdrodb-0.0.21.dist-info → disdrodb-0.1.0.dist-info}/top_level.txt +0 -0
@@ -1,172 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -----------------------------------------------------------------------------.
3
- # Copyright (c) 2021-2023 DISDRODB developers
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- # -----------------------------------------------------------------------------.
18
- from disdrodb.l0 import run_l0a
19
- from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
20
-
21
-
22
- @is_documented_by(reader_generic_docstring)
23
- def reader(
24
- raw_dir,
25
- processed_dir,
26
- station_name,
27
- # Processing options
28
- force=False,
29
- verbose=False,
30
- parallel=False,
31
- debugging_mode=False,
32
- ):
33
- ##------------------------------------------------------------------------.
34
- #### - Define column names
35
- column_names = ["TO_PARSE"]
36
-
37
- ##------------------------------------------------------------------------.
38
- #### - Define reader options
39
- reader_kwargs = {}
40
- # - Define delimiter
41
- reader_kwargs["delimiter"] = "\\n"
42
- # - Skip first row as columns names
43
- # - Define encoding
44
- reader_kwargs["encoding"] = "latin" # "ISO-8859-1"
45
- # - Avoid first column to become df index !!!
46
- reader_kwargs["index_col"] = False
47
- # - Define behaviour when encountering bad lines
48
- reader_kwargs["on_bad_lines"] = "skip"
49
- # - Define reader engine
50
- # - C engine is faster
51
- # - Python engine is more feature-complete
52
- reader_kwargs["engine"] = "python"
53
- # - Define on-the-fly decompression of on-disk data
54
- # - Available: gzip, bz2, zip
55
- reader_kwargs["compression"] = "infer"
56
- # - Strings to recognize as NA/NaN and replace with standard NA flags
57
- # - Already included: ‘#N/A’, ‘#N/A N/A’, ‘#NA’, ‘-1.#IND’, ‘-1.#QNAN’,
58
- # ‘-NaN’, ‘-nan’, ‘1.#IND’, ‘1.#QNAN’, ‘<NA>’, ‘N/A’,
59
- # ‘NA’, ‘NULL’, ‘NaN’, ‘n/a’, ‘nan’, ‘null’
60
- reader_kwargs["na_values"] = ["na", "", "error"]
61
-
62
- ##------------------------------------------------------------------------.
63
- #### - Define dataframe sanitizer function for L0 processing
64
- def df_sanitizer_fun(df):
65
- # - Import pandas
66
- import pandas as pd
67
-
68
- # Create ID and Value columns
69
- df = df["TO_PARSE"].str.split(":", expand=True, n=1)
70
- df.columns = ["ID", "Value"]
71
-
72
- # Drop rows with no values
73
- df = df[df["Value"].astype(bool)]
74
-
75
- # Create the dataframe with each row corresponding to a timestep
76
- # - Group rows based on when ID values restart
77
- groups = df.groupby((df["ID"].astype(int).diff() <= 0).cumsum())
78
-
79
- # - Reshape the dataframe
80
- group_dfs = []
81
- for _, group in groups:
82
- group_df = group.set_index("ID").T
83
- group_dfs.append(group_df)
84
-
85
- # - Merge each timestep dataframe
86
- # --> Missing columns are infilled by NaN
87
- df = pd.concat(group_dfs, axis=0)
88
-
89
- # Assign column names
90
- column_dict = {
91
- "01": "rainfall_rate_32bit",
92
- "02": "rainfall_accumulated_32bit",
93
- "03": "weather_code_synop_4680",
94
- "04": "weather_code_synop_4677",
95
- "05": "weather_code_metar_4678",
96
- "06": "weather_code_nws",
97
- "07": "reflectivity_32bit",
98
- "08": "mor_visibility",
99
- "09": "sample_interval",
100
- "10": "laser_amplitude",
101
- "11": "number_particles",
102
- "12": "sensor_temperature",
103
- # "13": "sensor_serial_number",
104
- # "14": "firmware_iop",
105
- # "15": "firmware_dsp",
106
- "16": "sensor_heating_current",
107
- "17": "sensor_battery_voltage",
108
- "18": "sensor_status",
109
- # "19": "start_time",
110
- "20": "sensor_time",
111
- "21": "sensor_date",
112
- # "22": "station_name",
113
- # "23": "station_number",
114
- "24": "rainfall_amount_absolute_32bit",
115
- "25": "error_code",
116
- "30": "rainfall_rate_16_bit_30",
117
- "31": "rainfall_rate_16_bit_1200",
118
- "32": "rainfall_accumulated_16bit",
119
- "90": "raw_drop_concentration",
120
- "91": "raw_drop_average_velocity",
121
- "93": "raw_drop_number",
122
- }
123
- df = df.rename(column_dict, axis=1)
124
-
125
- # - Keep only columns defined in the dictionary
126
- df = df[list(column_dict.values())]
127
-
128
- # - Define datetime "time" column
129
- df["time"] = df["sensor_date"] + "-" + df["sensor_time"]
130
- df["time"] = pd.to_datetime(df["time"], format="%d.%m.%Y-%H:%M:%S", errors="coerce")
131
-
132
- # - Drop columns not agreeing with DISDRODB L0 standards
133
- columns_to_drop = [
134
- "sensor_date",
135
- "sensor_time",
136
- # "firmware_iop",
137
- # "firmware_dsp",
138
- # "sensor_serial_number",
139
- # "station_name",
140
- # "station_number",
141
- ]
142
- df = df.drop(columns=columns_to_drop)
143
-
144
- # Preprocess the raw spectrum and raw_drop_average_velocity
145
- # - Add 0 before every ; if ; not preceded by a digit
146
- # - Example: ';;1;;' --> '0;0;1;0;'
147
- df["raw_drop_average_velocity"] = df["raw_drop_average_velocity"].str.replace(r"(?<!\d);", "0;", regex=True)
148
- df["raw_drop_number"] = df["raw_drop_number"].str.replace(r"(?<!\d);", "0;", regex=True)
149
-
150
- return df
151
-
152
- ##------------------------------------------------------------------------.
153
- #### - Define glob pattern to search data files in <raw_dir>/data/<station_name>
154
- glob_patterns = "*.dat"
155
-
156
- ####----------------------------------------------------------------------.
157
- #### - Create L0A products
158
- run_l0a(
159
- raw_dir=raw_dir,
160
- processed_dir=processed_dir,
161
- station_name=station_name,
162
- # Custom arguments of the reader for L0A processing
163
- glob_patterns=glob_patterns,
164
- column_names=column_names,
165
- reader_kwargs=reader_kwargs,
166
- df_sanitizer_fun=df_sanitizer_fun,
167
- # Processing options
168
- force=force,
169
- verbose=verbose,
170
- parallel=parallel,
171
- debugging_mode=debugging_mode,
172
- )
@@ -1,179 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Created on Fri Feb 17 19:08:17 2023
4
-
5
- @author: ghiggi
6
- """
7
- #!/usr/bin/env python3
8
- # -*- coding: utf-8 -*-
9
- # -----------------------------------------------------------------------------.
10
- # Copyright (c) 2021-2023 DISDRODB developers
11
- #
12
- # This program is free software: you can redistribute it and/or modify
13
- # it under the terms of the GNU General Public License as published by
14
- # the Free Software Foundation, either version 3 of the License, or
15
- # (at your option) any later version.
16
- #
17
- # This program is distributed in the hope that it will be useful,
18
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- # GNU General Public License for more details.
21
- #
22
- # You should have received a copy of the GNU General Public License
23
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
24
- # -----------------------------------------------------------------------------.
25
- from disdrodb.l0 import run_l0a
26
- from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
27
-
28
-
29
- @is_documented_by(reader_generic_docstring)
30
- def reader(
31
- raw_dir,
32
- processed_dir,
33
- station_name,
34
- # Processing options
35
- force=False,
36
- verbose=False,
37
- parallel=False,
38
- debugging_mode=False,
39
- ):
40
- ##------------------------------------------------------------------------.
41
- #### - Define column names
42
- column_names = ["TO_PARSE"]
43
-
44
- ##------------------------------------------------------------------------.
45
- #### - Define reader options
46
- reader_kwargs = {}
47
- # - Define delimiter
48
- reader_kwargs["delimiter"] = "\\n"
49
- # - Skip first row as columns names
50
- # - Define encoding
51
- reader_kwargs["encoding"] = "latin" # "ISO-8859-1"
52
- # - Avoid first column to become df index !!!
53
- reader_kwargs["index_col"] = False
54
- # - Define behaviour when encountering bad lines
55
- reader_kwargs["on_bad_lines"] = "skip"
56
- # - Define reader engine
57
- # - C engine is faster
58
- # - Python engine is more feature-complete
59
- reader_kwargs["engine"] = "python"
60
- # - Define on-the-fly decompression of on-disk data
61
- # - Available: gzip, bz2, zip
62
- reader_kwargs["compression"] = "infer"
63
- # - Strings to recognize as NA/NaN and replace with standard NA flags
64
- # - Already included: ‘#N/A’, ‘#N/A N/A’, ‘#NA’, ‘-1.#IND’, ‘-1.#QNAN’,
65
- # ‘-NaN’, ‘-nan’, ‘1.#IND’, ‘1.#QNAN’, ‘<NA>’, ‘N/A’,
66
- # ‘NA’, ‘NULL’, ‘NaN’, ‘n/a’, ‘nan’, ‘null’
67
- reader_kwargs["na_values"] = ["na", "", "error"]
68
-
69
- ##------------------------------------------------------------------------.
70
- #### - Define dataframe sanitizer function for L0 processing
71
- def df_sanitizer_fun(df):
72
- # - Import pandas
73
- import pandas as pd
74
-
75
- # Create ID and Value columns
76
- df = df["TO_PARSE"].str.split(":", expand=True, n=1)
77
- df.columns = ["ID", "Value"]
78
-
79
- # Drop rows with no values
80
- df = df[df["Value"].astype(bool)]
81
-
82
- # Create the dataframe with each row corresponding to a timestep
83
- # - Group rows based on when ID values restart
84
- groups = df.groupby((df["ID"].astype(int).diff() <= 0).cumsum())
85
-
86
- # - Reshape the dataframe
87
- group_dfs = []
88
- for _, group in groups:
89
- group_df = group.set_index("ID").T
90
- group_dfs.append(group_df)
91
-
92
- # - Merge each timestep dataframe
93
- # --> Missing columns are infilled by NaN
94
- df = pd.concat(group_dfs, axis=0)
95
-
96
- # Assign column names
97
- column_dict = {
98
- "01": "rainfall_rate_32bit",
99
- "02": "rainfall_accumulated_32bit",
100
- "03": "weather_code_synop_4680",
101
- "04": "weather_code_synop_4677",
102
- "05": "weather_code_metar_4678",
103
- "06": "weather_code_nws",
104
- "07": "reflectivity_32bit",
105
- "08": "mor_visibility",
106
- "09": "sample_interval",
107
- "10": "laser_amplitude",
108
- "11": "number_particles",
109
- "12": "sensor_temperature",
110
- # "13": "sensor_serial_number",
111
- # "14": "firmware_iop",
112
- # "15": "firmware_dsp",
113
- "16": "sensor_heating_current",
114
- "17": "sensor_battery_voltage",
115
- "18": "sensor_status",
116
- # "19": "start_time",
117
- "20": "sensor_time",
118
- "21": "sensor_date",
119
- # "22": "station_name",
120
- # "23": "station_number",
121
- "24": "rainfall_amount_absolute_32bit",
122
- "25": "error_code",
123
- "30": "rainfall_rate_16_bit_30",
124
- "31": "rainfall_rate_16_bit_1200",
125
- "32": "rainfall_accumulated_16bit",
126
- "90": "raw_drop_concentration",
127
- "91": "raw_drop_average_velocity",
128
- "93": "raw_drop_number",
129
- }
130
- df = df.rename(column_dict, axis=1)
131
-
132
- # - Keep only columns defined in the dictionary
133
- df = df[list(column_dict.values())]
134
-
135
- # - Define datetime "time" column
136
- df["time"] = df["sensor_date"] + "-" + df["sensor_time"]
137
- df["time"] = pd.to_datetime(df["time"], format="%d.%m.%Y-%H:%M:%S", errors="coerce")
138
-
139
- # - Drop columns not agreeing with DISDRODB L0 standards
140
- columns_to_drop = [
141
- "sensor_date",
142
- "sensor_time",
143
- # "firmware_iop",
144
- # "firmware_dsp",
145
- # "sensor_serial_number",
146
- # "station_name",
147
- # "station_number",
148
- ]
149
- df = df.drop(columns=columns_to_drop)
150
-
151
- # Preprocess the raw spectrum and raw_drop_average_velocity
152
- # - Add 0 before every ; if ; not preceded by a digit
153
- # - Example: ';;1;;' --> '0;0;1;0;'
154
- df["raw_drop_average_velocity"] = df["raw_drop_average_velocity"].str.replace(r"(?<!\d);", "0;", regex=True)
155
- df["raw_drop_number"] = df["raw_drop_number"].str.replace(r"(?<!\d);", "0;", regex=True)
156
-
157
- return df
158
-
159
- ##------------------------------------------------------------------------.
160
- #### - Define glob pattern to search data files in <raw_dir>/data/<station_name>
161
- glob_patterns = "*.txt"
162
-
163
- ####----------------------------------------------------------------------.
164
- #### - Create L0A products
165
- run_l0a(
166
- raw_dir=raw_dir,
167
- processed_dir=processed_dir,
168
- station_name=station_name,
169
- # Custom arguments of the reader for L0A processing
170
- glob_patterns=glob_patterns,
171
- column_names=column_names,
172
- reader_kwargs=reader_kwargs,
173
- df_sanitizer_fun=df_sanitizer_fun,
174
- # Processing options
175
- force=force,
176
- verbose=verbose,
177
- parallel=parallel,
178
- debugging_mode=debugging_mode,
179
- )
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -----------------------------------------------------------------------------.
3
- # Copyright (c) 2021-2023 DISDRODB developers
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- # -----------------------------------------------------------------------------.
18
- from disdrodb.l0 import run_l0a
19
- from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
20
-
21
-
22
- @is_documented_by(reader_generic_docstring)
23
- def reader(
24
- raw_dir,
25
- processed_dir,
26
- station_name,
27
- # Processing options
28
- force=False,
29
- verbose=False,
30
- parallel=False,
31
- debugging_mode=False,
32
- ):
33
- ##------------------------------------------------------------------------.
34
- #### - Define column names
35
- column_names = ["TO_PARSE"]
36
-
37
- ##------------------------------------------------------------------------.
38
- #### - Define reader options
39
- reader_kwargs = {}
40
- # - Define delimiter
41
- reader_kwargs["delimiter"] = "\\n"
42
-
43
- # - Avoid first column to become df index !!!
44
- reader_kwargs["index_col"] = False
45
-
46
- # - Define behaviour when encountering bad lines
47
- reader_kwargs["on_bad_lines"] = "skip"
48
-
49
- # - Define encoding
50
- reader_kwargs["encoding"] = "ISO-8859-1"
51
-
52
- # - Define reader engine
53
- # - C engine is faster
54
- # - Python engine is more feature-complete
55
- reader_kwargs["engine"] = "python"
56
-
57
- # - Define on-the-fly decompression of on-disk data
58
- # - Available: gzip, bz2, zip
59
- reader_kwargs["compression"] = "infer"
60
-
61
- # - Strings to recognize as NA/NaN and replace with standard NA flags
62
- # - Already included: ‘#N/A’, ‘#N/A N/A’, ‘#NA’, ‘-1.#IND’, ‘-1.#QNAN’,
63
- # ‘-NaN’, ‘-nan’, ‘1.#IND’, ‘1.#QNAN’, ‘<NA>’, ‘N/A’,
64
- # ‘NA’, ‘NULL’, ‘NaN’, ‘n/a’, ‘nan’, ‘null’
65
- reader_kwargs["na_values"] = ["na", "", "error"]
66
-
67
- # Skip first row as columns names
68
- reader_kwargs["header"] = None
69
-
70
- ##------------------------------------------------------------------------.
71
- #### - Define dataframe sanitizer function for L0 processing
72
- def df_sanitizer_fun(df):
73
- # - Import pandas
74
- import pandas as pd
75
-
76
- # Split into columns and assign name
77
- df = df["TO_PARSE"].str.split(";", expand=True, n=9)
78
-
79
- columns = [
80
- "date",
81
- "time",
82
- "rainfall_rate_32bit",
83
- "rainfall_accumulated_32bit",
84
- "weather_code_synop_4680",
85
- "reflectivity_32bit",
86
- "mor_visibility",
87
- "number_particles",
88
- "sensor_temperature",
89
- "raw_drop_number",
90
- ]
91
- df.columns = columns
92
-
93
- # Add datetime time column
94
- df["time"] = df["date"] + "-" + df["time"]
95
- df["time"] = pd.to_datetime(df["time"], format="%d.%m.%Y-%H:%M:%S", errors="coerce")
96
- df = df.drop(columns=["date"])
97
-
98
- # Preprocess the raw spectrum
99
- # - The '<SPECTRUM>ZERO</SPECTRUM>' indicates no drops detected
100
- # --> "" generates an array of zeros in L0B processing
101
- df["raw_drop_number"] = df["raw_drop_number"].replace("<SPECTRUM>ZERO</SPECTRUM>", "")
102
-
103
- # Remove <SPECTRUM> and </SPECTRUM>" acronyms from the raw_drop_number field
104
- df["raw_drop_number"] = df["raw_drop_number"].str.replace("<SPECTRUM>", "")
105
- df["raw_drop_number"] = df["raw_drop_number"].str.replace("</SPECTRUM>", "")
106
-
107
- # Add 0 before every ; if ; not preceded by a digit
108
- # Example: ';;1;;' --> '0;0;1;0;'
109
- df["raw_drop_number"] = df["raw_drop_number"].str.replace(r"(?<!\d);", "0;", regex=True)
110
-
111
- return df
112
-
113
- ##------------------------------------------------------------------------.
114
- #### - Define glob pattern to search data files in <raw_dir>/data/<station_name>
115
- glob_patterns = "*/*.txt"
116
-
117
- ####----------------------------------------------------------------------.
118
- #### - Create L0A products
119
- run_l0a(
120
- raw_dir=raw_dir,
121
- processed_dir=processed_dir,
122
- station_name=station_name,
123
- # Custom arguments of the reader for L0A processing
124
- glob_patterns=glob_patterns,
125
- column_names=column_names,
126
- reader_kwargs=reader_kwargs,
127
- df_sanitizer_fun=df_sanitizer_fun,
128
- # Processing options
129
- force=force,
130
- verbose=verbose,
131
- parallel=parallel,
132
- debugging_mode=debugging_mode,
133
- )
@@ -1,188 +0,0 @@
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
- from disdrodb.l0 import run_l0a
20
- from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring
21
-
22
-
23
- @is_documented_by(reader_generic_docstring)
24
- def reader(
25
- raw_dir,
26
- processed_dir,
27
- station_name,
28
- # Processing options
29
- force=False,
30
- verbose=False,
31
- parallel=False,
32
- debugging_mode=False,
33
- ):
34
- ####----------------------------------------------------------------------.
35
- #### - Define column names
36
- column_names = ["TO_PARSE"]
37
-
38
- ##------------------------------------------------------------------------.
39
- #### - Define reader options
40
- reader_kwargs = {}
41
- # - Define delimiter
42
- reader_kwargs["delimiter"] = "\\n"
43
-
44
- # - Avoid first column to become df index !!!
45
- reader_kwargs["index_col"] = False
46
-
47
- # - Define behaviour when encountering bad lines
48
- reader_kwargs["on_bad_lines"] = "skip"
49
-
50
- # Skip the first row (header)
51
- reader_kwargs["skiprows"] = 0
52
-
53
- # - Define encoding
54
- reader_kwargs["encoding"] = "latin"
55
-
56
- # - Define reader engine
57
- # - C engine is faster
58
- # - Python engine is more feature-complete
59
- reader_kwargs["engine"] = "python"
60
-
61
- # - Define on-the-fly decompression of on-disk data
62
- # - Available: gzip, bz2, zip
63
- reader_kwargs["compression"] = "infer"
64
-
65
- # - Strings to recognize as NA/NaN and replace with standard NA flags
66
- # - Already included: ‘#N/A’, ‘#N/A N/A’, ‘#NA’, ‘-1.#IND’, ‘-1.#QNAN’,
67
- # ‘-NaN’, ‘-nan’, ‘1.#IND’, ‘1.#QNAN’, ‘<NA>’, ‘N/A’,
68
- # ‘NA’, ‘NULL’, ‘NaN’, ‘n/a’, ‘nan’, ‘null’
69
- reader_kwargs["na_values"] = ["na", "", "error"]
70
-
71
- # Skip first row as columns names
72
- reader_kwargs["header"] = None
73
-
74
- ##------------------------------------------------------------------------.
75
- def df_sanitizer_fun(df):
76
- # Import numpy and pandas
77
- import numpy as np
78
- import pandas as pd
79
-
80
- # Create ID and Value columns
81
- df = df["TO_PARSE"].str.split(":", expand=True, n=1)
82
- df.columns = ["ID", "Value"]
83
-
84
- # Drop rows with no values
85
- df = df[df["Value"].astype(bool)]
86
-
87
- # Create the dataframe with each row corresponding to a timestep
88
- # - Group rows based on when ID values restart
89
- groups = df.groupby((df["ID"].astype(int).diff() <= 0).cumsum())
90
-
91
- # - Reshape the dataframe
92
- group_dfs = []
93
- for _, group in groups:
94
- group_df = group.set_index("ID").T
95
- group_dfs.append(group_df)
96
-
97
- # - Merge each timestep dataframe
98
- # --> Missing columns are infilled by NaN
99
- df = pd.concat(group_dfs, axis=0)
100
- df.columns = df.columns.astype(str).str.pad(width=2, side="left", fillchar="0")
101
-
102
- # Define column names
103
- column_dict = {
104
- "01": "rainfall_rate_32bit",
105
- "02": "rainfall_accumulated_32bit",
106
- "03": "weather_code_synop_4680",
107
- "04": "weather_code_synop_4677",
108
- "05": "weather_code_metar_4678",
109
- "06": "weather_code_nws",
110
- "07": "reflectivity_32bit",
111
- "08": "mor_visibility",
112
- "09": "sample_interval",
113
- "10": "laser_amplitude",
114
- "11": "number_particles",
115
- "12": "sensor_temperature",
116
- # "13": "sensor_serial_number",
117
- # "14": "firmware_iop",
118
- # "15": "firmware_dsp",
119
- "16": "sensor_heating_current",
120
- "17": "sensor_battery_voltage",
121
- "18": "sensor_status",
122
- # "19": "start_time",
123
- "20": "sensor_time",
124
- "21": "sensor_date",
125
- # "22": "station_name",
126
- # "23": "station_number",
127
- "24": "rainfall_amount_absolute_32bit",
128
- "25": "error_code",
129
- "30": "rainfall_rate_16_bit",
130
- "31": "rainfall_rate_12_bit",
131
- "32": "rainfall_accumulated_16bit",
132
- "90": "raw_drop_concentration",
133
- "91": "raw_drop_average_velocity",
134
- "93": "raw_drop_number",
135
- }
136
-
137
- # Identify missing columns and add NaN
138
- expected_columns = np.array(list(column_dict.keys()))
139
- missing_columns = expected_columns[np.isin(expected_columns, df.columns, invert=True)].tolist()
140
- if len(missing_columns) > 0:
141
- for column in missing_columns:
142
- df[column] = "NaN"
143
-
144
- # Rename columns
145
- df = df.rename(column_dict, axis=1)
146
-
147
- # Keep only columns defined in the dictionary
148
- df = df[list(column_dict.values())]
149
-
150
- # Define datetime "time" column
151
- df["time"] = df["sensor_date"] + "-" + df["sensor_time"]
152
- df["time"] = pd.to_datetime(df["time"], format="%d.%m.%Y-%H:%M:%S", errors="coerce")
153
-
154
- # Drop columns not agreeing with DISDRODB L0 standards
155
- columns_to_drop = [
156
- "sensor_date",
157
- "sensor_time",
158
- # "firmware_iop",
159
- # "firmware_dsp",
160
- # "sensor_serial_number",
161
- # "station_name",
162
- # "station_number",
163
- ]
164
- df = df.drop(columns=columns_to_drop)
165
-
166
- return df
167
-
168
- ##------------------------------------------------------------------------.
169
- #### - Define glob pattern to search data files in <raw_dir>/data/<station_name>
170
- glob_patterns = "*.dat" # There is only one file without extension
171
-
172
- ####----------------------------------------------------------------------.
173
- #### - Create L0A products
174
- run_l0a(
175
- raw_dir=raw_dir,
176
- processed_dir=processed_dir,
177
- station_name=station_name,
178
- # Custom arguments of the reader for L0A processing
179
- glob_patterns=glob_patterns,
180
- column_names=column_names,
181
- reader_kwargs=reader_kwargs,
182
- df_sanitizer_fun=df_sanitizer_fun,
183
- # Processing options
184
- force=force,
185
- verbose=verbose,
186
- parallel=parallel,
187
- debugging_mode=debugging_mode,
188
- )