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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. disdrodb/__init__.py +132 -15
  2. disdrodb/_config.py +4 -2
  3. disdrodb/_version.py +9 -4
  4. disdrodb/api/checks.py +264 -237
  5. disdrodb/api/configs.py +4 -8
  6. disdrodb/api/create_directories.py +235 -290
  7. disdrodb/api/info.py +217 -26
  8. disdrodb/api/io.py +295 -269
  9. disdrodb/api/path.py +597 -173
  10. disdrodb/api/search.py +486 -0
  11. disdrodb/{metadata/scripts → cli}/disdrodb_check_metadata_archive.py +12 -7
  12. disdrodb/{utils/pandas.py → cli/disdrodb_data_archive_directory.py} +9 -18
  13. disdrodb/cli/disdrodb_download_archive.py +86 -0
  14. disdrodb/cli/disdrodb_download_metadata_archive.py +53 -0
  15. disdrodb/cli/disdrodb_download_station.py +84 -0
  16. disdrodb/{api/scripts → cli}/disdrodb_initialize_station.py +22 -10
  17. disdrodb/cli/disdrodb_metadata_archive_directory.py +32 -0
  18. disdrodb/{data_transfer/scripts/disdrodb_download_station.py → cli/disdrodb_open_data_archive.py} +22 -22
  19. disdrodb/cli/disdrodb_open_logs_directory.py +69 -0
  20. disdrodb/{data_transfer/scripts/disdrodb_upload_station.py → cli/disdrodb_open_metadata_archive.py} +22 -24
  21. disdrodb/cli/disdrodb_open_metadata_directory.py +71 -0
  22. disdrodb/cli/disdrodb_open_product_directory.py +74 -0
  23. disdrodb/cli/disdrodb_open_readers_directory.py +32 -0
  24. disdrodb/{l0/scripts → cli}/disdrodb_run_l0.py +38 -31
  25. disdrodb/{l0/scripts → cli}/disdrodb_run_l0_station.py +32 -30
  26. disdrodb/{l0/scripts → cli}/disdrodb_run_l0a.py +30 -21
  27. disdrodb/{l0/scripts → cli}/disdrodb_run_l0a_station.py +24 -33
  28. disdrodb/{l0/scripts → cli}/disdrodb_run_l0b.py +30 -21
  29. disdrodb/{l0/scripts → cli}/disdrodb_run_l0b_station.py +25 -34
  30. disdrodb/cli/disdrodb_run_l0c.py +130 -0
  31. disdrodb/cli/disdrodb_run_l0c_station.py +129 -0
  32. disdrodb/cli/disdrodb_run_l1.py +122 -0
  33. disdrodb/cli/disdrodb_run_l1_station.py +121 -0
  34. disdrodb/cli/disdrodb_run_l2e.py +122 -0
  35. disdrodb/cli/disdrodb_run_l2e_station.py +122 -0
  36. disdrodb/cli/disdrodb_run_l2m.py +122 -0
  37. disdrodb/cli/disdrodb_run_l2m_station.py +122 -0
  38. disdrodb/cli/disdrodb_upload_archive.py +105 -0
  39. disdrodb/cli/disdrodb_upload_station.py +98 -0
  40. disdrodb/configs.py +90 -25
  41. disdrodb/data_transfer/__init__.py +22 -0
  42. disdrodb/data_transfer/download_data.py +87 -90
  43. disdrodb/data_transfer/upload_data.py +64 -37
  44. disdrodb/data_transfer/zenodo.py +15 -18
  45. disdrodb/docs.py +1 -1
  46. disdrodb/issue/__init__.py +17 -4
  47. disdrodb/issue/checks.py +10 -23
  48. disdrodb/issue/reader.py +9 -12
  49. disdrodb/issue/writer.py +14 -17
  50. disdrodb/l0/__init__.py +17 -26
  51. disdrodb/l0/check_configs.py +35 -23
  52. disdrodb/l0/check_standards.py +32 -42
  53. disdrodb/l0/configs/{Thies_LPM → LPM}/bins_diameter.yml +44 -44
  54. disdrodb/l0/configs/{Thies_LPM → LPM}/bins_velocity.yml +40 -40
  55. disdrodb/l0/configs/LPM/l0a_encodings.yml +80 -0
  56. disdrodb/l0/configs/{Thies_LPM → LPM}/l0b_cf_attrs.yml +62 -59
  57. disdrodb/l0/configs/{Thies_LPM → LPM}/l0b_encodings.yml +9 -9
  58. disdrodb/l0/configs/{Thies_LPM → LPM}/raw_data_format.yml +245 -245
  59. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/bins_diameter.yml +66 -66
  60. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/bins_velocity.yml +64 -64
  61. disdrodb/l0/configs/PARSIVEL/l0a_encodings.yml +32 -0
  62. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/l0b_cf_attrs.yml +22 -20
  63. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/l0b_encodings.yml +17 -17
  64. disdrodb/l0/configs/{OTT_Parsivel → PARSIVEL}/raw_data_format.yml +77 -77
  65. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/bins_diameter.yml +64 -64
  66. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/bins_velocity.yml +64 -64
  67. disdrodb/l0/configs/PARSIVEL2/l0a_encodings.yml +39 -0
  68. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/l0b_cf_attrs.yml +24 -22
  69. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/l0b_encodings.yml +20 -20
  70. disdrodb/l0/configs/{OTT_Parsivel2 → PARSIVEL2}/raw_data_format.yml +98 -98
  71. disdrodb/l0/configs/{RD_80 → RD80}/bins_diameter.yml +40 -40
  72. disdrodb/l0/configs/RD80/l0a_encodings.yml +16 -0
  73. disdrodb/l0/configs/{RD_80 → RD80}/l0b_cf_attrs.yml +3 -3
  74. disdrodb/l0/configs/RD80/l0b_encodings.yml +135 -0
  75. disdrodb/l0/configs/{RD_80 → RD80}/raw_data_format.yml +48 -48
  76. disdrodb/l0/l0_reader.py +216 -340
  77. disdrodb/l0/l0a_processing.py +237 -208
  78. disdrodb/l0/l0b_nc_processing.py +227 -80
  79. disdrodb/l0/l0b_processing.py +93 -173
  80. disdrodb/l0/l0c_processing.py +627 -0
  81. disdrodb/l0/readers/{ARM → LPM/ARM}/ARM_LPM.py +36 -58
  82. disdrodb/l0/readers/LPM/AUSTRALIA/MELBOURNE_2007_LPM.py +226 -0
  83. disdrodb/l0/readers/LPM/BRAZIL/CHUVA_LPM.py +185 -0
  84. disdrodb/l0/readers/LPM/BRAZIL/GOAMAZON_LPM.py +183 -0
  85. disdrodb/l0/readers/LPM/ITALY/GID_LPM.py +179 -0
  86. disdrodb/l0/readers/{UK → LPM/UK}/DIVEN.py +14 -35
  87. disdrodb/l0/readers/PARSIVEL/AUSTRALIA/MELBOURNE_2007_PARSIVEL.py +157 -0
  88. disdrodb/l0/readers/PARSIVEL/CHINA/CHONGQING.py +113 -0
  89. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/ARCTIC_2021.py +40 -57
  90. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/COMMON_2011.py +37 -54
  91. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/DAVOS_2009_2011.py +34 -51
  92. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_2009.py +34 -51
  93. disdrodb/l0/readers/{EPFL/PARADISO_2014.py → PARSIVEL/EPFL/EPFL_ROOF_2008.py} +38 -50
  94. disdrodb/l0/readers/PARSIVEL/EPFL/EPFL_ROOF_2010.py +105 -0
  95. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_ROOF_2011.py +34 -51
  96. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/EPFL_ROOF_2012.py +33 -51
  97. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GENEPI_2007.py +25 -44
  98. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GRAND_ST_BERNARD_2007.py +25 -44
  99. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/GRAND_ST_BERNARD_2007_2.py +25 -44
  100. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/HPICONET_2010.py +34 -51
  101. disdrodb/l0/readers/{EPFL/EPFL_ROOF_2010.py → PARSIVEL/EPFL/HYMEX_LTE_SOP2.py} +37 -50
  102. disdrodb/l0/readers/PARSIVEL/EPFL/HYMEX_LTE_SOP3.py +111 -0
  103. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/HYMEX_LTE_SOP4.py +36 -54
  104. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/LOCARNO_2018.py +34 -52
  105. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/LOCARNO_2019.py +38 -56
  106. disdrodb/l0/readers/PARSIVEL/EPFL/PARADISO_2014.py +105 -0
  107. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/PARSIVEL_2007.py +27 -45
  108. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/PLATO_2019.py +24 -44
  109. disdrodb/l0/readers/PARSIVEL/EPFL/RACLETS_2019.py +140 -0
  110. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/RACLETS_2019_WJF.py +41 -59
  111. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/RIETHOLZBACH_2011.py +34 -51
  112. disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2017.py +117 -0
  113. disdrodb/l0/readers/PARSIVEL/EPFL/SAMOYLOV_2019.py +137 -0
  114. disdrodb/l0/readers/{EPFL → PARSIVEL/EPFL}/UNIL_2022.py +42 -55
  115. disdrodb/l0/readers/PARSIVEL/GPM/IFLOODS.py +104 -0
  116. disdrodb/l0/readers/{GPM → PARSIVEL/GPM}/LPVEX.py +29 -48
  117. disdrodb/l0/readers/PARSIVEL/GPM/MC3E.py +184 -0
  118. disdrodb/l0/readers/PARSIVEL/NCAR/CCOPE_2015.py +113 -0
  119. disdrodb/l0/readers/{NCAR/VORTEX_SE_2016_P1.py → PARSIVEL/NCAR/OWLES_MIPS.py} +46 -72
  120. disdrodb/l0/readers/PARSIVEL/NCAR/PECAN_MOBILE.py +125 -0
  121. disdrodb/l0/readers/{NCAR/OWLES_MIPS.py → PARSIVEL/NCAR/PLOWS_MIPS.py} +45 -64
  122. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2009.py +114 -0
  123. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2010.py +176 -0
  124. disdrodb/l0/readers/PARSIVEL/NCAR/VORTEX2_2010_UF.py +183 -0
  125. disdrodb/l0/readers/{ARM/ARM_LD.py → PARSIVEL2/ARM/ARM_PARSIVEL2.py} +27 -50
  126. disdrodb/l0/readers/PARSIVEL2/BRAZIL/CHUVA_PARSIVEL2.py +163 -0
  127. disdrodb/l0/readers/PARSIVEL2/BRAZIL/GOAMAZON_PARSIVEL2.py +163 -0
  128. disdrodb/l0/readers/{DENMARK → PARSIVEL2/DENMARK}/EROSION_nc.py +14 -35
  129. disdrodb/l0/readers/PARSIVEL2/FRANCE/SIRTA_PARSIVEL2.py +119 -0
  130. disdrodb/l0/readers/PARSIVEL2/GPM/GCPEX.py +104 -0
  131. disdrodb/l0/readers/PARSIVEL2/GPM/NSSTC.py +176 -0
  132. disdrodb/l0/readers/PARSIVEL2/ITALY/GID_PARSIVEL2.py +32 -0
  133. disdrodb/l0/readers/PARSIVEL2/MEXICO/OH_IIUNAM_nc.py +56 -0
  134. disdrodb/l0/readers/PARSIVEL2/NCAR/PECAN_FP3.py +120 -0
  135. disdrodb/l0/readers/{NCAR → PARSIVEL2/NCAR}/PECAN_MIPS.py +45 -64
  136. disdrodb/l0/readers/PARSIVEL2/NCAR/RELAMPAGO_PARSIVEL2.py +181 -0
  137. disdrodb/l0/readers/PARSIVEL2/NCAR/SNOWIE_PJ.py +160 -0
  138. disdrodb/l0/readers/PARSIVEL2/NCAR/SNOWIE_SB.py +160 -0
  139. disdrodb/l0/readers/{NCAR/PLOWS_MIPS.py → PARSIVEL2/NCAR/VORTEX_SE_2016_P1.py} +49 -66
  140. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_P2.py +118 -0
  141. disdrodb/l0/readers/PARSIVEL2/NCAR/VORTEX_SE_2016_PIPS.py +152 -0
  142. disdrodb/l0/readers/PARSIVEL2/NETHERLANDS/DELFT.py +166 -0
  143. disdrodb/l0/readers/{NCAR/RELAMPAGO_RD80.py → RD80/BRAZIL/CHUVA_RD80.py} +36 -60
  144. disdrodb/l0/readers/{BRAZIL → RD80/BRAZIL}/GOAMAZON_RD80.py +36 -55
  145. disdrodb/l0/readers/{NCAR → RD80/NCAR}/CINDY_2011_RD80.py +35 -54
  146. disdrodb/l0/readers/{BRAZIL/CHUVA_RD80.py → RD80/NCAR/RELAMPAGO_RD80.py} +40 -54
  147. disdrodb/l0/readers/template_reader_raw_netcdf_data.py +62 -0
  148. disdrodb/l0/readers/{reader_template.py → template_reader_raw_text_data.py} +20 -44
  149. disdrodb/l0/routines.py +885 -581
  150. disdrodb/l0/standards.py +72 -236
  151. disdrodb/l0/template_tools.py +104 -109
  152. disdrodb/l1/__init__.py +17 -0
  153. disdrodb/l1/beard_model.py +716 -0
  154. disdrodb/l1/encoding_attrs.py +620 -0
  155. disdrodb/l1/fall_velocity.py +260 -0
  156. disdrodb/l1/filters.py +192 -0
  157. disdrodb/l1/processing.py +200 -0
  158. disdrodb/l1/resampling.py +236 -0
  159. disdrodb/l1/routines.py +357 -0
  160. disdrodb/l1_env/__init__.py +17 -0
  161. disdrodb/l1_env/routines.py +38 -0
  162. disdrodb/l2/__init__.py +17 -0
  163. disdrodb/l2/empirical_dsd.py +1735 -0
  164. disdrodb/l2/event.py +388 -0
  165. disdrodb/l2/processing.py +519 -0
  166. disdrodb/l2/processing_options.py +213 -0
  167. disdrodb/l2/routines.py +868 -0
  168. disdrodb/metadata/__init__.py +9 -2
  169. disdrodb/metadata/checks.py +165 -118
  170. disdrodb/metadata/download.py +81 -0
  171. disdrodb/metadata/geolocation.py +146 -0
  172. disdrodb/metadata/info.py +20 -13
  173. disdrodb/metadata/manipulation.py +1 -1
  174. disdrodb/metadata/reader.py +59 -8
  175. disdrodb/metadata/search.py +77 -144
  176. disdrodb/metadata/standards.py +7 -8
  177. disdrodb/metadata/writer.py +8 -14
  178. disdrodb/psd/__init__.py +38 -0
  179. disdrodb/psd/fitting.py +2146 -0
  180. disdrodb/psd/models.py +774 -0
  181. disdrodb/routines.py +1176 -0
  182. disdrodb/scattering/__init__.py +28 -0
  183. disdrodb/scattering/axis_ratio.py +344 -0
  184. disdrodb/scattering/routines.py +456 -0
  185. disdrodb/utils/__init__.py +17 -0
  186. disdrodb/utils/attrs.py +208 -0
  187. disdrodb/utils/cli.py +269 -0
  188. disdrodb/utils/compression.py +60 -42
  189. disdrodb/utils/dask.py +62 -0
  190. disdrodb/utils/decorators.py +110 -0
  191. disdrodb/utils/directories.py +107 -46
  192. disdrodb/utils/encoding.py +127 -0
  193. disdrodb/utils/list.py +29 -0
  194. disdrodb/utils/logger.py +168 -46
  195. disdrodb/utils/time.py +657 -0
  196. disdrodb/utils/warnings.py +30 -0
  197. disdrodb/utils/writer.py +57 -0
  198. disdrodb/utils/xarray.py +138 -47
  199. disdrodb/utils/yaml.py +0 -1
  200. disdrodb/viz/__init__.py +17 -0
  201. disdrodb/viz/plots.py +17 -0
  202. disdrodb-0.1.0.dist-info/METADATA +321 -0
  203. disdrodb-0.1.0.dist-info/RECORD +216 -0
  204. {disdrodb-0.0.20.dist-info → disdrodb-0.1.0.dist-info}/WHEEL +1 -1
  205. disdrodb-0.1.0.dist-info/entry_points.txt +30 -0
  206. disdrodb/data_transfer/scripts/disdrodb_download_archive.py +0 -53
  207. disdrodb/data_transfer/scripts/disdrodb_upload_archive.py +0 -57
  208. disdrodb/l0/configs/OTT_Parsivel/l0a_encodings.yml +0 -32
  209. disdrodb/l0/configs/OTT_Parsivel2/l0a_encodings.yml +0 -39
  210. disdrodb/l0/configs/RD_80/l0a_encodings.yml +0 -16
  211. disdrodb/l0/configs/RD_80/l0b_encodings.yml +0 -135
  212. disdrodb/l0/configs/Thies_LPM/l0a_encodings.yml +0 -80
  213. disdrodb/l0/io.py +0 -257
  214. disdrodb/l0/l0_processing.py +0 -1091
  215. disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_OTT.py +0 -178
  216. disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_THIES.py +0 -247
  217. disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py +0 -204
  218. disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py +0 -183
  219. disdrodb/l0/readers/BRAZIL/GOAMAZON_LPM.py +0 -204
  220. disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py +0 -183
  221. disdrodb/l0/readers/CHINA/CHONGQING.py +0 -131
  222. disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py +0 -128
  223. disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py +0 -127
  224. disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py +0 -129
  225. disdrodb/l0/readers/EPFL/RACLETS_2019.py +0 -158
  226. disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py +0 -136
  227. disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py +0 -158
  228. disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py +0 -138
  229. disdrodb/l0/readers/GPM/GCPEX.py +0 -123
  230. disdrodb/l0/readers/GPM/IFLOODS.py +0 -123
  231. disdrodb/l0/readers/GPM/MC3E.py +0 -123
  232. disdrodb/l0/readers/GPM/NSSTC.py +0 -164
  233. disdrodb/l0/readers/ITALY/GID.py +0 -199
  234. disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py +0 -92
  235. disdrodb/l0/readers/NCAR/CCOPE_2015.py +0 -133
  236. disdrodb/l0/readers/NCAR/PECAN_FP3.py +0 -137
  237. disdrodb/l0/readers/NCAR/PECAN_MOBILE.py +0 -144
  238. disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py +0 -195
  239. disdrodb/l0/readers/NCAR/SNOWIE_PJ.py +0 -172
  240. disdrodb/l0/readers/NCAR/SNOWIE_SB.py +0 -179
  241. disdrodb/l0/readers/NCAR/VORTEX2_2009.py +0 -133
  242. disdrodb/l0/readers/NCAR/VORTEX2_2010.py +0 -188
  243. disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py +0 -191
  244. disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py +0 -135
  245. disdrodb/l0/readers/NCAR/VORTEX_SE_2016_PIPS.py +0 -170
  246. disdrodb/l0/readers/NETHERLANDS/DELFT.py +0 -187
  247. disdrodb/l0/readers/SPAIN/SBEGUERIA.py +0 -179
  248. disdrodb/l0/scripts/disdrodb_run_l0b_concat.py +0 -93
  249. disdrodb/l0/scripts/disdrodb_run_l0b_concat_station.py +0 -85
  250. disdrodb/utils/netcdf.py +0 -452
  251. disdrodb/utils/scripts.py +0 -102
  252. disdrodb-0.0.20.dist-info/AUTHORS.md +0 -18
  253. disdrodb-0.0.20.dist-info/METADATA +0 -186
  254. disdrodb-0.0.20.dist-info/RECORD +0 -168
  255. disdrodb-0.0.20.dist-info/entry_points.txt +0 -15
  256. /disdrodb/l0/configs/{RD_80 → RD80}/bins_velocity.yml +0 -0
  257. /disdrodb/l0/manuals/{Thies_LPM.pdf → LPM.pdf} +0 -0
  258. /disdrodb/l0/manuals/{ODM_470.pdf → ODM470.pdf} +0 -0
  259. /disdrodb/l0/manuals/{OTT_Parsivel.pdf → PARSIVEL.pdf} +0 -0
  260. /disdrodb/l0/manuals/{OTT_Parsivel2.pdf → PARSIVEL2.pdf} +0 -0
  261. /disdrodb/l0/manuals/{PWS_100.pdf → PWS100.pdf} +0 -0
  262. /disdrodb/l0/manuals/{RD_80.pdf → RD80.pdf} +0 -0
  263. {disdrodb-0.0.20.dist-info → disdrodb-0.1.0.dist-info/licenses}/LICENSE +0 -0
  264. {disdrodb-0.0.20.dist-info → disdrodb-0.1.0.dist-info}/top_level.txt +0 -0
