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
@@ -16,14 +16,15 @@
16
16
  # You should have received a copy of the GNU General Public License
17
17
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  # -----------------------------------------------------------------------------.
19
- """Experimental code to help the implementation of DISDRODB L0 readers."""
19
+ """Useful tools helping in the implementation of the DISDRODB L0 readers."""
20
20
 
21
- from typing import Union
21
+ from typing import Optional, Union
22
22
 
23
23
  import numpy as np
24
24
  import pandas as pd
25
25
 
26
26
  from disdrodb.l0.standards import (
27
+ allowed_l0_variables,
27
28
  get_field_nchar_dict,
28
29
  get_field_ndigits_decimals_dict,
29
30
  get_field_ndigits_dict,
@@ -68,24 +69,18 @@ def _check_columns_indices(column_indices, n_columns):
68
69
 
69
70
 
70
71
  def print_df_column_names(df: pd.DataFrame) -> None:
71
- """Print dataframe columns names
72
+ """Print dataframe columns names.
72
73
 
73
74
  Parameters
74
75
  ----------
75
- df : dataframe
76
- The dataframe
77
-
78
- Returns
79
- -------
80
- None
81
- Nothing
76
+ df : pandas.DataFrame
77
+ The dataframe.
82
78
  """
83
79
  for i, column in enumerate(df.columns):
84
80
  print(" - Column", i, ":", column)
85
- return None
86
81
 
87
82
 
88
- def print_valid_l0_column_names(sensor_name: str) -> None:
83
+ def print_allowed_column_names(sensor_name: str) -> None:
89
84
  """Print valid columns names from the standard.
90
85
 
91
86
  Parameters
@@ -93,7 +88,9 @@ def print_valid_l0_column_names(sensor_name: str) -> None:
93
88
  sensor_name : str
94
89
  Name of the sensor.
95
90
  """
96
- print(list(get_l0a_dtype(sensor_name)))
91
+ from pprint import pprint
92
+
93
+ pprint(allowed_l0_variables(sensor_name))
97
94
 
98
95
 
99
96
  def _print_column_index(i, column_name, print_column_names):
@@ -108,14 +105,14 @@ def _print_value(value):
108
105
 
109
106
 
110
107
  def print_df_with_any_nan_rows(df: pd.DataFrame) -> None:
111
- """Print empty rows
108
+ """Print empty rows.
112
109
 
113
110
  Parameters
114
111
  ----------
115
- df : pd.DataFrame
112
+ df : pandas.DataFrame
116
113
  Input dataframe.
117
114
  """
118
- df_bool_is_nan = df.isnull()
115
+ df_bool_is_nan = df.isna()
119
116
  idx_nan_rows = df_bool_is_nan.any(axis=1)
120
117
  df_nan_rows = df.loc[idx_nan_rows]
121
118
  if df_nan_rows.size != 0:
@@ -129,40 +126,35 @@ def print_df_first_n_rows(df: pd.DataFrame, n: int = 5, print_column_names: bool
129
126
 
130
127
  Parameters
131
128
  ----------
132
- df : pd.DataFrame
133
- Input dataframe
129
+ df : pandas.DataFrame
130
+ Input dataframe.
134
131
  n : int, optional
135
- Number of row, by default 5
132
+ Number of row. The default is 5.
136
133
  column_names : bool , optional
137
- If true columns name are printed, by default True
134
+ If true columns name are printed, by default ``True``.
138
135
  """
139
136
  columns = list(df.columns)
140
137
  for i in range(len(df.columns)):
141
138
  _print_column_index(i, column_name=columns[i], print_column_names=print_column_names)
142
- _print_value(df.iloc[0 : (n + 1), i].values)
139
+ _print_value(df.iloc[0 : (n + 1), i].to_numpy())
143
140
 
144
141
 
145
142
  def print_df_random_n_rows(df: pd.DataFrame, n: int = 5, print_column_names: bool = True) -> None:
146
- """Print the content of the dataframe by column, randomly chosen
143
+ """Print the content of the dataframe by column, randomly chosen.
147
144
 
148
145
  Parameters
149
146
  ----------
150
- df : dataframe
151
- The dataframe
147
+ df : pandas.DataFrame
148
+ The dataframe.
152
149
  n : int, optional
153
- The number of row to print, by default 5
150
+ The number of row to print. The default is 5.
154
151
  print_column_names : bool, optional
155
- If true, print the column names. The default is True.
156
-
157
- Returns
158
- -------
159
- None
160
- Nothing
152
+ If true, print the column names. The default value is ``True``.
161
153
  """
162
154
  columns = list(df.columns)
163
155
  df_sample = df.sample(n=n)
164
156
  for i in range(len(df_sample.columns)):
165
- row_content = df_sample.iloc[0 : (n + 1), i].values
157
+ row_content = df_sample.iloc[0 : (n + 1), i].to_numpy()
166
158
  _print_column_index(i, column_name=columns[i], print_column_names=print_column_names)
167
159
  _print_value(row_content)
168
160
 
@@ -182,19 +174,19 @@ def _print_df_summary(df, indices, columns, print_column_names):
182
174
 
183
175
  def print_df_summary_stats(
184
176
  df: pd.DataFrame,
185
- column_indices: Union[int, slice, list] = None,
177
+ column_indices: Optional[Union[int, slice, list]] = None,
186
178
  print_column_names: bool = True,
187
179
  ):
188
180
  """Create a columns statistics summary.
189
181
 
190
182
  Parameters
191
183
  ----------
192
- df : pd.DataFrame
184
+ df : pandas.DataFrame
193
185
  Input dataframe
194
186
  column_indices : Union[int,slice,list], optional
195
- Column indices. If None, select all columns.
187
+ Column indices. If ``None``, select all columns.
196
188
  print_column_names : bool, optional
197
- If true, print the column names. The default is True.
189
+ If ``True``, print the column names. The default value is ``True``.
198
190
 
199
191
  Raises
200
192
  ------
@@ -205,7 +197,7 @@ def print_df_summary_stats(
205
197
  # Define columns of interest
206
198
  _, columns_of_interest = _get_selected_column_names(df, column_indices)
207
199
  # Remove columns of dtype object or string
208
- indices_to_remove = np.where((df.dtypes == type(object)) | (df.dtypes == str))
200
+ indices_to_remove = np.where((df.dtypes == type(object)) | (df.dtypes == str)) # noqa
209
201
  indices = np.arange(0, len(df.columns))
210
202
  indices = indices[np.isin(indices, indices_to_remove, invert=True)]
211
203
  columns = df.columns[indices]
@@ -221,28 +213,39 @@ def print_df_summary_stats(
221
213
  _print_df_summary(df=df, indices=indices, columns=columns, print_column_names=print_column_names)
222
214
 
223
215
 
216
+ def get_unique_sorted_values(array):
217
+ """Return unique sorted values.
218
+
219
+ It deals with np.nan within an array of string by converting object dtype to str.
220
+ """
221
+ arr = np.asanyarray(array)
222
+ if arr.dtype == object:
223
+ arr = arr.astype(str)
224
+ return np.unique(arr).tolist()
225
+
226
+
224
227
  def print_df_columns_unique_values(
225
228
  df: pd.DataFrame,
226
- column_indices: Union[int, slice, list] = None,
229
+ column_indices: Optional[Union[int, slice, list]] = None,
227
230
  print_column_names: bool = True,
228
231
  ) -> None:
229
- """Print columns' unique values
232
+ """Print columns' unique values.
230
233
 
231
234
  Parameters
232
235
  ----------
233
- df : pd.DataFrame
236
+ df : pandas.DataFrame
234
237
  Input dataframe
235
238
  column_indices : Union[int,slice,list], optional
236
- Column indices. If None, select all columns.
239
+ Column indices. If ``None``, select all columns.
237
240
  column_names : bool, optional
238
- If true, print the column names. The default is True.
241
+ If ``True``, print the column names. The default value is ``True``.
239
242
 
240
243
  """
241
244
  column_indices, columns = _get_selected_column_names(df, column_indices)
242
245
  # Printing
243
246
  for i, column in zip(column_indices, columns):
244
247
  _print_column_index(i, column_name=column, print_column_names=print_column_names)
245
- _print_value(sorted(df[column].unique().tolist()))
248
+ _print_value(get_unique_sorted_values(df[column]))
246
249
 
247
250
 
248
251
  ####--------------------------------------------------------------------------.
@@ -251,30 +254,27 @@ def print_df_columns_unique_values(
251
254
 
252
255
  def get_df_columns_unique_values_dict(
253
256
  df: pd.DataFrame,
254
- column_indices: Union[int, slice, list] = None,
257
+ column_indices: Optional[Union[int, slice, list]] = None,
255
258
  column_names: bool = True,
256
259
  ):
257
- """Create a dictionary {column: unique values}
260
+ """Create a dictionary {column: unique values}.
258
261
 
259
262
  Parameters
260
263
  ----------
261
- df : pd.DataFrame
264
+ df : pandas.DataFrame
262
265
  Input dataframe
263
266
  column_indices : Union[int,slice,list], optional
264
- Column indices. If None, select all columns.
267
+ Column indices. If ``None``, select all columns.
265
268
  column_names : bool, optional
266
- If true, the dictionary key are the column names. The default is True.
269
+ If ``True``, the dictionary key are the column names. The default value is ``True``.
267
270
 
268
271
  """
269
272
  column_indices, columns = _get_selected_column_names(df, column_indices)
270
273
  # Create dictionary
271
274
  d = {}
272
275
  for i, column in zip(column_indices, columns):
273
- if column_names:
274
- key = column
275
- else:
276
- key = "Column " + str(i)
277
- d[key] = sorted(df[column].unique().tolist())
276
+ key = column if column_names else "Column " + str(i)
277
+ d[key] = get_unique_sorted_values(df[column])
278
278
  # Return
279
279
  return d
280
280
 
@@ -288,15 +288,15 @@ def str_is_number(string: str) -> bool:
288
288
 
289
289
  Parameters
290
290
  ----------
291
- string : Input string
291
+ string : str
292
+ Input string.
292
293
 
293
294
 
294
295
  Returns
295
296
  -------
296
297
  bool
297
- True if float.
298
+ ``True`` if float.
298
299
  """
299
-
300
300
  try:
301
301
  float(string)
302
302
  return True
@@ -305,17 +305,18 @@ def str_is_number(string: str) -> bool:
305
305
 
306
306
 
307
307
  def str_is_integer(string: str) -> bool:
308
- """Check if a string represent an integer
308
+ """Check if a string represent an integer.
309
309
 
310
310
  Parameters
311
311
  ----------
312
- string : Input string
312
+ string : str
313
+ Input string.
313
314
 
314
315
 
315
316
  Returns
316
317
  -------
317
318
  bool
318
- True if integer.
319
+ ``True`` if integer.
319
320
  """
320
321
  try:
321
322
  int(string)
@@ -325,12 +326,12 @@ def str_is_integer(string: str) -> bool:
325
326
 
326
327
 
327
328
  def str_has_decimal_digits(string: str) -> bool:
328
- """Check if a string has decimals
329
+ """Check if a string has decimals.
329
330
 
330
331
  Parameters
331
332
  ----------
332
- string :
333
- Input string
333
+ string : str
334
+ Input string.
334
335
 
335
336
 
336
337
  Returns
@@ -338,54 +339,51 @@ def str_has_decimal_digits(string: str) -> bool:
338
339
  bool
339
340
  True if string has digits.
340
341
  """
341
- if len(string.split(".")) == 2:
342
- return True
343
- else:
344
- return False
342
+ return len(string.split(".")) == 2
345
343
 
346
344
 
347
345
  def get_decimal_ndigits(string: str) -> int:
348
- """Get the decimal number of digit.
346
+ """Get the number of decimal digits.
349
347
 
350
348
  Parameters
351
349
  ----------
352
350
  string : str
353
- Input string
351
+ Input string.
354
352
 
355
353
  Returns
356
354
  -------
357
355
  int
358
- The number of digit.
356
+ The number of decimal digits.
359
357
  """
360
358
  if str_has_decimal_digits(string):
361
359
  return len(string.split(".")[1])
362
- else:
363
- return 0
360
+ return 0
364
361
 
365
362
 
366
363
  def get_natural_ndigits(string: str) -> int:
367
- """Get the natural number of digit.
364
+ """Get the number of natural digits.
368
365
 
369
366
  Parameters
370
367
  ----------
371
368
  string : str
372
- Input string
369
+ Input string.
373
370
 
374
371
  Returns
375
372
  -------
376
373
  int
377
- The number of digit.
374
+ The number of natural digits.
378
375
  """
376
+ count_minus = int(string.startswith("-")) # 0 if not start with -, else 1
377
+ string = string.replace("-", "")
379
378
  if str_is_integer(string):
380
- return len(string.replace("-", ""))
379
+ return len(string) + count_minus
381
380
  if str_has_decimal_digits(string):
382
- return len(string.split(".")[0].replace("-", ""))
383
- else:
384
- return 0
381
+ return len(string.split(".")[0]) + count_minus
382
+ return 0
385
383
 
386
384
 
387
385
  def get_ndigits(string: str) -> int:
388
- """Get the number of digit.
386
+ """Get the number of total numeric digits.
389
387
 
390
388
  Parameters
391
389
  ----------
@@ -395,47 +393,46 @@ def get_ndigits(string: str) -> int:
395
393
  Returns
396
394
  -------
397
395
  int
398
- Number of digit
396
+ The number of total digits.
399
397
  """
400
-
401
398
  if not str_is_number(string):
402
399
  return 0
400
+ count_minus = int(string.startswith("-")) # 0 if not start with -, else 1
403
401
  string = string.replace("-", "")
404
402
  if str_has_decimal_digits(string):
405
- return len(string) - 1 # remove .
406
- else:
407
- return len(string)
403
+ return len(string) - 1 + count_minus # remove .
404
+ return len(string) + count_minus
408
405
 
409
406
 
410
407
  def get_nchar(string: str) -> int:
411
- """Get the number of character.
408
+ """Get the number of characters.
412
409
 
413
410
  Parameters
414
411
  ----------
415
412
  string : str
416
- Input string
413
+ Input string.
417
414
 
418
415
  Returns
419
416
  -------
420
417
  int
421
- Number of character
418
+ The number of characters.
422
419
  """
423
420
  return len(string)
424
421
 
425
422
 
426
423
  def _has_constant_characters(arr: np.array) -> bool:
427
- """Check if the content of an array has a constant number of characters
424
+ """Check if the content of an array has a constant number of characters.
428
425
 
429
426
  Parameters
430
427
  ----------
431
428
  arr : numpy.ndarray
432
429
  The array to analyse.
433
- It convert numeric array to unicode before analyzing !
430
+ It converts numeric array to unicode before analyzing !
434
431
 
435
432
  Returns
436
433
  -------
437
434
  boolean
438
- True if the number of character is constant.
435
+ ``True`` if the number of characters is constant.
439
436
  Empty array are considered constant !
440
437
 
441
438
  """
@@ -447,21 +444,20 @@ def _has_constant_characters(arr: np.array) -> bool:
447
444
 
448
445
 
449
446
  def _get_possible_keys(dict_options: dict, desired_value: str) -> set:
450
- """Get the possible keys from the input values
447
+ """Get the possible keys from the input values.
451
448
 
452
449
  Parameters
453
450
  ----------
454
451
  dict_options : dict
455
- Input dictionary
452
+ Input dictionary.
456
453
  desired_value : str
457
- Input value
454
+ Input value.
458
455
 
459
456
  Returns
460
457
  -------
461
458
  set
462
459
  Keys that the value matches the desired input value.
463
460
  """
464
-
465
461
  list_key_match = []
466
462
  for k, v in dict_options.items():
467
463
  if v == desired_value:
@@ -471,19 +467,19 @@ def _get_possible_keys(dict_options: dict, desired_value: str) -> set:
471
467
 
472
468
 
473
469
  def _search_possible_columns(string: str, sensor_name: str) -> list:
474
- """Define possible column
470
+ """Define possible columns.
475
471
 
476
472
  Parameters
477
473
  ----------
478
474
  string : str
479
- Inpur string
475
+ Input string.
480
476
  sensor_name : str
481
- Name of the sensor
477
+ Name of the sensor.
482
478
 
483
479
  Returns
484
480
  -------
485
481
  list
486
- list of possible columns
482
+ List of possible columns.
487
483
  """
488
484
  dict_digits = get_field_ndigits_dict(sensor_name)
489
485
  dict_nchar_digits = get_field_nchar_dict(sensor_name)
@@ -504,17 +500,18 @@ def _search_possible_columns(string: str, sensor_name: str) -> list:
504
500
  #### Infer column names and checks validity
505
501
 
506
502
 
507
- def infer_column_names(df: pd.DataFrame, sensor_name: str, row_idx: int = 1):
503
+ def infer_column_names(df: pd.DataFrame, sensor_name: str, row_idx: int = 0):
508
504
  """Try to guess the dataframe columns names based on string characteristics.
509
505
 
510
506
  Parameters
511
507
  ----------
512
- df : numpy.ndarray
513
- The array to analyse
508
+ df : pandas.DataFrame
509
+ The dataframe to analyse.
514
510
  sensor_name : str
515
- name of the sensor
511
+ name of the sensor.
516
512
  row_idx : int, optional
517
- The row ID of the array, by default 1
513
+ The row index of the dataframe to use to infer the column names.
514
+ The default row index is 0.
518
515
 
519
516
  Returns
520
517
  -------
@@ -526,12 +523,11 @@ def infer_column_names(df: pd.DataFrame, sensor_name: str, row_idx: int = 1):
526
523
  # Get string array
527
524
  arr = df.iloc[:, i]
528
525
  arr = np.asarray(arr).astype(str)
529
-
530
526
  # Check is the array contains a constant number of character
531
527
  if not _has_constant_characters(arr):
532
528
  print(
533
- f"ATTENTION: Column {i} values have non-unique number of characters. "
534
- f"Selecting row {row_idx} to infer possible columns."
529
+ f"WARNING: The number of characters of column {i} values is not constant. "
530
+ f"Column names are currently inferred using 'row_idx={row_idx}'.",
535
531
  )
536
532
 
537
533
  # Subset a single string
@@ -559,13 +555,12 @@ def check_column_names(column_names: list, sensor_name: str) -> None:
559
555
  TypeError
560
556
  Error if some columns do not meet the DISDRODB standards.
561
557
  """
562
-
563
558
  if not isinstance(column_names, list):
564
559
  raise TypeError("'column_names' must be a list of strings.")
565
560
  # Get valid columns
566
561
  dtype_dict = get_l0a_dtype(sensor_name)
567
562
  valid_columns = list(dtype_dict)
568
- valid_columns = valid_columns + ["time"]
563
+ valid_columns = [*valid_columns, "time"]
569
564
  # --------------------------------------------
570
565
  # Create name sets
571
566
  column_names = set(column_names)
@@ -575,9 +570,9 @@ def check_column_names(column_names: list, sensor_name: str) -> None:
575
570
  invalid_columns = list(column_names.difference(valid_columns))
576
571
  if len(invalid_columns) > 0:
577
572
  print(f"The following columns do no met the DISDRODB standards: {invalid_columns}.")
578
- print("Please remove such columns within the df_sanitizer_fun")
573
+ print("Please remove such columns in the reader function !")
579
574
  # --------------------------------------------
580
575
  # Check time column is present
581
576
  if "time" not in column_names:
582
- print("Please be sure to create the 'time' column within the df_sanitizer_fun.")
577
+ print("Please be sure to create the 'time' column within the reader function !")
583
578
  print("The 'time' column must be datetime with resolution in seconds (dtype='M8[s]').")
@@ -0,0 +1,17 @@
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 L1 module."""