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
@@ -0,0 +1,28 @@
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
+ """Implement PSD scattering routines."""
18
+
19
+
20
+ from disdrodb.scattering.axis_ratio import available_axis_ratio, get_axis_ratio
21
+ from disdrodb.scattering.routines import available_radar_bands, get_radar_parameters
22
+
23
+ __all__ = [
24
+ "available_axis_ratio",
25
+ "available_radar_bands",
26
+ "get_axis_ratio",
27
+ "get_radar_parameters",
28
+ ]
@@ -0,0 +1,344 @@
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
+ """Implement drop axis ratio theoretical models."""
18
+
19
+ import numpy as np
20
+ import xarray as xr
21
+
22
+
23
+ def available_axis_ratio():
24
+ """Return a list of the available drop axis ratio methods."""
25
+ return list(AXIS_RATIO_METHODS)
26
+
27
+
28
+ def get_axis_ratio_method(method):
29
+ """Return the specified drop axis ratio method."""
30
+ method = check_axis_ratio(method)
31
+ return AXIS_RATIO_METHODS[method]
32
+
33
+
34
+ def check_axis_ratio(method):
35
+ """Check validity of the specified drop axis ratio method."""
36
+ available_methods = available_axis_ratio()
37
+ if method not in available_methods:
38
+ raise ValueError(f"{method} is an invalid axis-ratio method. Valid methods: {available_methods}.")
39
+ return method
40
+
41
+
42
+ def get_axis_ratio(diameter, method):
43
+ """
44
+ Compute the axis ratio of raindrops using the specified method.
45
+
46
+ Parameters
47
+ ----------
48
+ diameter : array-like
49
+ Raindrops diameter in mm.
50
+ method : str
51
+ The method to use for calculating the axis ratio. Available methods are:
52
+ 'Thurai2005', 'Thurai2007', 'Battaglia2010', 'Brandes2002',
53
+ 'Pruppacher1970', 'Beard1987', 'Andsager1999'.
54
+
55
+ Returns
56
+ -------
57
+ axis_ratio : array-like
58
+ Calculated axis ratios corresponding to the input diameters.
59
+
60
+ Raises
61
+ ------
62
+ ValueError
63
+ If the specified method is not one of the available methods.
64
+
65
+ Notes
66
+ -----
67
+ This function serves as a wrapper to various axis ratio models for raindrops.
68
+ It selects and applies the appropriate model based on the `method` parameter.
69
+
70
+ Examples
71
+ --------
72
+ >>> diameter = np.array([0.5, 1.0, 2.0, 3.0])
73
+ >>> axis_ratio = get_axis_ratio(diameter, method="Brandes2002")
74
+
75
+ """
76
+ # Retrieve axis ratio function
77
+ func = get_axis_ratio_method(method)
78
+
79
+ # Retrieve axis ratio
80
+ axis_ratio = func(diameter)
81
+
82
+ # Clip values between 0 and 1
83
+ axis_ratio = np.clip(axis_ratio, 0, 1)
84
+ return axis_ratio
85
+
86
+
87
+ def get_axis_ratio_andsager_1999(diameter):
88
+ """
89
+ Compute the axis ratio of raindrops using the Andsager et al. (1999) method.
90
+
91
+ Parameters
92
+ ----------
93
+ diameter : array-like
94
+ Diameter of the raindrops in millimeters.
95
+
96
+ Returns
97
+ -------
98
+ axis_ratio : array-like
99
+ Calculated axis ratios corresponding to the input diameters.
100
+
101
+ Notes
102
+ -----
103
+ This function calculates the axis ratio of raindrops based on the method described
104
+ in Andsager et al. (1999). For diameters between 1.1 mm and 4.4 mm, it uses the
105
+ average axis-ratio relationship given by Kubesh and Beard (1993):
106
+
107
+ axis_ratio = 1.012 - 0.144 * D - 1.03 * D^2
108
+
109
+ For diameters outside this range (0.1 mm to 1.1 mm and 4.4 mm to 7.0 mm),
110
+ it uses the equilibrium shape equation from Beard and Chuang (1987).
111
+
112
+ References
113
+ ----------
114
+ Andsager, K., Beard, K. V., & Laird, N. F. (1999).
115
+ Laboratory measurements of axis ratios for large raindrops.
116
+ Journal of the Atmospheric Sciences, 56(15), 2673-2683.
117
+
118
+ Kubesh, R. J., & Beard, K. V. (1993).
119
+ Laboratory measurements of spontaneous oscillations for moderate-size raindrops.
120
+ Journal of the Atmospheric Sciences, 50(7), 1089-1098.
121
+
122
+ Beard, K. V., & Chuang, C. (1987).
123
+ A new model for the equilibrium shape of raindrops.
124
+ Journal of the Atmospheric Sciences, 44(11), 1509-1524.
125
+
126
+ """
127
+ # Convert diameter to centimeters
128
+ diameter_cm = diameter * 0.1
129
+
130
+ # Axis ratio for diameters outside 1.1 mm to 4.4 mm using equilibrium model
131
+ axis_ratio_equilibrium = get_axis_ratio_beard_1987(diameter)
132
+
133
+ # Axis ratio for diameters between 1.1 mm and 4.4 mm using Kubesh & Beard (1993) model
134
+ axis_ratio_kubesh = 1.012 - 0.144 * diameter_cm - 1.03 * diameter_cm**2
135
+
136
+ # Combine models based on diameter ranges
137
+ axis_ratio = xr.where(
138
+ (diameter_cm >= 1.1) & (diameter_cm < 4.4),
139
+ axis_ratio_kubesh,
140
+ axis_ratio_equilibrium,
141
+ )
142
+
143
+ return axis_ratio
144
+
145
+
146
+ def get_axis_ratio_battaglia_2010(diameter):
147
+ """
148
+ Compute the axis ratio of raindrops using the Battaglia et al. (2010) method.
149
+
150
+ Parameters
151
+ ----------
152
+ diameter : array-like
153
+ Diameter of the raindrops in millimeters.
154
+
155
+ Returns
156
+ -------
157
+ axis_ratio : array-like
158
+ Calculated axis ratios corresponding to the input diameters.
159
+
160
+ Notes
161
+ -----
162
+ - For diameters less than or equal to 1 mm, the axis ratio is constant at 1.0.
163
+ - For diameters greater than or equal to 5 mm, the axis ratio is constant at 0.7.
164
+ - Between 1 mm and 5 mm, the axis ratio varies linearly.
165
+
166
+ The axis ratio is calculated using the equation:
167
+
168
+ axis_ratio = 1.075 - 0.075 * D
169
+
170
+ where **D** is the diameter in millimeters.
171
+
172
+ References
173
+ ----------
174
+ Battaglia, A., Rustemeier, E., Tokay, A., Blahak, U., & Simmer, C. (2010).
175
+ PARSIVEL Snow Observations: A Critical Assessment.
176
+ Journal of Atmospheric and Oceanic Technology, 27(2), 333-344.
177
+ https://doi.org/10.1175/2009JTECHA1332.1
178
+
179
+ """
180
+ axis_ratio = 1.075 - 0.075 * diameter
181
+ axis_ratio = xr.where(diameter <= 1, 1.0, axis_ratio)
182
+ axis_ratio = xr.where(diameter >= 5, 0.7, axis_ratio)
183
+ return axis_ratio
184
+
185
+
186
+ def get_axis_ratio_beard_1987(diameter):
187
+ """
188
+ Compute the axis ratio of raindrops using the Beard and Chuang (1987) method.
189
+
190
+ Parameters
191
+ ----------
192
+ diameter : array-like
193
+ Diameter of the raindrops in centimeters.
194
+
195
+ Returns
196
+ -------
197
+ axis_ratio : array-like
198
+ Calculated axis ratios corresponding to the input diameters.
199
+
200
+ Notes
201
+ -----
202
+ The formula is a polynomial fit to the numerical model of Beard and Chuang (1987), with
203
+ drop diameters between 1 and 7 mm.
204
+
205
+ References
206
+ ----------
207
+ Beard, K. V., & Chuang, C. (1987).
208
+ A new model for the equilibrium shape of raindrops.
209
+ Journal of the Atmospheric Sciences, 44(11), 1509-1524.
210
+ https://doi.org/10.1175/1520-0469(1987)044<1509:ANMFTE>2.0.CO;2
211
+ """
212
+ return 1.0048 + 5.7e-04 * diameter - 2.628e-02 * diameter**2 + 3.682e-03 * diameter**3 - 1.677e-04 * diameter**4
213
+
214
+
215
+ def get_axis_ratio_brandes_2002(diameter):
216
+ """
217
+ Compute the axis ratio of raindrops using the Brandes et al. (2002) method.
218
+
219
+ Parameters
220
+ ----------
221
+ diameter : array-like
222
+ Diameter of the raindrops in millimeters.
223
+
224
+ Returns
225
+ -------
226
+ axis_ratio : array-like
227
+ Calculated axis ratios corresponding to the input diameters.
228
+
229
+ References
230
+ ----------
231
+ Brandes, E. A., Zhang, G., & Vivekanandan, J. (2002).
232
+ Experiments in rainfall estimation with a polarimetric radar in a subtropical environment.
233
+ Journal of Applied Meteorology, 41(6), 674-685.
234
+ https://doi.org/10.1175/1520-0450(2002)041<0674:EIREWA>2.0.CO;2
235
+
236
+ Brandes, et al. 2005: On the Influence of Assumed Drop Size Distribution Form
237
+ on Radar-Retrieved Thunderstorm Microphysics. J. Appl. Meteor. Climatol., 45, 259-268.
238
+ """
239
+ # Valid for drop diameters between 0.1 to 8.1 mm
240
+ axis_ratio = 0.9951 + 0.0251 * diameter - 0.03644 * diameter**2 + 0.005303 * diameter**3 - 0.0002492 * diameter**4
241
+ return axis_ratio
242
+
243
+
244
+ def get_axis_ratio_pruppacher_1970(diameter):
245
+ """
246
+ Compute the axis ratio of raindrops using the Pruppacher and Pitter (1971) method.
247
+
248
+ Parameters
249
+ ----------
250
+ diameter : array-like
251
+ Diameter of the raindrops in millimeters.
252
+
253
+ Returns
254
+ -------
255
+ axis_ratio : array-like
256
+ Calculated axis ratios corresponding to the input diameters.
257
+
258
+ Notes
259
+ -----
260
+ This formula is a linear fit to wind tunnel data of Pruppacher and Pitter (1971) with
261
+ drop diameters between 1 and 9 mm.
262
+
263
+ References
264
+ ----------
265
+ Pruppacher, H. R., & Pitter, R. L. (1971).
266
+ A Semi-Empirical Determination of the Shape of Cloud and Precipitation Drops.
267
+ Journal of the Atmospheric Sciences, 28(1), 86-94.
268
+ https://doi.org/10.1175/1520-0469(1971)028<0086:ASEDOT>2.0.CO;2
269
+ """
270
+ axis_ratio = 1.03 - 0.062 * diameter
271
+ return axis_ratio
272
+
273
+
274
+ def get_axis_ratio_thurai_2005(diameter):
275
+ """
276
+ Compute the axis ratio of raindrops using the Thurai et al. (2005) method.
277
+
278
+ Parameters
279
+ ----------
280
+ diameter : array-like
281
+ Diameter of the raindrops in millimeters.
282
+
283
+ Returns
284
+ -------
285
+ axis_ratio : array-like
286
+ Calculated axis ratios corresponding to the input diameters.
287
+
288
+ References
289
+ ----------
290
+ Thurai, M., and V. N. Bringi, 2005: Drop Axis Ratios from a 2D Video Disdrometer.
291
+ J. Atmos. Oceanic Technol., 22, 966-978, https://doi.org/10.1175/JTECH1767.1
292
+
293
+ """
294
+ # Valid between 1 and 5 mm
295
+ axis_ratio = 0.9707 + 4.26e-2 * diameter - 4.29e-2 * diameter**2 + 6.5e-3 * diameter**3 - 3e-4 * diameter**4
296
+ return axis_ratio
297
+
298
+
299
+ def get_axis_ratio_thurai_2007(diameter):
300
+ """Compute the axis ratio of raindrops using the Thurai et al. (2007) method.
301
+
302
+ Parameters
303
+ ----------
304
+ diameter : array-like
305
+ Diameter of the raindrops in millimeters.
306
+
307
+ Returns
308
+ -------
309
+ axis_ratio : array-like
310
+ Calculated axis ratios corresponding to the input diameters.
311
+
312
+ References
313
+ ----------
314
+ Thurai, M., G. J. Huang, V. N. Bringi, W. L. Randeu, and M. Schönhuber, 2007:
315
+ Drop Shapes, Model Comparisons, and Calculations of Polarimetric Radar Parameters in Rain.
316
+ J. Atmos. Oceanic Technol., 24, 1019-1032, https://doi.org/10.1175/JTECH2051.1
317
+
318
+ """
319
+ # Assume spherical drop when diameter < 0.7 mm
320
+ axis_ratio_below_0_7 = 1
321
+ # Beard and Kubesh (1991) for drops diameter between 0.7 mm and 1.5 mm
322
+ axis_ratio_below_1_5 = (
323
+ 1.173 - 0.5165 * diameter + 0.4698 * diameter**2 - 0.1317 * diameter**3 - 8.5e-3 * diameter**4
324
+ )
325
+ # Formula fitted on measurements of Thurai et al., 2005 for drop diameter above 1.5 mm
326
+ # --> This is very similar to Pruppacher1970 !
327
+ axis_ratio_above_1_5 = (
328
+ 1.065 - 6.25e-2 * diameter - 3.99e-3 * diameter**2 + 7.66e-4 * diameter**3 - 4.095e-5 * diameter**4
329
+ )
330
+ # Combine axis ratio
331
+ axis_ratio_below_1_5 = xr.where(diameter > 0.7, axis_ratio_below_1_5, axis_ratio_below_0_7)
332
+ axis_ratio = xr.where(diameter > 1.5, axis_ratio_above_1_5, axis_ratio_below_1_5)
333
+ return axis_ratio
334
+
335
+
336
+ AXIS_RATIO_METHODS = {
337
+ "Thurai2005": get_axis_ratio_thurai_2005,
338
+ "Thurai2007": get_axis_ratio_thurai_2007,
339
+ "Battaglia2010": get_axis_ratio_battaglia_2010,
340
+ "Brandes2002": get_axis_ratio_brandes_2002,
341
+ "Pruppacher1970": get_axis_ratio_pruppacher_1970,
342
+ "Beard1987": get_axis_ratio_beard_1987,
343
+ "Andsager1999": get_axis_ratio_andsager_1999,
344
+ }