disdrodb/l0/standards.py CHANGED
@@ -18,8 +18,6 @@
18
18
  # -----------------------------------------------------------------------------.
19
19
  """Retrieve L0 sensor standards."""
20
20
 
21
- import datetime
22
- import importlib
23
21
  import logging
24
22
 
25
23
  import numpy as np
@@ -29,10 +27,33 @@ from disdrodb.api.configs import read_config_file
29
27
 
30
28
  logger = logging.getLogger(__name__)
31
29
 
32
- PRODUCT_VERSION = "V0"
33
- SOFTWARE_VERSION = "V" + importlib.metadata.version("disdrodb")
34
- CONVENTIONS = "CF-1.10, ACDD-1.3"
35
- EPOCH = "seconds since 1970-01-01 00:00:00"
30
+
31
+ ####-------------------------------------------------------------------------.
32
+ #### Sensor variables
33
+
34
+
35
+ def get_sensor_logged_variables(sensor_name: str) -> list:
36
+ """Get the sensor logged variables list.
37
+
38
+ Parameters
39
+ ----------
40
+ sensor_name : str
41
+ Name of the sensor.
42
+
43
+ Returns
44
+ -------
45
+ list
46
+ List of the variables logged by the sensor.
47
+ """
48
+ return list(get_data_format_dict(sensor_name).keys())
49
+
50
+
51
+ def allowed_l0_variables(sensor_name: str) -> list:
52
+ """Get the list of allowed L0 variables for a given sensor."""
53
+ sensor_variables = list(get_l0a_dtype(sensor_name))
54
+ allowed_variables = [*sensor_variables, "time", "latitude", "longitude", "altitude"]
55
+ # TODO: add air_temperature, relative_humidity, wind_speed, wind_direction
56
+ return allowed_variables
36
57
 
