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.
Files changed (279) 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 +306 -270
  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 +46 -51
  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 +84 -65
  57. disdrodb/l0/configs/{Thies_LPM → LPM}/l0b_encodings.yml +50 -9
  58. disdrodb/l0/configs/{Thies_LPM → LPM}/raw_data_format.yml +285 -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 +23 -21
  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 +28 -26
  69. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/l0b_encodings.yml +20 -20
  70. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/raw_data_format.yml +107 -107
  71. disdrodb/l0/configs/PWS100/bins_diameter.yml +173 -0
  72. disdrodb/l0/configs/PWS100/bins_velocity.yml +173 -0
  73. disdrodb/l0/configs/PWS100/l0a_encodings.yml +19 -0
  74. disdrodb/l0/configs/PWS100/l0b_cf_attrs.yml +76 -0
  75. disdrodb/l0/configs/PWS100/l0b_encodings.yml +176 -0
  76. disdrodb/l0/configs/PWS100/raw_data_format.yml +182 -0
  77. disdrodb/l0/configs/{RD_80 → RD80}/bins_diameter.yml +40 -40
  78. disdrodb/l0/configs/RD80/l0a_encodings.yml +16 -0
  79. disdrodb/l0/configs/{RD_80 → RD80}/l0b_cf_attrs.yml +3 -3
  80. disdrodb/l0/configs/RD80/l0b_encodings.yml +135 -0
  81. disdrodb/l0/configs/{RD_80 → RD80}/raw_data_format.yml +46 -50
  82. disdrodb/l0/l0_reader.py +216 -340
  83. disdrodb/l0/l0a_processing.py +237 -208
  84. disdrodb/l0/l0b_nc_processing.py +227 -80
  85. disdrodb/l0/l0b_processing.py +96 -174
  86. disdrodb/l0/l0c_processing.py +627 -0
  87. disdrodb/l0/readers/{ARM → LPM/ARM}/ARM_LPM.py +36 -58
  88. disdrodb/l0/readers/LPM/AUSTRALIA/MELBOURNE_2007_LPM.py +236 -0
  89. disdrodb/l0/readers/LPM/BRAZIL/CHUVA_LPM.py +185 -0
  90. disdrodb/l0/readers/LPM/BRAZIL/GOAMAZON_LPM.py +185 -0
  91. disdrodb/l0/readers/LPM/ITALY/GID_LPM.py +195 -0
  92. disdrodb/l0/readers/LPM/ITALY/GID_LPM_W.py +210 -0
  93. disdrodb/l0/readers/{BRAZIL/GOAMAZON_LPM.py → LPM/KIT/CHWALA.py} +97 -76
  94. disdrodb/l0/readers/LPM/SLOVENIA/ARSO.py +197 -0
  95. disdrodb/l0/readers/LPM/SLOVENIA/CRNI_VRH.py +197 -0
  96. disdrodb/l0/readers/{UK → LPM/UK}/DIVEN.py +14 -35
  97. disdrodb/l0/readers/PARSIVEL/AUSTRALIA/MELBOURNE_2007_PARSIVEL.py +157 -0
  98. disdrodb/l0/readers/PARSIVEL/CHINA/CHONGQING.py +113 -0
  99. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/ARCTIC_2021.py +40 -57
  100. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/COMMON_2011.py +37 -54
  101. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/DAVOS_2009_2011.py +34 -51
  102. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_2009.py +34 -51
  103. disdrodb/l0/readers/{EPFL/PARADISO_2014.py → PARSIVEL/EPFL/EPFL_ROOF_2008.py} +38 -50
  104. disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2010.py +105 -0
  105. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_ROOF_2011.py +34 -51
  106. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_ROOF_2012.py +33 -51
  107. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GENEPI_2007.py +25 -44
  108. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GRAND_ST_BERNARD_2007.py +25 -44
  109. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GRAND_ST_BERNARD_2007_2.py +25 -44
  110. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/HPICONET_2010.py +34 -51
  111. disdrodb/l0/readers/{EPFL/EPFL_ROOF_2010.py → PARSIVEL/EPFL/HYMEX_LTE_SOP2.py} +37 -50
  112. disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP3.py +111 -0
  113. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/HYMEX_LTE_SOP4.py +36 -54
  114. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/LOCARNO_2018.py +34 -52
  115. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/LOCARNO_2019.py +38 -56
  116. disdrodb/l0/readers/PARSIVEL/EPFL/PARADISO_2014.py +105 -0
  117. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/PARSIVEL_2007.py +27 -45
  118. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/PLATO_2019.py +24 -44
  119. disdrodb/l0/readers/PARSIVEL/EPFL/RACLETS_2019.py +140 -0
  120. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/RACLETS_2019_WJF.py +41 -59
  121. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/RIETHOLZBACH_2011.py +34 -51
  122. disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2017.py +117 -0
  123. disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2019.py +137 -0
  124. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/UNIL_2022.py +42 -55
  125. disdrodb/l0/readers/PARSIVEL/GPM/IFLOODS.py +104 -0
  126. disdrodb/l0/readers/{GPM → PARSIVEL/GPM}/LPVEX.py +29 -48
  127. disdrodb/l0/readers/PARSIVEL/GPM/MC3E.py +184 -0
  128. disdrodb/l0/readers/PARSIVEL/KIT/BURKINA_FASO.py +133 -0
  129. disdrodb/l0/readers/PARSIVEL/NCAR/CCOPE_2015.py +113 -0
  130. disdrodb/l0/readers/{NCAR/VORTEX_SE_2016_P1.py → PARSIVEL/NCAR/OWLES_MIPS.py} +46 -72
  131. disdrodb/l0/readers/PARSIVEL/NCAR/PECAN_MOBILE.py +125 -0
  132. disdrodb/l0/readers/{NCAR/OWLES_MIPS.py → PARSIVEL/NCAR/PLOWS_MIPS.py} +45 -64
  133. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2009.py +114 -0
  134. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2010.py +176 -0
  135. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2010_UF.py +183 -0
  136. disdrodb/l0/readers/PARSIVEL/SLOVENIA/UL_FGG.py +121 -0
  137. disdrodb/l0/readers/{ARM/ARM_LD.py → PARSIVEL2/ARM/ARM_PARSIVEL2.py} +27 -50
  138. disdrodb/l0/readers/PARSIVEL2/BRAZIL/CHUVA_PARSIVEL2.py +163 -0
  139. disdrodb/l0/readers/PARSIVEL2/BRAZIL/GOAMAZON_PARSIVEL2.py +163 -0
  140. disdrodb/l0/readers/{DENMARK → PARSIVEL2/DENMARK}/EROSION_nc.py +14 -35
  141. disdrodb/l0/readers/PARSIVEL2/FRANCE/ENPC_PARSIVEL2.py +189 -0
  142. disdrodb/l0/readers/PARSIVEL2/FRANCE/SIRTA_PARSIVEL2.py +119 -0
  143. disdrodb/l0/readers/PARSIVEL2/GPM/GCPEX.py +104 -0
  144. disdrodb/l0/readers/PARSIVEL2/GPM/NSSTC.py +176 -0
  145. disdrodb/l0/readers/PARSIVEL2/ITALY/GID_PARSIVEL2.py +32 -0
  146. disdrodb/l0/readers/PARSIVEL2/MEXICO/OH_IIUNAM_nc.py +56 -0
  147. disdrodb/l0/readers/PARSIVEL2/NCAR/PECAN_FP3.py +120 -0
  148. disdrodb/l0/readers/{NCAR → PARSIVEL2/NCAR}/PECAN_MIPS.py +45 -64
  149. disdrodb/l0/readers/PARSIVEL2/NCAR/RELAMPAGO_PARSIVEL2.py +181 -0
  150. disdrodb/l0/readers/PARSIVEL2/NCAR/SNOWIE_PJ.py +160 -0
  151. disdrodb/l0/readers/PARSIVEL2/NCAR/SNOWIE_SB.py +160 -0
  152. disdrodb/l0/readers/{NCAR/PLOWS_MIPS.py → PARSIVEL2/NCAR/VORTEX_SE_2016_P1.py} +49 -66
  153. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_P2.py +118 -0
  154. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_PIPS.py +152 -0
  155. disdrodb/l0/readers/PARSIVEL2/NETHERLANDS/DELFT.py +166 -0
  156. disdrodb/l0/readers/PWS100/FRANCE/ENPC_PWS100.py +150 -0
  157. disdrodb/l0/readers/{NCAR/RELAMPAGO_RD80.py → RD80/BRAZIL/CHUVA_RD80.py} +36 -60
  158. disdrodb/l0/readers/{BRAZIL → RD80/BRAZIL}/GOAMAZON_RD80.py +36 -55
  159. disdrodb/l0/readers/{NCAR → RD80/NCAR}/CINDY_2011_RD80.py +35 -54
  160. disdrodb/l0/readers/{BRAZIL/CHUVA_RD80.py → RD80/NCAR/RELAMPAGO_RD80.py} +40 -54
  161. disdrodb/l0/readers/RD80/NOAA/PSL_RD80.py +274 -0
  162. disdrodb/l0/readers/template_reader_raw_netcdf_data.py +62 -0
  163. disdrodb/l0/readers/{reader_template.py → template_reader_raw_text_data.py} +20 -44
  164. disdrodb/l0/routines.py +885 -581
  165. disdrodb/l0/standards.py +77 -238
  166. disdrodb/l0/template_tools.py +105 -110
  167. disdrodb/l1/__init__.py +17 -0
  168. disdrodb/l1/beard_model.py +716 -0
  169. disdrodb/l1/encoding_attrs.py +635 -0
  170. disdrodb/l1/fall_velocity.py +260 -0
  171. disdrodb/l1/filters.py +192 -0
  172. disdrodb/l1/processing.py +202 -0
  173. disdrodb/l1/resampling.py +236 -0
  174. disdrodb/l1/routines.py +358 -0
  175. disdrodb/l1_env/__init__.py +17 -0
  176. disdrodb/l1_env/routines.py +38 -0
  177. disdrodb/l2/__init__.py +17 -0
  178. disdrodb/l2/empirical_dsd.py +1833 -0
  179. disdrodb/l2/event.py +388 -0
  180. disdrodb/l2/processing.py +528 -0
  181. disdrodb/l2/processing_options.py +213 -0
  182. disdrodb/l2/routines.py +868 -0
  183. disdrodb/metadata/__init__.py +9 -2
  184. disdrodb/metadata/checks.py +180 -124
  185. disdrodb/metadata/download.py +81 -0
  186. disdrodb/metadata/geolocation.py +146 -0
  187. disdrodb/metadata/info.py +20 -13
  188. disdrodb/metadata/manipulation.py +3 -3
  189. disdrodb/metadata/reader.py +59 -8
  190. disdrodb/metadata/search.py +77 -144
  191. disdrodb/metadata/standards.py +83 -80
  192. disdrodb/metadata/writer.py +10 -16
  193. disdrodb/psd/__init__.py +38 -0
  194. disdrodb/psd/fitting.py +2146 -0
  195. disdrodb/psd/models.py +774 -0
  196. disdrodb/routines.py +1412 -0
  197. disdrodb/scattering/__init__.py +28 -0
  198. disdrodb/scattering/axis_ratio.py +344 -0
  199. disdrodb/scattering/routines.py +456 -0
  200. disdrodb/utils/__init__.py +17 -0
  201. disdrodb/utils/attrs.py +208 -0
  202. disdrodb/utils/cli.py +269 -0
  203. disdrodb/utils/compression.py +60 -42
  204. disdrodb/utils/dask.py +62 -0
  205. disdrodb/utils/dataframe.py +342 -0
  206. disdrodb/utils/decorators.py +110 -0
  207. disdrodb/utils/directories.py +107 -46
  208. disdrodb/utils/encoding.py +127 -0
  209. disdrodb/utils/list.py +29 -0
  210. disdrodb/utils/logger.py +168 -46
  211. disdrodb/utils/time.py +657 -0
  212. disdrodb/utils/warnings.py +30 -0
  213. disdrodb/utils/writer.py +57 -0
  214. disdrodb/utils/xarray.py +138 -47
  215. disdrodb/utils/yaml.py +0 -1
  216. disdrodb/viz/__init__.py +17 -0
  217. disdrodb/viz/plots.py +17 -0
  218. disdrodb-0.1.1.dist-info/METADATA +294 -0
  219. disdrodb-0.1.1.dist-info/RECORD +232 -0
  220. {disdrodb-0.0.21.dist-info → disdrodb-0.1.1.dist-info}/WHEEL +1 -1
  221. disdrodb-0.1.1.dist-info/entry_points.txt +30 -0
  222. disdrodb/data_transfer/scripts/disdrodb_download_archive.py +0 -53
  223. disdrodb/data_transfer/scripts/disdrodb_upload_archive.py +0 -57
  224. disdrodb/l0/configs/OTT_Parsivel/l0a_encodings.yml +0 -32
  225. disdrodb/l0/configs/OTT_Parsivel2/l0a_encodings.yml +0 -39
  226. disdrodb/l0/configs/RD_80/l0a_encodings.yml +0 -16
  227. disdrodb/l0/configs/RD_80/l0b_encodings.yml +0 -135
  228. disdrodb/l0/configs/Thies_LPM/l0a_encodings.yml +0 -80
  229. disdrodb/l0/io.py +0 -257
  230. disdrodb/l0/l0_processing.py +0 -1091
  231. disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_OTT.py +0 -178
  232. disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_THIES.py +0 -247
  233. disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py +0 -204
  234. disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py +0 -183
  235. disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py +0 -183
  236. disdrodb/l0/readers/CHINA/CHONGQING.py +0 -131
  237. disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py +0 -128
  238. disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py +0 -127
  239. disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py +0 -129
  240. disdrodb/l0/readers/EPFL/RACLETS_2019.py +0 -158
  241. disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py +0 -136
  242. disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py +0 -158
  243. disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py +0 -138
  244. disdrodb/l0/readers/GPM/GCPEX.py +0 -123
  245. disdrodb/l0/readers/GPM/IFLOODS.py +0 -123
  246. disdrodb/l0/readers/GPM/MC3E.py +0 -123
  247. disdrodb/l0/readers/GPM/NSSTC.py +0 -164
  248. disdrodb/l0/readers/ITALY/GID.py +0 -199
  249. disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py +0 -92
  250. disdrodb/l0/readers/NCAR/CCOPE_2015.py +0 -133
  251. disdrodb/l0/readers/NCAR/PECAN_FP3.py +0 -137
  252. disdrodb/l0/readers/NCAR/PECAN_MOBILE.py +0 -144
  253. disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py +0 -195
  254. disdrodb/l0/readers/NCAR/SNOWIE_PJ.py +0 -172
  255. disdrodb/l0/readers/NCAR/SNOWIE_SB.py +0 -179
  256. disdrodb/l0/readers/NCAR/VORTEX2_2009.py +0 -133
  257. disdrodb/l0/readers/NCAR/VORTEX2_2010.py +0 -188
  258. disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py +0 -191
  259. disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py +0 -135
  260. disdrodb/l0/readers/NCAR/VORTEX_SE_2016_PIPS.py +0 -170
  261. disdrodb/l0/readers/NETHERLANDS/DELFT.py +0 -187
  262. disdrodb/l0/readers/SPAIN/SBEGUERIA.py +0 -179
  263. disdrodb/l0/scripts/disdrodb_run_l0b_concat.py +0 -93
  264. disdrodb/l0/scripts/disdrodb_run_l0b_concat_station.py +0 -85
  265. disdrodb/utils/netcdf.py +0 -452
  266. disdrodb/utils/scripts.py +0 -102
  267. disdrodb-0.0.21.dist-info/AUTHORS.md +0 -18
  268. disdrodb-0.0.21.dist-info/METADATA +0 -186
  269. disdrodb-0.0.21.dist-info/RECORD +0 -168
  270. disdrodb-0.0.21.dist-info/entry_points.txt +0 -15
  271. /disdrodb/l0/configs/{RD_80 → RD80}/bins_velocity.yml +0 -0
  272. /disdrodb/l0/manuals/{Thies_LPM.pdf → LPM.pdf} +0 -0
  273. /disdrodb/l0/manuals/{ODM_470.pdf → ODM470.pdf} +0 -0
  274. /disdrodb/l0/manuals/{OTT_Parsivel.pdf → PARSIVEL.pdf} +0 -0
  275. /disdrodb/l0/manuals/{OTT_Parsivel2.pdf → PARSIVEL2.pdf} +0 -0
  276. /disdrodb/l0/manuals/{PWS_100.pdf → PWS100.pdf} +0 -0
  277. /disdrodb/l0/manuals/{RD_80.pdf → RD80.pdf} +0 -0
  278. {disdrodb-0.0.21.dist-info → disdrodb-0.1.1.dist-info/licenses}/LICENSE +0 -0
  279. {disdrodb-0.0.21.dist-info → disdrodb-0.1.1.dist-info}/top_level.txt +0 -0