37
58
 
38
59
  ####--------------------------------------------------------------------------.
@@ -59,27 +80,9 @@ def get_data_format_dict(sensor_name: str) -> dict:
59
80
  dict
60
81
  Data format of each sensor variable.
61
82
  """
62
-
63
83
  return read_config_file(sensor_name=sensor_name, product="L0A", filename="raw_data_format.yml")
64
84
 
65
85
 
66
- def get_sensor_logged_variables(sensor_name: str) -> list:
67
- """Get the sensor logged variables list.
68
-
69
- Parameters
70
- ----------
71
- sensor_name : str
72
- Name of the sensor.
73
-
74
- Returns
75
- -------
76
- list
77
- List of the variables logged by the sensor.
78
- """
79
-
80
- return list(get_data_format_dict(sensor_name).keys())
81
-
82
-
83
86
  def get_data_range_dict(sensor_name: str) -> dict:
84
87
  """Get the variable data range.
85
88
 
@@ -94,10 +97,9 @@ def get_data_range_dict(sensor_name: str) -> dict:
94
97
  Dictionary with the expected data value range for each data field.
95
98
  It excludes variables without specified data_range key.
96
99
  """
97
-
98
100
  data_format_dict = get_data_format_dict(sensor_name)
99
101
  dict_data_range = {}
100
- for k in data_format_dict.keys():
102
+ for k in data_format_dict:
101
103
  data_range = data_format_dict[k].get("data_range", None)
102
104
  if data_range is not None:
103
105
  dict_data_range[k] = data_range
@@ -118,10 +120,9 @@ def get_nan_flags_dict(sensor_name: str) -> dict:
118
120
  Dictionary with the expected nan_flags list for each data field.
119
121
  It excludes variables without specified nan_flags key.
120
122
  """
121
-
122
123
  data_format_dict = get_data_format_dict(sensor_name)
123
124
  dict_nan_flags = {}
124
- for k in data_format_dict.keys():
125
+ for k in data_format_dict:
125
126
  nan_flags = data_format_dict[k].get("nan_flags", None)
126
127
  if nan_flags is not None:
127
128
  dict_nan_flags[k] = _ensure_list_value(nan_flags)
@@ -144,7 +145,7 @@ def get_valid_values_dict(sensor_name: str) -> dict:
144
145
  """
145
146
  data_format_dict = get_data_format_dict(sensor_name)
146
147
  dict_valid_values = {}
147
- for k in data_format_dict.keys():
148
+ for k in data_format_dict:
148
149
  valid_values = data_format_dict[k].get("valid_values", None)
149
150
  if valid_values is not None:
150
151
  dict_valid_values[k] = _ensure_list_value(valid_values)
@@ -156,7 +157,7 @@ def get_valid_values_dict(sensor_name: str) -> dict:
156
157
  def get_field_ndigits_natural_dict(sensor_name: str) -> dict:
157
158
  """Get number of digits on the left side of the comma from the instrument default string standards.
158
159
 
159
- Example: 123,45 -> 123 --> 3 natural digits
160
+ Example: 123,45 -> 123 --> 3 natural digits.
160
161
 