disdrodb/routines.py ADDED
@@ -0,0 +1,1412 @@
1
+ # -----------------------------------------------------------------------------.
2
+ # Copyright (c) 2021-2023 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 CLI routine wrappers."""
18
+ import datetime
19
+ import time
20
+ from typing import Optional
21
+
22
+ from disdrodb.api.search import available_stations, get_required_product
23
+ from disdrodb.utils.cli import _execute_cmd
24
+
25
+ ####--------------------------------------------------------------------------.
26
+ #### Run DISDRODB Station Processing
27
+
28
+
29
+ def run_l0_station(
30
+ data_source,
31
+ campaign_name,
32
+ station_name,
33
+ # L0 archive options
34
+ l0a_processing: bool = True,
35
+ l0b_processing: bool = True,
36
+ l0c_processing: bool = True,
37
+ remove_l0a: bool = False,
38
+ remove_l0b: bool = False,
39
+ # Processing options
40
+ force: bool = False,
41
+ verbose: bool = False,
42
+ debugging_mode: bool = False,
43
+ parallel: bool = True,
44
+ # DISDRODB root directories
45
+ data_archive_dir: Optional[str] = None,
46
+ metadata_archive_dir: Optional[str] = None,
47
+ ):
48
+ """Run the L0 processing of a specific DISDRODB station from the terminal.
49
+
50
+ Parameters
51
+ ----------
52
+ data_source : str
53
+ Institution name (when campaign data spans more than 1 country),
54
+ or country (when all campaigns (or sensor networks) are inside a given country).
55
+ Must be UPPER CASE.
56
+ campaign_name : str
57
+ Campaign name. Must be UPPER CASE.
58
+ station_name : str
59
+ Station name
60
+ l0a_processing : bool
61
+ Whether to launch processing to generate L0A Apache Parquet file(s) from raw data.
62
+ The default value is ``True``.
63
+ l0b_processing : bool
64
+ Whether to launch processing to generate L0B netCDF4 file(s) from L0A data.
65
+ The default value is ``True``.
66
+ l0b_processing : bool
67
+ Whether to launch processing to generate L0C netCDF4 file(s) from L0B data.
68
+ The default value is ``True``.
69
+ l0c_processing : bool
70
+ Whether to launch processing to generate L0C netCDF4 file(s) from L0C data.
71
+ The default is True.
72
+ remove_l0a : bool
73
+ Whether to keep the L0A files after having generated the L0B netCDF products.
74
+ The default value is ``False``.
75
+ remove_l0b : bool
76
+ Whether to remove the L0B files after having produced L0C netCDF files.
77
+ The default is False.
78
+ force : bool
79
+ If ``True``, overwrite existing data into destination directories.
80
+ If ``False``, raise an error if there are already data into destination directories.
81
+ The default value is ``False``.
82
+ verbose : bool
83
+ Whether to print detailed processing information into terminal.
84
+ The default value is ``True``.
85
+ parallel : bool
86
+ If ``True``, the files are processed simultaneously in multiple processes.
87
+ Each process will use a single thread to avoid issues with the HDF/netCDF library.
88
+ By default, the number of process is defined with ``os.cpu_count()``.
89
+ If ``False``, the files are processed sequentially in a single process.
90
+ If ``False``, multi-threading is automatically exploited to speed up I/0 tasks.
91
+ debugging_mode : bool
92
+ If ``True``, it reduces the amount of data to process.
93
+ For L0A, it processes just the first 3 raw data files for each station.
94
+ For L0B, it processes just the first 100 rows of 3 L0A files for each station.
95
+ The default value is ``False``.
96
+ data_archive_dir : str (optional)
97
+ The directory path where the DISDRODB Data Archive is located.
98
+ The directory path must end with ``<...>/DISDRODB``.
99
+ If ``None``, it uses the ``data_archive_dir`` path specified
100
+ in the DISDRODB active configuration.
101
+ """
102
+ # ---------------------------------------------------------------------.
103
+ t_i = time.time()
104
+ print(f"L0 processing of station {station_name} has started.")
105
+
106
+ # ------------------------------------------------------------------.
107
+ # L0A processing
108
+ if l0a_processing:
109
+ run_l0a_station(
110
+ # DISDRODB root directories
111
+ data_archive_dir=data_archive_dir,
112
+ metadata_archive_dir=metadata_archive_dir,
113
+ # Station arguments
114
+ data_source=data_source,
115
+ campaign_name=campaign_name,
116
+ station_name=station_name,
117
+ # Processing options
118
+ force=force,
119
+ verbose=verbose,
120
+ debugging_mode=debugging_mode,
121
+ parallel=parallel,
122
+ )
123
+ # ------------------------------------------------------------------.
124
+ # L0B processing
125
+ if l0b_processing:
126
+ run_l0b_station(
127
+ # DISDRODB root directories
128
+ data_archive_dir=data_archive_dir,
129
+ metadata_archive_dir=metadata_archive_dir,
130
+ # Station arguments
131
+ data_source=data_source,
132
+ campaign_name=campaign_name,
133
+ station_name=station_name,
134
+ # L0B processing options
135
+ remove_l0a=remove_l0a,
136
+ # Processing options
137
+ force=force,
138
+ verbose=verbose,
139
+ debugging_mode=debugging_mode,
140
+ parallel=parallel,
141
+ )
142
+
143
+ # ------------------------------------------------------------------.
144
+ # L0C processing
145
+ if l0c_processing:
146
+ run_l0c_station(
147
+ # DISDRODB root directories
148
+ data_archive_dir=data_archive_dir,
149
+ metadata_archive_dir=metadata_archive_dir,
150
+ # Station arguments
151
+ data_source=data_source,
152
+ campaign_name=campaign_name,
153
+ station_name=station_name,
154
+ # L0C processing options
155
+ remove_l0b=remove_l0b,
156
+ # Processing options
157
+ force=force,
158
+ verbose=verbose,
159
+ debugging_mode=debugging_mode,
160
+ parallel=parallel,
161
+ )
162
+
163
+ # -------------------------------------------------------------------------.
164
+ # End of L0 processing for all stations
165
+ timedelta_str = str(datetime.timedelta(seconds=round(time.time() - t_i)))
166
+ print(f"L0 processing of stations {station_name} completed in {timedelta_str}")
167
+
168
+
169
+ def run_l0a_station(
170
+ # Station arguments
171
+ data_source,
172
+ campaign_name,
173
+ station_name,
174
+ # Processing options
175
+ force: bool = False,
176
+ verbose: bool = False,
177
+ debugging_mode: bool = False,
178
+ parallel: bool = True,
179
+ # DISDRODB root directories
180
+ data_archive_dir: Optional[str] = None,
181
+ metadata_archive_dir: Optional[str] = None,
182
+ ):
183
+ """
184
+ Run the L0A processing of a station by invoking the disdrodb_run_l0a_station command in the terminal.
185
+
186
+ Parameters
187
+ ----------
188
+ data_source : str
189
+ The name of the data source.
190
+ campaign_name : str
191
+ The name of the campaign.
192
+ station_name : str
193
+ The name of the station.
194
+ force : bool, optional
195
+ If ``True``, overwrite existing data in destination directories.
196
+ The default value is ``False``.
197
+ verbose : bool, optional
198
+ If ``True``, print detailed processing information to the terminal.
199
+ The default value is ``False``.
200
+ debugging_mode : bool, optional
201
+ If ``True``, reduce the amount of data to process for debugging.
202
+ The default value is ``False``.
203
+ parallel : bool, optional
204
+ If ``True``, process files in multiple processes simultaneously.
205
+ The default value is ``True``.
206
+ data_archive_dir
207
+ The directory path where the local DISDRODB Data Archive is located.
208
+ The directory path must end with ``<...>/DISDRODB``.
209
+ If ``None``, it uses the ``data_archive_dir`` path specified
210
+ in the DISDRODB active configuration.
211
+ metadata_archive_dir
212
+ The directory path where the DISDRODB Metadata Archive is located.
213
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
214
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
215
+ in the DISDRODB active configuration.
216
+ """
217
+ # Define command
218
+ cmd = " ".join(
219
+ [
220
+ "disdrodb_run_l0a_station",
221
+ # Station arguments
222
+ data_source,
223
+ campaign_name,
224
+ station_name,
225
+ # DISDRODB root directories
226
+ "--data_archive_dir",
227
+ str(data_archive_dir),
228
+ "--metadata_archive_dir",
229
+ str(metadata_archive_dir),
230
+ # Processing options
231
+ "--force",
232
+ str(force),
233
+ "--verbose",
234
+ str(verbose),
235
+ "--debugging_mode",
236
+ str(debugging_mode),
237
+ "--parallel",
238
+ str(parallel),
239
+ ],
240
+ )
241
+ # Execute command
242
+ _execute_cmd(cmd)
243
+
244
+
245
+ def run_l0b_station(
246
+ # Station arguments
247
+ data_source,
248
+ campaign_name,
249
+ station_name,
250
+ # L0B processing options
251
+ remove_l0a: bool = False,
252
+ # Processing options
253
+ force: bool = False,
254
+ verbose: bool = False,
255
+ debugging_mode: bool = False,
256
+ parallel: bool = True,
257
+ # DISDRODB root directories
258
+ data_archive_dir: Optional[str] = None,
259
+ metadata_archive_dir: Optional[str] = None,
260
+ ):
261
+ """
262
+ Run the L0B processing of a station by invoking the disdrodb_run_l0b_station command in the terminal.
263
+
264
+ Parameters
265
+ ----------
266
+ data_archive_dir
267
+ The directory path where the local DISDRODB Data Archive is located.
268
+ The directory path must end with ``<...>/DISDRODB``.
269
+ If ``None``, it uses the ``data_archive_dir`` path specified
270
+ in the DISDRODB active configuration.
271
+ metadata_archive_dir
272
+ The directory path where the DISDRODB Metadata Archive is located.
273
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
274
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
275
+ in the DISDRODB active configuration.
276
+ data_source : str
277
+ The name of the data source.
278
+ campaign_name : str
279
+ The name of the campaign.
280
+ station_name : str
281
+ The name of the station.
282
+ remove_l0a : bool, optional
283
+ Whether to keep the L0A files after generating L0B netCDF files.
284
+ The default value is ``False``.
285
+ force : bool, optional
286
+ If ``True``, overwrite existing data in destination directories.
287
+ The default value is ``False``.
288
+ verbose : bool, optional
289
+ If ``True``, print detailed processing information to the terminal.
290
+ The default value is ``False``.
291
+ debugging_mode : bool, optional
292
+ If ``True``, reduce the amount of data processed for debugging.
293
+ The default value is ``False``.
294
+ parallel : bool, optional
295
+ If ``True``, process files in multiple processes simultaneously.
296
+ The default value is ``True``.
297
+ """
298
+ # Define command
299
+ cmd = " ".join(
300
+ [
301
+ "disdrodb_run_l0b_station",
302
+ # Station arguments
303
+ data_source,
304
+ campaign_name,
305
+ station_name,
306
+ # DISDRODB root directories
307
+ "--data_archive_dir",
308
+ str(data_archive_dir),
309
+ "--metadata_archive_dir",
310
+ str(metadata_archive_dir),
311
+ # L0B processing options
312
+ "--remove_l0a",
313
+ str(remove_l0a),
314
+ # Processing options
315
+ "--force",
316
+ str(force),
317
+ "--verbose",
318
+ str(verbose),
319
+ "--debugging_mode",
320
+ str(debugging_mode),
321
+ "--parallel",
322
+ str(parallel),
323
+ ],
324
+ )
325
+ # Execute command
326
+ _execute_cmd(cmd)
327
+
328
+
329
+ def run_l0c_station(
330
+ # Station arguments
331
+ data_source,
332
+ campaign_name,
333
+ station_name,
334
+ # L0C options
335
+ remove_l0b: bool = False,
336
+ # Processing options
337
+ force: bool = False,
338
+ verbose: bool = False,
339
+ debugging_mode: bool = False,
340
+ parallel: bool = True,
341
+ # DISDRODB root directories
342
+ data_archive_dir: Optional[str] = None,
343
+ metadata_archive_dir: Optional[str] = None,
344
+ ):
345
+ """
346
+ Run the L0C processing of a station by invoking the disdrodb_run_l0c_station command in the terminal.
347
+
348
+ Parameters
349
+ ----------
350
+ data_source : str
351
+ The name of the data source.
352
+ campaign_name : str
353
+ The name of the campaign.
354
+ station_name : str
355
+ The name of the station.
356
+ remove_l0b : bool, optional
357
+ Whether to remove the L0B files after generating L0C netCDF files.
358
+ The default value is ``False``.
359
+ force : bool, optional
360
+ If ``True``, overwrite existing data in destination directories.
361
+ The default value is ``False``.
362
+ verbose : bool, optional
363
+ If ``True``, print detailed processing information to the terminal.
364
+ The default value is ``False``.
365
+ debugging_mode : bool, optional
366
+ If ``True``, reduce the amount of data processed for debugging.
367
+ The default value is ``False``.
368
+ parallel : bool, optional
369
+ If ``True``, process files in multiple processes simultaneously.
370
+ The default value is ``True``.
371
+ data_archive_dir
372
+ The directory path where the local DISDRODB Data Archive is located.
373
+ The directory path must end with ``<...>/DISDRODB``.
374
+ If ``None``, it uses the ``data_archive_dir`` path specified
375
+ in the DISDRODB active configuration.
376
+ metadata_archive_dir
377
+ The directory path where the DISDRODB Metadata Archive is located.
378
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
379
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
380
+ in the DISDRODB active configuration.
381
+ """
382
+ # Define command
383
+ cmd = " ".join(
384
+ [
385
+ "disdrodb_run_l0c_station",
386
+ # Station arguments
387
+ data_source,
388
+ campaign_name,
389
+ station_name,
390
+ # DISDRODB root directories
391
+ "--data_archive_dir",
392
+ str(data_archive_dir),
393
+ "--metadata_archive_dir",
394
+ str(metadata_archive_dir),
395
+ # L0C processing options
396
+ "--remove_l0b",
397
+ str(remove_l0b),
398
+ # Processing options
399
+ "--force",
400
+ str(force),
401
+ "--verbose",
402
+ str(verbose),
403
+ "--debugging_mode",
404
+ str(debugging_mode),
405
+ "--parallel",
406
+ str(parallel),
407
+ ],
408
+ )
409
+ # Execute command
410
+ _execute_cmd(cmd)
411
+
412
+
413
+ def run_l1_station(
414
+ # Station arguments
415
+ data_source,
416
+ campaign_name,
417
+ station_name,
418
+ # Processing options
419
+ force: bool = False,
420
+ verbose: bool = False,
421
+ debugging_mode: bool = False,
422
+ parallel: bool = True,
423
+ # DISDRODB root directories
424
+ data_archive_dir: Optional[str] = None,
425
+ metadata_archive_dir: Optional[str] = None,
426
+ ):
427
+ """
428
+ Run the L1 processing of a station by invoking the disdrodb_run_l1_station command in the terminal.
429
+
430
+ Parameters
431
+ ----------
432
+ data_source : str
433
+ The name of the data source.
434
+ campaign_name : str
435
+ The name of the campaign.
436
+ station_name : str
437
+ The name of the station.
438
+ force : bool, optional
439
+ If ``True``, overwrite existing data in destination directories.
440
+ The default value is ``False``.
441
+ verbose : bool, optional
442
+ If ``True``, print detailed processing information to the terminal.
443
+ The default value is ``False``.
444
+ debugging_mode : bool, optional
445
+ If ``True``, reduce the amount of data processed for debugging.
446
+ The default value is ``False``.
447
+ parallel : bool, optional
448
+ If ``True``, process files in multiple processes simultaneously.
449
+ The default value is ``True``.
450
+ data_archive_dir
451
+ The directory path where the local DISDRODB Data Archive is located.
452
+ The directory path must end with ``<...>/DISDRODB``.
453
+ If ``None``, it uses the ``data_archive_dir`` path specified
454
+ in the DISDRODB active configuration.
455
+ metadata_archive_dir
456
+ The directory path where the DISDRODB Metadata Archive is located.
457
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
458
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
459
+ in the DISDRODB active configuration.
460
+ """
461
+ # Define command
462
+ cmd = " ".join(
463
+ [
464
+ "disdrodb_run_l1_station",
465
+ # Station arguments
466
+ data_source,
467
+ campaign_name,
468
+ station_name,
469
+ # DISDRODB root directories
470
+ "--data_archive_dir",
471
+ str(data_archive_dir),
472
+ "--metadata_archive_dir",
473
+ str(metadata_archive_dir),
474
+ # Processing options
475
+ "--force",
476
+ str(force),
477
+ "--verbose",
478
+ str(verbose),
479
+ "--debugging_mode",
480
+ str(debugging_mode),
481
+ "--parallel",
482
+ str(parallel),
483
+ ],
484
+ )
485
+ # Execute command
486
+ _execute_cmd(cmd)
487
+
488
+
489
+ def run_l2e_station(
490
+ # Station arguments
491
+ data_source,
492
+ campaign_name,
493
+ station_name,
494
+ # Processing options
495
+ force: bool = False,
496
+ verbose: bool = False,
497
+ debugging_mode: bool = False,
498
+ parallel: bool = True,
499
+ # DISDRODB root directories
500
+ data_archive_dir: Optional[str] = None,
501
+ metadata_archive_dir: Optional[str] = None,
502
+ ):
503
+ """
504
+ Run the L2E processing of a station by invoking the disdrodb_run_l2e_station command in the terminal.
505
+
506
+ Parameters
507
+ ----------
508
+ data_source : str
509
+ The name of the data source.
510
+ campaign_name : str
511
+ The name of the campaign.
512
+ station_name : str
513
+ The name of the station.
514
+ force : bool, optional
515
+ If ``True``, overwrite existing data in destination directories.
516
+ The default value is ``False``.
517
+ verbose : bool, optional
518
+ If ``True``, print detailed processing information to the terminal.
519
+ The default value is ``False``.
520
+ debugging_mode : bool, optional
521
+ If ``True``, reduce the amount of data processed for debugging.
522
+ The default value is ``False``.
523
+ parallel : bool, optional
524
+ If ``True``, process files in multiple processes simultaneously.
525
+ The default value is ``True``.
526
+ data_archive_dir
527
+ The directory path where the local DISDRODB Data Archive is located.
528
+ The directory path must end with ``<...>/DISDRODB``.
529
+ If ``None``, it uses the ``data_archive_dir`` path specified
530
+ in the DISDRODB active configuration.
531
+ metadata_archive_dir
532
+ The directory path where the DISDRODB Metadata Archive is located.
533
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
534
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
535
+ in the DISDRODB active configuration.
536
+ """
537
+ # Define command
538
+ cmd = " ".join(
539
+ [
540
+ "disdrodb_run_l2e_station",
541
+ # Station arguments
542
+ data_source,
543
+ campaign_name,
544
+ station_name,
545
+ # DISDRODB root directories
546
+ "--data_archive_dir",
547
+ str(data_archive_dir),
548
+ "--metadata_archive_dir",
549
+ str(metadata_archive_dir),
550
+ # Processing options
551
+ "--force",
552
+ str(force),
553
+ "--verbose",
554
+ str(verbose),
555
+ "--debugging_mode",
556
+ str(debugging_mode),
557
+ "--parallel",
558
+ str(parallel),
559
+ ],
560
+ )
561
+ # Execute command
562
+ _execute_cmd(cmd)
563
+
564
+
565
+ def run_l2m_station(
566
+ # Station arguments
567
+ data_source,
568
+ campaign_name,
569
+ station_name,
570
+ # Processing options
571
+ force: bool = False,
572
+ verbose: bool = False,
573
+ debugging_mode: bool = False,
574
+ parallel: bool = True,
575
+ # DISDRODB root directories
576
+ data_archive_dir: Optional[str] = None,
577
+ metadata_archive_dir: Optional[str] = None,
578
+ ):
579
+ """
580
+ Run the L2M processing of a station by invoking the disdrodb_run_l2m_station command in the terminal.
581
+
582
+ Parameters
583
+ ----------
584
+ data_source : str
585
+ The name of the data source.
586
+ campaign_name : str
587
+ The name of the campaign.
588
+ station_name : str
589
+ The name of the station.
590
+ force : bool, optional
591
+ If ``True``, overwrite existing data in destination directories.
592
+ The default value is ``False``.
593
+ verbose : bool, optional
594
+ If ``True``, print detailed processing information to the terminal.
595
+ The default value is ``False``.
596
+ debugging_mode : bool, optional
597
+ If ``True``, reduce the amount of data processed for debugging.
598
+ The default value is ``False``.
599
+ parallel : bool, optional
600
+ If ``True``, process files in multiple processes simultaneously.
601
+ The default value is ``True``.
602
+ data_archive_dir
603
+ The directory path where the local DISDRODB Data Archive is located.
604
+ The directory path must end with ``<...>/DISDRODB``.
605
+ If ``None``, it uses the ``data_archive_dir`` path specified
606
+ in the DISDRODB active configuration.
607
+ metadata_archive_dir
608
+ The directory path where the DISDRODB Metadata Archive is located.
609
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
610
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
611
+ in the DISDRODB active configuration.
612
+ """
613
+ # Define command
614
+ cmd = " ".join(
615
+ [
616
+ "disdrodb_run_l2m_station",
617
+ # Station arguments
618
+ data_source,
619
+ campaign_name,
620
+ station_name,
621
+ # DISDRODB root directories
622
+ "--data_archive_dir",
623
+ str(data_archive_dir),
624
+ "--metadata_archive_dir",
625
+ str(metadata_archive_dir),
626
+ # Processing options
627
+ "--force",
628
+ str(force),
629
+ "--verbose",
630
+ str(verbose),
631
+ "--debugging_mode",
632
+ str(debugging_mode),
633
+ "--parallel",
634
+ str(parallel),
635
+ ],
636
+ )
637
+ # Execute command
638
+ _execute_cmd(cmd)
639
+
640
+
641
+ ####--------------------------------------------------------------------------.
642
+ #### Run DISDRODB Archive Processing
643
+
644
+
645
+ def run_l0a(
646
+ data_sources=None,
647
+ campaign_names=None,
648
+ station_names=None,
649
+ # Processing options
650
+ force: bool = False,
651
+ verbose: bool = False,
652
+ debugging_mode: bool = False,
653
+ parallel: bool = True,
654
+ # DISDRODB root directories
655
+ data_archive_dir: Optional[str] = None,
656
+ metadata_archive_dir: Optional[str] = None,
657
+ ):
658
+ """Run the L0A processing of DISDRODB stations.
659
+
660
+ This function allows to launch the processing of many DISDRODB stations with a single command.
661
+ From the list of all available DISDRODB stations, it runs the processing of the
662
+ stations matching the provided data_sources, campaign_names and station_names.
663
+
664
+ Parameters
665
+ ----------
666
+ data_sources : list
667
+ Name of data source(s) to process.
668
+ The name(s) must be UPPER CASE.
669
+ If campaign_names and station are not specified, process all stations.
670
+ The default value is ``None``.
671
+ campaign_names : list
672
+ Name of the campaign(s) to process.
673
+ The name(s) must be UPPER CASE.
674
+ The default value is ``None``.
675
+ station_names : list
676
+ Station names to process.
677
+ The default value is ``None``.
678
+ force : bool
679
+ If ``True``, overwrite existing data into destination directories.
680
+ If ``False``, raise an error if there are already data into destination directories.
681
+ The default value is ``False``.
682
+ verbose : bool
683
+ Whether to print detailed processing information into terminal.
684
+ The default value is ``True``.
685
+ parallel : bool
686
+ If ``True``, the files are processed simultaneously in multiple processes.
687
+ By default, the number of process is defined with ``os.cpu_count()``.
688
+ If ``False``, the files are processed sequentially in a single process.
689
+ debugging_mode : bool
690
+ If ``True``, it processes just the first 3 raw data files.
691
+ The default value is ``False``.
692
+ data_archive_dir : str (optional)
693
+ The directory path where the DISDRODB Data Archive is located.
694
+ The directory path must end with ``<...>/DISDRODB``.
695
+ If ``None``, it uses the ``data_archive_dir`` path specified
696
+ in the DISDRODB active configuration.
697
+ metadata_archive_dir
698
+ The directory path where the DISDRODB Metadata Archive is located.
699
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
700
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
701
+ in the DISDRODB active configuration.
702
+ """
703
+ # Define products
704
+ product = "L0A"
705
+ required_product = get_required_product(product)
706
+
707
+ # Get list of available stations
708
+ list_info = available_stations(
709
+ # DISDRODB root directories
710
+ data_archive_dir=data_archive_dir,
711
+ metadata_archive_dir=metadata_archive_dir,
712
+ # Stations arguments
713
+ data_sources=data_sources,
714
+ campaign_names=campaign_names,
715
+ station_names=station_names,
716
+ # Search options
717
+ product=required_product,
718
+ raise_error_if_empty=True,
719
+ )
720
+
721
+ # Print message
722
+ n_stations = len(list_info)
723
+ print(f"{product} processing of {n_stations} stations started.")
724
+
725
+ # Loop over stations
726
+ for data_source, campaign_name, station_name in list_info:
727
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station started.")
728
+ # Run processing
729
+ run_l0a_station(
730
+ # DISDRODB root directories
731
+ data_archive_dir=data_archive_dir,
732
+ metadata_archive_dir=metadata_archive_dir,
733
+ # Station arguments
734
+ data_source=data_source,
735
+ campaign_name=campaign_name,
736
+ station_name=station_name,
737
+ # Process options
738
+ force=force,
739
+ verbose=verbose,
740
+ debugging_mode=debugging_mode,
741
+ parallel=parallel,
742
+ )
743
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station ended.")
744
+
745
+
746
+ def run_l0b(
747
+ data_sources=None,
748
+ campaign_names=None,
749
+ station_names=None,
750
+ # L0B processing options
751
+ remove_l0a: bool = False,
752
+ # Processing options
753
+ force: bool = False,
754
+ verbose: bool = False,
755
+ debugging_mode: bool = False,
756
+ parallel: bool = True,
757
+ # DISDRODB root directories
758
+ data_archive_dir: Optional[str] = None,
759
+ metadata_archive_dir: Optional[str] = None,
760
+ ):
761
+ """Run the L0B processing of DISDRODB stations.
762
+
763
+ This function allows to launch the processing of many DISDRODB stations with a single command.
764
+ From the list of all available DISDRODB L0A stations, it runs the processing of the
765
+ stations matching the provided data_sources, campaign_names and station_names.
766
+
767
+ Parameters
768
+ ----------
769
+ data_sources : list
770
+ Name of data source(s) to process.
771
+ The name(s) must be UPPER CASE.
772
+ If campaign_names and station are not specified, process all stations.
773
+ The default value is ``None``.
774
+ campaign_names : list
775
+ Name of the campaign(s) to process.
776
+ The name(s) must be UPPER CASE.
777
+ The default value is ``None``.
778
+ station_names : list
779
+ Station names to process.
780
+ The default value is ``None``.
781
+ remove_l0a : bool
782
+ Whether to keep the L0A files after having generated the L0B netCDF products.
783
+ The default value is ``False``.
784
+ force : bool
785
+ If ``True``, overwrite existing data into destination directories.
786
+ If ``False``, raise an error if there are already data into destination directories.
787
+ The default value is ``False``.
788
+ verbose : bool
789
+ Whether to print detailed processing information into terminal.
790
+ The default value is ``True``.
791
+ parallel : bool
792
+ If ``True``, the files are processed simultaneously in multiple processes.
793
+ By default, the number of process is defined with ``os.cpu_count()``.
794
+ If ``False``, the files are processed sequentially in a single process.
795
+ debugging_mode : bool
796
+ If ``True``, it reduces the amount of data to process.
797
+ For L0B, it processes just the first 100 rows of 3 L0A files.
798
+ The default value is ``False``.
799
+ data_archive_dir : str (optional)
800
+ The directory path where the DISDRODB Data Archive is located.
801
+ The directory path must end with ``<...>/DISDRODB``.
802
+ If ``None``, it uses the ``data_archive_dir`` path specified
803
+ in the DISDRODB active configuration.
804
+ metadata_archive_dir
805
+ The directory path where the DISDRODB Metadata Archive is located.
806
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
807
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
808
+ in the DISDRODB active configuration.
809
+ """
810
+ # Define products
811
+ product = "L0B"
812
+ required_product = get_required_product(product)
813
+
814
+ # Get list of available stations
815
+ list_info = available_stations(
816
+ # DISDRODB root directories
817
+ data_archive_dir=data_archive_dir,
818
+ metadata_archive_dir=metadata_archive_dir,
819
+ # Stations arguments
820
+ data_sources=data_sources,
821
+ campaign_names=campaign_names,
822
+ station_names=station_names,
823
+ # Search options
824
+ product=required_product,
825
+ raise_error_if_empty=True,
826
+ )
827
+
828
+ # Print message
829
+ n_stations = len(list_info)
830
+ print(f"{product} processing of {n_stations} stations started.")
831
+
832
+ # Loop over stations
833
+ for data_source, campaign_name, station_name in list_info:
834
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station started.")
835
+ # Run processing
836
+ run_l0b_station(
837
+ # DISDRODB root directories
838
+ data_archive_dir=data_archive_dir,
839
+ metadata_archive_dir=metadata_archive_dir,
840
+ # Station arguments
841
+ data_source=data_source,
842
+ campaign_name=campaign_name,
843
+ station_name=station_name,
844
+ # L0B options
845
+ remove_l0a=remove_l0a,
846
+ # Process options
847
+ force=force,
848
+ verbose=verbose,
849
+ debugging_mode=debugging_mode,
850
+ parallel=parallel,
851
+ )
852
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station ended.")
853
+
854
+
855
+ def run_l0c(
856
+ data_sources=None,
857
+ campaign_names=None,
858
+ station_names=None,
859
+ # L0C options
860
+ remove_l0b: bool = False,
861
+ # Processing options
862
+ force: bool = False,
863
+ verbose: bool = False,
864
+ debugging_mode: bool = False,
865
+ parallel: bool = True,
866
+ # DISDRODB root directories
867
+ data_archive_dir: Optional[str] = None,
868
+ metadata_archive_dir: Optional[str] = None,
869
+ ):
870
+ """Run the L0C processing of DISDRODB stations.
871
+
872
+ This function allows to launch the processing of many DISDRODB stations with a single command.
873
+ From the list of all available DISDRODB stations, it runs the processing of the
874
+ stations matching the provided data_sources, campaign_names and station_names.
875
+
876
+ Parameters
877
+ ----------
878
+ data_sources : list
879
+ Name of data source(s) to process.
880
+ The name(s) must be UPPER CASE.
881
+ If campaign_names and station are not specified, process all stations.
882
+ The default value is ``None``.
883
+ campaign_names : list
884
+ Name of the campaign(s) to process.
885
+ The name(s) must be UPPER CASE.
886
+ The default value is ``None``.
887
+ station_names : list
888
+ Station names to process.
889
+ The default value is ``None``.
890
+ remove_l0b : bool
891
+ Whether to remove the L0B files after having produced L0C netCDF files.
892
+ The default value is ``False``.
893
+ force : bool
894
+ If ``True``, overwrite existing data into destination directories.
895
+ If ``False``, raise an error if there are already data into destination directories.
896
+ The default value is ``False``.
897
+ verbose : bool
898
+ Whether to print detailed processing information into terminal.
899
+ The default value is ``False``.
900
+ parallel : bool
901
+ If ``True``, the files are processed simultaneously in multiple processes.
902
+ Each process will use a single thread to avoid issues with the HDF/netCDF library.
903
+ By default, the number of process is defined with ``os.cpu_count()``.
904
+ If ``False``, the files are processed sequentially in a single process.
905
+ If ``False``, multi-threading is automatically exploited to speed up I/0 tasks.
906
+ debugging_mode : bool
907
+ If ``True``, it reduces the amount of data to process.
908
+ For L1B, it processes just 3 L0B files.
909
+ The default value is ``False``.
910
+ data_archive_dir : str (optional)
911
+ The directory path where the DISDRODB Data Archive is located.
912
+ The directory path must end with ``<...>/DISDRODB``.
913
+ If ``None``, it uses the ``data_archive_dir`` path specified
914
+ in the DISDRODB active configuration.
915
+ metadata_archive_dir
916
+ The directory path where the DISDRODB Metadata Archive is located.
917
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
918
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
919
+ in the DISDRODB active configuration.
920
+ """
921
+ # Define products
922
+ product = "L0C"
923
+ required_product = get_required_product(product)
924
+
925
+ # Get list of available stations
926
+ list_info = available_stations(
927
+ # DISDRODB root directories
928
+ data_archive_dir=data_archive_dir,
929
+ metadata_archive_dir=metadata_archive_dir,
930
+ # Stations arguments
931
+ data_sources=data_sources,
932
+ campaign_names=campaign_names,
933
+ station_names=station_names,
934
+ # Search options
935
+ product=required_product,
936
+ raise_error_if_empty=True,
937
+ )
938
+
939
+ # Print message
940
+ n_stations = len(list_info)
941
+ print(f"{product} processing of {n_stations} stations started.")
942
+
943
+ # Loop over stations
944
+ for data_source, campaign_name, station_name in list_info:
945
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station started.")
946
+ # Run processing
947
+ run_l0c_station(
948
+ # DISDRODB root directories
949
+ data_archive_dir=data_archive_dir,
950
+ metadata_archive_dir=metadata_archive_dir,
951
+ # Station arguments
952
+ data_source=data_source,
953
+ campaign_name=campaign_name,
954
+ station_name=station_name,
955
+ # L0C options
956
+ remove_l0b=remove_l0b,
957
+ # Process options
958
+ force=force,
959
+ verbose=verbose,
960
+ debugging_mode=debugging_mode,
961
+ parallel=parallel,
962
+ )
963
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station ended.")
964
+
965
+
966
+ def run_l0(
967
+ data_sources=None,
968
+ campaign_names=None,
969
+ station_names=None,
970
+ # L0 archive options
971
+ l0a_processing: bool = True,
972
+ l0b_processing: bool = True,
973
+ l0c_processing: bool = True,
974
+ remove_l0a: bool = False,
975
+ remove_l0b: bool = False,
976
+ # Processing options
977
+ force: bool = False,
978
+ verbose: bool = False,
979
+ debugging_mode: bool = False,
980
+ parallel: bool = True,
981
+ # DISDRODB root directories
982
+ data_archive_dir: Optional[str] = None,
983
+ metadata_archive_dir: Optional[str] = None,
984
+ ):
985
+ """Run the L0 processing of DISDRODB stations.
986
+
987
+ This function allows to launch the processing of many DISDRODB stations with a single command.
988
+ From the list of all available DISDRODB stations, it runs the processing of the
989
+ stations matching the provided data_sources, campaign_names and station_names.
990
+
991
+ Parameters
992
+ ----------
993
+ data_sources : list
994
+ Name of data source(s) to process.
995
+ The name(s) must be UPPER CASE.
996
+ If campaign_names and station are not specified, process all stations.
997
+ The default value is ``None``.
998
+ campaign_names : list
999
+ Name of the campaign(s) to process.
1000
+ The name(s) must be UPPER CASE.
1001
+ The default value is ``None``.
1002
+ station_names : list
1003
+ Station names to process.
1004
+ The default value is ``None``.
1005
+ l0a_processing : bool
1006
+ Whether to launch processing to generate L0A Apache Parquet file(s) from raw data.
1007
+ The default value is ``True``.
1008
+ l0b_processing : bool
1009
+ Whether to launch processing to generate L0B netCDF4 file(s) from L0A data.
1010
+ The default value is ``True``.
1011
+ l0c_processing : bool
1012
+ Whether to launch processing to generate L0C netCDF4 file(s) from L0B data.
1013
+ The default value is ``True``.
1014
+ remove_l0a : bool
1015
+ Whether to keep the L0A files after having generated the L0B netCDF products.
1016
+ The default value is ``False``.
1017
+ remove_l0b : bool
1018
+ Whether to remove the L0B files after having produced all L0C netCDF files.
1019
+ The default value is ``False``.
1020
+ force : bool
1021
+ If ``True``, overwrite existing data into destination directories.
1022
+ If ``False``, raise an error if there are already data into destination directories.
1023
+ The default value is ``False``.
1024
+ verbose : bool
1025
+ Whether to print detailed processing information into terminal.
1026
+ The default value is ``False``.
1027
+ parallel : bool
1028
+ If ``True``, the files are processed simultaneously in multiple processes.
1029
+ Each process will use a single thread to avoid issues with the HDF/netCDF library.
1030
+ By default, the number of process is defined with ``os.cpu_count()``.
1031
+ If ``False``, the files are processed sequentially in a single process.
1032
+ If ``False``, multi-threading is automatically exploited to speed up I/0 tasks.
1033
+ debugging_mode : bool
1034
+ If ``True``, it reduces the amount of data to process.
1035
+ For L0A, it processes just the first 3 raw data files.
1036
+ For L0B, it processes just the first 100 rows of 3 L0A files.
1037
+ The default value is ``False``.
1038
+ data_archive_dir : str (optional)
1039
+ The directory path where the DISDRODB Data Archive is located.
1040
+ The directory path must end with ``<...>/DISDRODB``.
1041
+ If ``None``, it uses the ``data_archive_dir`` path specified
1042
+ in the DISDRODB active configuration.
1043
+ metadata_archive_dir
1044
+ The directory path where the DISDRODB Metadata Archive is located.
1045
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
1046
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
1047
+ in the DISDRODB active configuration.
1048
+ """
1049
+ # Define starting product
1050
+ if l0c_processing:
1051
+ required_product = get_required_product("L0C")
1052
+ if l0b_processing:
1053
+ required_product = get_required_product("L0B")
1054
+ if l0a_processing:
1055
+ required_product = get_required_product("L0A")
1056
+
1057
+ # Get list of available stations
1058
+ list_info = available_stations(
1059
+ # DISDRODB root directories
1060
+ data_archive_dir=data_archive_dir,
1061
+ metadata_archive_dir=metadata_archive_dir,
1062
+ # Stations arguments
1063
+ data_sources=data_sources,
1064
+ campaign_names=campaign_names,
1065
+ station_names=station_names,
1066
+ # Search options
1067
+ product=required_product,
1068
+ raise_error_if_empty=True,
1069
+ )
1070
+
1071
+ # Print message
1072
+ n_stations = len(list_info)
1073
+ print(f"L0 processing of {n_stations} stations started.")
1074
+
1075
+ # Loop over stations
1076
+ for data_source, campaign_name, station_name in list_info:
1077
+ print(f"L0 processing of {data_source} {campaign_name} {station_name} station started.")
1078
+ # Run processing
1079
+ run_l0_station(
1080
+ # DISDRODB root directories
1081
+ data_archive_dir=data_archive_dir,
1082
+ metadata_archive_dir=metadata_archive_dir,
1083
+ # Station arguments
1084
+ data_source=data_source,
1085
+ campaign_name=campaign_name,
1086
+ station_name=station_name,
1087
+ # L0 archive options
1088
+ l0a_processing=l0a_processing,
1089
+ l0b_processing=l0b_processing,
1090
+ l0c_processing=l0c_processing,
1091
+ remove_l0a=remove_l0a,
1092
+ remove_l0b=remove_l0b,
1093
+ # Process options
1094
+ force=force,
1095
+ verbose=verbose,
1096
+ debugging_mode=debugging_mode,
1097
+ parallel=parallel,
1098
+ )
1099
+ print(f"L0 processing of {data_source} {campaign_name} {station_name} station ended.")
1100
+
1101
+
1102
+ def run_l1(
1103
+ data_sources=None,
1104
+ campaign_names=None,
1105
+ station_names=None,
1106
+ # Processing options
1107
+ force: bool = False,
1108
+ verbose: bool = False,
1109
+ debugging_mode: bool = False,
1110
+ parallel: bool = True,
1111
+ # DISDRODB root directories
1112
+ data_archive_dir: Optional[str] = None,
1113
+ metadata_archive_dir: Optional[str] = None,
1114
+ ):
1115
+ """Run the L1 processing of DISDRODB stations.
1116
+
1117
+ This function allows to launch the processing of many DISDRODB stations with a single command.
1118
+ From the list of all available DISDRODB stations, it runs the processing of the
1119
+ stations matching the provided data_sources, campaign_names and station_names.
1120
+
1121
+ Parameters
1122
+ ----------
1123
+ data_sources : list
1124
+ Name of data source(s) to process.
1125
+ The name(s) must be UPPER CASE.
1126
+ If campaign_names and station are not specified, process all stations.
1127
+ The default value is ``None``.
1128
+ campaign_names : list
1129
+ Name of the campaign(s) to process.
1130
+ The name(s) must be UPPER CASE.
1131
+ The default value is ``None``.
1132
+ station_names : list
1133
+ Station names to process.
1134
+ The default value is ``None``.
1135
+ force : bool
1136
+ If ``True``, overwrite existing data into destination directories.
1137
+ If ``False``, raise an error if there are already data into destination directories.
1138
+ The default value is ``False``.
1139
+ verbose : bool
1140
+ Whether to print detailed processing information into terminal.
1141
+ The default value is ``False``.
1142
+ parallel : bool
1143
+ If ``True``, the files are processed simultaneously in multiple processes.
1144
+ Each process will use a single thread to avoid issues with the HDF/netCDF library.
1145
+ By default, the number of process is defined with ``os.cpu_count()``.
1146
+ If ``False``, the files are processed sequentially in a single process.
1147
+ If ``False``, multi-threading is automatically exploited to speed up I/0 tasks.
1148
+ debugging_mode : bool
1149
+ If ``True``, it reduces the amount of data to process.
1150
+ For L1B, it processes just 3 L0B files.
1151
+ The default value is ``False``.
1152
+ data_archive_dir : str (optional)
1153
+ The directory path where the DISDRODB Data Archive is located.
1154
+ The directory path must end with ``<...>/DISDRODB``.
1155
+ If ``None``, it uses the ``data_archive_dir`` path specified
1156
+ in the DISDRODB active configuration.
1157
+ metadata_archive_dir
1158
+ The directory path where the DISDRODB Metadata Archive is located.
1159
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
1160
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
1161
+ in the DISDRODB active configuration.
1162
+ """
1163
+ product = "L1"
1164
+ required_product = get_required_product(product)
1165
+
1166
+ # Get list of available stations
1167
+ list_info = available_stations(
1168
+ # DISDRODB root directories
1169
+ data_archive_dir=data_archive_dir,
1170
+ metadata_archive_dir=metadata_archive_dir,
1171
+ # Stations arguments
1172
+ product=required_product,
1173
+ data_sources=data_sources,
1174
+ campaign_names=campaign_names,
1175
+ station_names=station_names,
1176
+ # Search options
1177
+ available_data=False, # Check for station product directory is present only
1178
+ raise_error_if_empty=True,
1179
+ )
1180
+
1181
+ # Print message
1182
+ n_stations = len(list_info)
1183
+ print(f"{product} processing of {n_stations} stations started.")
1184
+
1185
+ # Loop over stations
1186
+ for data_source, campaign_name, station_name in list_info:
1187
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station started.")
1188
+ # Run processing
1189
+ run_l1_station(
1190
+ # DISDRODB root directories
1191
+ data_archive_dir=data_archive_dir,
1192
+ metadata_archive_dir=metadata_archive_dir,
1193
+ # Station arguments
1194
+ data_source=data_source,
1195
+ campaign_name=campaign_name,
1196
+ station_name=station_name,
1197
+ # Process options
1198
+ force=force,
1199
+ verbose=verbose,
1200
+ debugging_mode=debugging_mode,
1201
+ parallel=parallel,
1202
+ )
1203
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station ended.")
1204
+
1205
+
1206
+ def run_l2e(
1207
+ data_sources=None,
1208
+ campaign_names=None,
1209
+ station_names=None,
1210
+ # Processing options
1211
+ force: bool = False,
1212
+ verbose: bool = False,
1213
+ debugging_mode: bool = False,
1214
+ parallel: bool = True,
1215
+ # DISDRODB root directories
1216
+ data_archive_dir: Optional[str] = None,
1217
+ metadata_archive_dir: Optional[str] = None,
1218
+ ):
1219
+ """Run the L2E processing of DISDRODB stations.
1220
+
1221
+ This function allows to launch the processing of many DISDRODB stations with a single command.
1222
+ From the list of all available DISDRODB stations, it runs the processing of the
1223
+ stations matching the provided data_sources, campaign_names and station_names.
1224
+
1225
+ Parameters
1226
+ ----------
1227
+ data_sources : list
1228
+ Name of data source(s) to process.
1229
+ The name(s) must be UPPER CASE.
1230
+ If campaign_names and station are not specified, process all stations.
1231
+ The default value is ``None``.
1232
+ campaign_names : list
1233
+ Name of the campaign(s) to process.
1234
+ The name(s) must be UPPER CASE.
1235
+ The default value is ``None``.
1236
+ station_names : list
1237
+ Station names to process.
1238
+ The default value is ``None``.
1239
+ force : bool
1240
+ If ``True``, overwrite existing data into destination directories.
1241
+ If ``False``, raise an error if there are already data into destination directories.
1242
+ The default value is ``False``.
1243
+ verbose : bool
1244
+ Whether to print detailed processing information into terminal.
1245
+ The default value is ``False``.
1246
+ parallel : bool
1247
+ If ``True``, the files are processed simultaneously in multiple processes.
1248
+ Each process will use a single thread to avoid issues with the HDF/netCDF library.
1249
+ By default, the number of process is defined with ``os.cpu_count()``.
1250
+ If ``False``, the files are processed sequentially in a single process.
1251
+ If ``False``, multi-threading is automatically exploited to speed up I/0 tasks.
1252
+ debugging_mode : bool
1253
+ If ``True``, it reduces the amount of data to process.
1254
+ For L2E, it processes just 3 L1 files.
1255
+ The default value is ``False``.
1256
+ data_archive_dir : str (optional)
1257
+ The directory path where the DISDRODB Data Archive is located.
1258
+ The directory path must end with ``<...>/DISDRODB``.
1259
+ If ``None``, it uses the ``data_archive_dir`` path specified
1260
+ in the DISDRODB active configuration.
1261
+ metadata_archive_dir
1262
+ The directory path where the DISDRODB Metadata Archive is located.
1263
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
1264
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
1265
+ in the DISDRODB active configuration.
1266
+ """
1267
+ product = "L2E"
1268
+ required_product = get_required_product(product)
1269
+
1270
+ # Get list of available stations
1271
+ list_info = available_stations(
1272
+ # DISDRODB root directories
1273
+ data_archive_dir=data_archive_dir,
1274
+ metadata_archive_dir=metadata_archive_dir,
1275
+ # Stations arguments
1276
+ data_sources=data_sources,
1277
+ campaign_names=campaign_names,
1278
+ station_names=station_names,
1279
+ # Search options
1280
+ product=required_product,
1281
+ raise_error_if_empty=True,
1282
+ )
1283
+
1284
+ # Print message
1285
+ n_stations = len(list_info)
1286
+ print(f"{product} processing of {n_stations} stations started.")
1287
+
1288
+ # Loop over stations
1289
+ for data_source, campaign_name, station_name in list_info:
1290
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station started.")
1291
+ # Run processing
1292
+ run_l2e_station(
1293
+ # DISDRODB root directories
1294
+ data_archive_dir=data_archive_dir,
1295
+ metadata_archive_dir=metadata_archive_dir,
1296
+ # Station arguments
1297
+ data_source=data_source,
1298
+ campaign_name=campaign_name,
1299
+ station_name=station_name,
1300
+ # Process options
1301
+ force=force,
1302
+ verbose=verbose,
1303
+ debugging_mode=debugging_mode,
1304
+ parallel=parallel,
1305
+ )
1306
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station ended.")
1307
+
1308
+
1309
+ def run_l2m(
1310
+ data_sources=None,
1311
+ campaign_names=None,
1312
+ station_names=None,
1313
+ # Processing options
1314
+ force: bool = False,
1315
+ verbose: bool = False,
1316
+ debugging_mode: bool = False,
1317
+ parallel: bool = True,
1318
+ # DISDRODB root directories
1319
+ data_archive_dir: Optional[str] = None,
1320
+ metadata_archive_dir: Optional[str] = None,
1321
+ ):
1322
+ """Run the L2M processing of DISDRODB stations.
1323
+
1324
+ This function allows to launch the processing of many DISDRODB stations with a single command.
1325
+ From the list of all available DISDRODB stations, it runs the processing of the
1326
+ stations matching the provided data_sources, campaign_names and station_names.
1327
+
1328
+ Parameters
1329
+ ----------
1330
+ data_sources : list
1331
+ Name of data source(s) to process.
1332
+ The name(s) must be UPPER CASE.
1333
+ If campaign_names and station are not specified, process all stations.
1334
+ The default value is ``None``.
1335
+ campaign_names : list
1336
+ Name of the campaign(s) to process.
1337
+ The name(s) must be UPPER CASE.
1338
+ The default value is ``None``.
1339
+ station_names : list
1340
+ Station names to process.
1341
+ The default value is ``None``.
1342
+ force : bool
1343
+ If ``True``, overwrite existing data into destination directories.
1344
+ If ``False``, raise an error if there are already data into destination directories.
1345
+ The default value is ``False``.
1346
+ verbose : bool
1347
+ Whether to print detailed processing information into terminal.
1348
+ The default value is ``False``.
1349
+ parallel : bool
1350
+ If ``True``, the files are processed simultaneously in multiple processes.
1351
+ Each process will use a single thread to avoid issues with the HDF/netCDF library.
1352
+ By default, the number of process is defined with ``os.cpu_count()``.
1353
+ If ``False``, the files are processed sequentially in a single process.
1354
+ If ``False``, multi-threading is automatically exploited to speed up I/0 tasks.
1355
+ debugging_mode : bool
1356
+ If ``True``, it reduces the amount of data to process.
1357
+ For L2MB, it processes just 3 L0B files.
1358
+ The default value is ``False``.
1359
+ data_archive_dir : str (optional)
1360
+ The directory path where the DISDRODB Data Archive is located.
1361
+ The directory path must end with ``<...>/DISDRODB``.
1362
+ If ``None``, it uses the ``data_archive_dir`` path specified
1363
+ in the DISDRODB active configuration.
1364
+ metadata_archive_dir
1365
+ The directory path where the DISDRODB Metadata Archive is located.
1366
+ The directory path must end with ``<...>/DISDRODB-METADATA/DISDRODB``.
1367
+ If ``None``, it uses the ``metadata_archive_dir`` path specified
1368
+ in the DISDRODB active configuration.
1369
+ """
1370
+ product = "L2M"
1371
+ required_product = get_required_product(product)
1372
+
1373
+ # Get list of available stations
1374
+ list_info = available_stations(
1375
+ # DISDRODB root directories
1376
+ data_archive_dir=data_archive_dir,
1377
+ metadata_archive_dir=metadata_archive_dir,
1378
+ # Stations arguments
1379
+ data_sources=data_sources,
1380
+ campaign_names=campaign_names,
1381
+ station_names=station_names,
1382
+ # Search options
1383
+ product=required_product,
1384
+ raise_error_if_empty=True,
1385
+ )
1386
+
1387
+ # Print message
1388
+ n_stations = len(list_info)
1389
+ print(f"{product} processing of {n_stations} stations started.")
1390
+
1391
+ # Loop over stations
1392
+ for data_source, campaign_name, station_name in list_info:
1393
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station started.")
1394
+ # Run processing
1395
+ run_l2m_station(
1396
+ # DISDRODB root directories
1397
+ data_archive_dir=data_archive_dir,
1398
+ metadata_archive_dir=metadata_archive_dir,
1399
+ # Station arguments
1400
+ data_source=data_source,
1401
+ campaign_name=campaign_name,
1402
+ station_name=station_name,
1403
+ # Process options
1404
+ force=force,
1405
+ verbose=verbose,
1406
+ debugging_mode=debugging_mode,
1407
+ parallel=parallel,
1408
+ )
1409
+ print(f"{product} processing of {data_source} {campaign_name} {station_name} station ended.")
1410
+
1411
+
1412
+ ####--------------------------------------------------------------------------.