161
162
  Parameters
162
163
  ----------
@@ -168,7 +169,6 @@ def get_field_ndigits_natural_dict(sensor_name: str) -> dict:
168
169
  dict
169
170
  Dictionary with the expected number of natural digits for each data field.
170
171
  """
171
-
172
172
  data_dict = get_data_format_dict(sensor_name)
173
173
  d = {k: v["n_naturals"] for k, v in data_dict.items()}
174
174
  return d
@@ -177,7 +177,8 @@ def get_field_ndigits_natural_dict(sensor_name: str) -> dict:
177
177
  def get_field_ndigits_decimals_dict(sensor_name: dict) -> dict:
178
178
  """Get number of digits on the right side of the comma from the instrument default string standards.
179
179
 
180
- Example: 123,45 -> 45 --> 2 decimal digits
180
+ Example: 123,45 -> 45 --> 2 decimal digits.
181
+
181
182
  Parameters
182
183
  ----------
183
184
  sensor_name : dict
@@ -188,7 +189,6 @@ def get_field_ndigits_decimals_dict(sensor_name: dict) -> dict:
188
189
  dict
189
190
  Dictionary with the expected number of decimal digits for each data field.
190
191
  """
191
-
192
192
  data_dict = get_data_format_dict(sensor_name)
193
193
  d = {k: v["n_decimals"] for k, v in data_dict.items()}
194
194
  return d
@@ -204,12 +204,12 @@ def get_field_ndigits_dict(sensor_name: str) -> dict:
204
204
  ----------
205
205
  sensor_name : str
206
206
  Name of the sensor.
207
+
207
208
  Returns
208
209
  -------
209
210
  dict
210
211
  Dictionary with the expected number of digits for each data field.
211
212
  """
212
-
213
213
  data_dict = get_data_format_dict(sensor_name)
214
214
  d = {k: v["n_digits"] for k, v in data_dict.items()}
215
215
  return d
@@ -231,7 +231,6 @@ def get_field_nchar_dict(sensor_name: str) -> dict:
231
231
  dict
232
232
  Dictionary with the expected number of characters for each data field.
233
233
  """
234
-
235
234
  data_dict = get_data_format_dict(sensor_name)
236
235
  d = {k: v["n_characters"] for k, v in data_dict.items()}
237
236
  return d
@@ -258,156 +257,12 @@ def get_l0b_cf_attrs_dict(sensor_name: str) -> dict:
258
257
  return read_config_file(sensor_name=sensor_name, product="L0A", filename="l0b_cf_attrs.yml")
259
258
 
260
259
 
261
- ####-------------------------------------------------------------------------.
262
- #### Coordinates attributes
263
-
264
-
265
- def get_coords_attrs_dict(ds):
266
- """Return dictionary with DISDRODB coordinates attributes."""
267
- attrs_dict = {}
268
- # Define diameter attributes
269
- attrs_dict["diameter_bin_center"] = {
270
- "name": "diameter_bin_center",
271
- "standard_name": "diameter_bin_center",
272
- "long_name": "diameter_bin_center",
273
- "units": "mm",
274
- "description": "Bin center drop diameter value",
275
- }
276
- attrs_dict["diameter_bin_width"] = {
277
- "name": "diameter_bin_width",
278
- "standard_name": "diameter_bin_width",
279
- "long_name": "diameter_bin_width",
280
- "units": "mm",
281
- "description": "Drop diameter bin width",
282
- }
283
- attrs_dict["diameter_bin_upper"] = {
284
- "name": "diameter_bin_upper",
285
- "standard_name": "diameter_bin_upper",
286
- "long_name": "diameter_bin_upper",
287
- "units": "mm",
288
- "description": "Bin upper bound drop diameter value",
289
- }
290
- attrs_dict["velocity_bin_lower"] = {
291
- "name": "velocity_bin_lower",
292
- "standard_name": "velocity_bin_lower",
293
- "long_name": "velocity_bin_lower",
294
- "units": "mm",
295
- "description": "Bin lower bound drop diameter value",
296
- }
297
- # Define velocity attributes
298
- attrs_dict["velocity_bin_center"] = {
299
- "name": "velocity_bin_center",
300
- "standard_name": "velocity_bin_center",
301
- "long_name": "velocity_bin_center",
302
- "units": "m/s",
303
- "description": "Bin center drop fall velocity value",
304
- }
305
- attrs_dict["velocity_bin_width"] = {
306
- "name": "velocity_bin_width",
307
- "standard_name": "velocity_bin_width",
308
- "long_name": "velocity_bin_width",
309
- "units": "m/s",
310
- "description": "Drop fall velocity bin width",
311
- }
312
- attrs_dict["velocity_bin_upper"] = {
313
- "name": "velocity_bin_upper",
314
- "standard_name": "velocity_bin_upper",
315
- "long_name": "velocity_bin_upper",
316
- "units": "m/s",
317
- "description": "Bin upper bound drop fall velocity value",
318
- }
319
- attrs_dict["velocity_bin_lower"] = {
320
- "name": "velocity_bin_lower",
321
- "standard_name": "velocity_bin_lower",
322
- "long_name": "velocity_bin_lower",
323
- "units": "m/s",
324
- "description": "Bin lower bound drop fall velocity value",
325
- }
326
- # Define geolocation attributes
327
- attrs_dict["latitude"] = {
328
- "name": "latitude",
329
- "standard_name": "latitude",
330
- "long_name": "Latitude",
331
- "units": "degrees_north",
332
- }
333
- attrs_dict["longitude"] = {
334
- "name": "longitude",
335
- "standard_name": "longitude",
336
- "long_name": "Longitude",
337
- "units": "degrees_east",
338
- }
339
- attrs_dict["altitude"] = {
340
- "name": "altitude",
341
- "standard_name": "altitude",
342
- "long_name": "Altitude",
343
- "units": "m",
344
- "description": "Elevation above sea level",
345
- }
346
- # Define time attributes
347
- attrs_dict["time"] = {
348
- "name": "time",
349
- "standard_name": "time",
350
- "long_name": "time",
351
- "description": "UTC Time",
352
- }
353
-
354
- return attrs_dict
355
-
356
-
357
- ####-------------------------------------------------------------------------.
358
- #### DISDRODB attributes
359
-
360
-
361
- def set_disdrodb_attrs(ds, product: str):
362
- """Add DISDRODB processing information to the netCDF global attributes.
363
-
364
- It assumes stations metadata are already added the dataset.
365
-
366
- Parameters
367
- ----------
368
- ds : xarray dataset
369
- Dataset
370
- product: str
371
- DISDRODB product
372
-
373
- Returns
374
- -------
375
- xarray dataset
376
- Dataset
377
- """
378
- # Add dataset conventions
379
- ds.attrs["Conventions"] = CONVENTIONS
380
-
381
- # Add featureType
382
- platform_type = ds.attrs["platform_type"]
383
- if platform_type == "fixed":
384
- ds.attrs["featureType"] = "timeSeries"
385
- else:
386
- ds.attrs["featureType"] = "trajectory"
387
-
388
- # Add time_coverage_start and time_coverage_end
389
- ds.attrs["time_coverage_start"] = str(ds["time"].data[0])
390
- ds.attrs["time_coverage_end"] = str(ds["time"].data[-1])
391
-
392
- # DISDRODDB attributes
393
- # - Add DISDRODB processing info
394
- now = datetime.datetime.utcnow()
395
- current_time = now.strftime("%Y-%m-%d %H:%M:%S")
396
- ds.attrs["disdrodb_processing_date"] = current_time
397
- # - Add DISDRODB product and version
398
- ds.attrs["disdrodb_product_version"] = PRODUCT_VERSION
399
- ds.attrs["disdrodb_software_version"] = SOFTWARE_VERSION
400
- ds.attrs["disdrodb_product"] = product
401
-
402
- return ds
403
-
404
-
405
260
  ####-------------------------------------------------------------------------.
406
261
  #### Bin Coordinates Information
407
262
 
408
263
 
409
264
  def get_diameter_bins_dict(sensor_name: str) -> dict:
410
- """Get dictionary with sensor_name diameter bins information.
265
+ """Get dictionary with ``sensor_name`` diameter bins information.
411
266
 
412
267
  Parameters
413
268
  ----------
@@ -417,7 +272,7 @@ def get_diameter_bins_dict(sensor_name: str) -> dict:
417
272
  Returns
418
273
  -------
419
274
  dict
420
- sensor_name diameter bins information
275
+ Sensor diameter bins information.
421
276
  """
422
277
  d = read_config_file(sensor_name=sensor_name, product="L0A", filename="bins_diameter.yml")
423
278
  return d
@@ -429,12 +284,12 @@ def get_diameter_bin_center(sensor_name: str) -> list:
429
284
  Parameters
430
285
  ----------
431
286
  sensor_name : str
432
- Name of the sensor
287
+ Name of the sensor.
433
288
 
434
289
  Returns
435
290
  -------
436
291
  list
437
- Diameter bin center
292
+ Diameter bin center.
438
293
  """
439
294
  diameter_dict = get_diameter_bins_dict(sensor_name)
440
295
  diameter_bin_center = list(diameter_dict["center"].values())
@@ -447,12 +302,12 @@ def get_diameter_bin_lower(sensor_name: str) -> list:
447
302
  Parameters
448
303
  ----------
449
304
  sensor_name : str
450
- Name of the sensor
305
+ Name of the sensor.
451
306
 
452
307
  Returns
453
308
  -------
454
309
  list
455
- Diameter bin lower bound
310
+ Diameter bin lower bound.
456
311
  """
457
312
  diameter_dict = get_diameter_bins_dict(sensor_name)
458
313
  lower_bounds = [v[0] for v in diameter_dict["bounds"].values()]
@@ -465,12 +320,12 @@ def get_diameter_bin_upper(sensor_name: str) -> list:
465
320
  Parameters
466
321
  ----------
467
322
  sensor_name : str
468
- Name of the sensor
323
+ Name of the sensor.
469
324
 
470
325
  Returns
471
326
  -------
472
327
  list
473
- Diameter bin upper bound
328
+ Diameter bin upper bound.
474
329
  """
475
330
  diameter_dict = get_diameter_bins_dict(sensor_name)
476
331
  upper_bounds = [v[1] for v in diameter_dict["bounds"].values()]
@@ -483,12 +338,12 @@ def get_diameter_bin_width(sensor_name: str) -> list:
483
338
  Parameters
484
339
  ----------
485
340
  sensor_name : str
486
- Name of the sensor
341
+ Name of the sensor.
487
342
 
488
343
  Returns
489
344
  -------
490
345
  list
491
- Diameter bin width
346
+ Diameter bin width.
492
347
  """
493
348
  diameter_dict = get_diameter_bins_dict(sensor_name)
494
349
  diameter_bin_width = list(diameter_dict["width"].values())
@@ -496,7 +351,7 @@ def get_diameter_bin_width(sensor_name: str) -> list:
496
351
 
497
352
 
498
353
  def get_velocity_bins_dict(sensor_name: str) -> dict:
499
- """Get velocity with sensor_name diameter bins information.
354
+ """Get velocity with ``sensor_name`` diameter bins information.
500
355
 
501
356
  Parameters
502
357
  ----------
@@ -506,7 +361,7 @@ def get_velocity_bins_dict(sensor_name: str) -> dict:
506
361
  Returns
507
362
  -------
508
363
  dict
509
- Sensor_name diameter bins information
364
+ Sensor velocity bins information.
510
365
  """
511
366
  d = read_config_file(sensor_name=sensor_name, product="L0A", filename="bins_velocity.yml")
512
367
  return d
@@ -518,12 +373,12 @@ def get_velocity_bin_center(sensor_name: str) -> list:
518
373
  Parameters
519
374
  ----------
520
375
  sensor_name : str
521
- Name of the sensor
376
+ Name of the sensor.
522
377
 
523
378
  Returns
524
379
  -------
525
380
  list
526
- Velocity bin center
381
+ Velocity bin center.
527
382
  """
528
383
  velocity_dict = get_velocity_bins_dict(sensor_name)
529
384
  if velocity_dict is not None:
@@ -539,7 +394,7 @@ def get_velocity_bin_lower(sensor_name: str) -> list:
539
394
  Parameters
540
395
  ----------
541
396
  sensor_name : str
542
- Name of the sensor
397
+ Name of the sensor.
543
398
 
544
399
  Returns
545
400
  -------
@@ -560,14 +415,13 @@ def get_velocity_bin_upper(sensor_name: str) -> list:
560
415
  Parameters
561
416
  ----------
562
417
  sensor_name : str
563
- Name of the sensor
418
+ Name of the sensor.
564
419
 
565
420
  Returns
566
421
  -------
567
422
  list
568
- Velocity bin upper bound
423
+ Velocity bin upper bound.
569
424
  """
570
-
571
425
  velocity_dict = get_velocity_bins_dict(sensor_name)
572
426
  if velocity_dict is not None:
573
427
  upper_bounds = [v[1] for v in velocity_dict["bounds"].values()]
@@ -582,14 +436,13 @@ def get_velocity_bin_width(sensor_name: str) -> list:
582
436
  Parameters
583
437
  ----------
584
438
  sensor_name : str
585
- Name of the sensor
439
+ Name of the sensor.
586
440
 
587
441
  Returns
588
442
  -------
589
443
  list
590
- Velocity bin width
444
+ Velocity bin width.
591
445
  """
592
-
593
446
  velocity_dict = get_velocity_bins_dict(sensor_name)
594
447
  if velocity_dict is not None:
595
448
  velocity_bin_width = list(velocity_dict["width"].values())
@@ -609,10 +462,9 @@ def get_bin_coords_dict(sensor_name: str) -> dict:
609
462
  Returns
610
463
  -------
611
464
  dict
612
- Dictionary with coordinate arrays.
465
+ Dictionary with coordinates arrays.
613
466
  """
614
-
615
- check_sensor_name(sensor_name=sensor_name)
467
+ check_sensor_name(sensor_name)
616
468
  coords = {}
617
469
  # Retrieve diameter coords
618
470
  coords["diameter_bin_center"] = get_diameter_bin_center(sensor_name=sensor_name)
@@ -661,10 +513,7 @@ def get_n_velocity_bins(sensor_name):
661
513
  """Get the number of velocity bins."""
662
514
  # Retrieve number of bins
663
515
  velocity_dict = get_velocity_bins_dict(sensor_name)
664
- if velocity_dict is None:
665
- n_velocity_bins = 0
666
- else:
667
- n_velocity_bins = len(velocity_dict["center"])
516
+ n_velocity_bins = 0 if velocity_dict is None else len(velocity_dict["center"])
668
517
  return n_velocity_bins
669
518
 
670
519
 
@@ -683,16 +532,15 @@ def get_l0a_dtype(sensor_name: str) -> dict:
683
532
  Returns
684
533
  -------
685
534
  dict
686
- L0A dtype
535
+ Dictionary with the L0A dtype.
687
536
  """
688
-
689
537
  # Note: This function could extract the info from l0a_encodings in future.
690
538
  d = read_config_file(sensor_name=sensor_name, product="L0A", filename="l0a_encodings.yml")
691
539
  return d
692
540
 
693
541
 
694
542
  def get_l0a_encodings_dict(sensor_name: str) -> dict:
695
- """Get a dictionary containing the L0A encodings
543
+ """Get a dictionary containing the L0A encodings.
696
544
 
697
545
  Parameters
698
546
  ----------
@@ -702,9 +550,8 @@ def get_l0a_encodings_dict(sensor_name: str) -> dict:
702
550
  Returns
703
551
  -------
704
552
  dict
705
- L0A encodings
553
+ L0A encodings.
706
554
  """
707
-
708
555
  # - l0a_encodings.yml currently specify only the dtype. This could be expanded in the future.
709
556
  d = read_config_file(sensor_name=sensor_name, product="L0A", filename="l0a_encodings.yml")
710
557
  return d
@@ -715,15 +562,17 @@ def _check_contiguous_chunksize_agrees(encoding_dict, var):
715
562
  contiguous = encoding_dict[var].get("contiguous", False)
716
563
  if isinstance(chunksizes, list) and len(chunksizes) >= 1 and contiguous:
717
564
  raise ValueError(
718
- f"Invalid encodings for variable {var}. 'chunksizes' are specified but 'contiguous' is set to True !"
565
+ f"Invalid encodings for variable {var}. 'chunksizes' are specified but 'contiguous' is set to True !",
719
566
  )
720
567
 
721
568
 
722
569
  def _if_no_chunksizes_set_contiguous(encoding_dict, var):
723
- if isinstance(encoding_dict[var].get("chunksizes", None), type(None)):
724
- if not encoding_dict[var].get("contiguous", False):
725
- encoding_dict[var]["contiguous"] = True
726
- print(f"Set contiguous=True for variable {var} because chunksizes=None")
570
+ if isinstance(encoding_dict[var].get("chunksizes", None), type(None)) and not encoding_dict[var].get(
571
+ "contiguous",
572
+ False,
573
+ ):
574
+ encoding_dict[var]["contiguous"] = True
575
+ print(f"Set contiguous=True for variable {var} because chunksizes=None")
727
576
  return encoding_dict
728
577
 
729
578
 
@@ -746,7 +595,7 @@ def _ensure_valid_chunksizes(encoding_dict, var):
746
595
 
747
596
 
748
597
  def _ensure_valid_netcdf_encoding_dict(encoding_dict):
749
- for var in encoding_dict.keys():
598
+ for var in encoding_dict:
750
599
  _check_contiguous_chunksize_agrees(encoding_dict, var)
751
600
  # Ensure valid arguments for contiguous (unchunked) arrays
752
601
  encoding_dict = _if_no_chunksizes_set_contiguous(encoding_dict, var)
@@ -774,20 +623,6 @@ def get_l0b_encodings_dict(sensor_name: str) -> dict:
774
623
  return encoding_dict
775
624
 
776
625
 
777
- def get_time_encoding() -> dict:
778
- """Create time encoding
779
-
780
- Returns
781
- -------
782
- dict
783
- Time encoding
784
- """
785
- encoding = {}
786
- encoding["units"] = EPOCH
787
- encoding["calendar"] = "proleptic_gregorian"
788
- return encoding
789
-
790
-
791
626
  ####-------------------------------------------------------------------------.
792
627
  #### L0B processing tools
793
628
 
@@ -822,7 +657,8 @@ def get_raw_array_dims_order(sensor_name: str) -> dict:
822
657
  The order of dimension specified for raw_drop_number controls the
823
658
  reshaping of the precipitation raw spectrum.
824
659
 
825
- Examples:
660
+ Examples
661
+ --------
826
662
  OTT Parsivel spectrum [v1d1 ... v1d32, v2d1, ..., v2d32]
827
663
  --> dimension_order = ["velocity_bin_center", "diameter_bin_center"]
828
664
  Thies LPM spectrum [v1d1 ... v20d1, v1d2, ..., v20d2]
@@ -831,12 +667,12 @@ def get_raw_array_dims_order(sensor_name: str) -> dict:
831
667
  Parameters
832
668
  ----------
833
669
  sensor_name : str
834
- Name of the sensor
670
+ Name of the sensor.
835
671
 
836
672
  Returns
837
673
  -------
838
674
  dict
839
- Dimension order dictionary
675
+ Dimension order dictionary.
840
676
 
841
677
  """
842
678
  # Retrieve data format dictionary
@@ -906,7 +742,7 @@ def get_valid_dimension_names(sensor_name):
906
742
  list_dimensions = list(dims_dict.values()) # for each array variable
907
743
  list_dimensions = [item for sublist in list_dimensions for item in sublist]
908
744
  valid_dims = np.unique(list_dimensions).tolist()
909
- dimensions = ["time"] + valid_dims
745
+ dimensions = ["time", *valid_dims]
910
746
  return dimensions
911
747
 
912
748