HydPy 6.2.dev1__cp313-cp313-win_amd64.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 (890) hide show
  1. hydpy/__init__.py +275 -0
  2. hydpy/aliases.py +2554 -0
  3. hydpy/auxs/__init__.py +0 -0
  4. hydpy/auxs/anntools.py +1305 -0
  5. hydpy/auxs/armatools.py +883 -0
  6. hydpy/auxs/calibtools.py +3337 -0
  7. hydpy/auxs/interptools.py +1094 -0
  8. hydpy/auxs/iuhtools.py +543 -0
  9. hydpy/auxs/networktools.py +597 -0
  10. hydpy/auxs/ppolytools.py +809 -0
  11. hydpy/auxs/quadtools.py +61 -0
  12. hydpy/auxs/roottools.py +228 -0
  13. hydpy/auxs/smoothtools.py +273 -0
  14. hydpy/auxs/statstools.py +2125 -0
  15. hydpy/auxs/validtools.py +81 -0
  16. hydpy/conf/HydPyConfigBase.xsd +68637 -0
  17. hydpy/conf/HydPyConfigBase.xsdt +358 -0
  18. hydpy/conf/HydPyConfigMultipleRuns.xsd +25 -0
  19. hydpy/conf/HydPyConfigSingleRun.xsd +24 -0
  20. hydpy/conf/__init__.py +0 -0
  21. hydpy/conf/a_coefficients_explicit_lobatto_sequence.npy +0 -0
  22. hydpy/conf/support_points_for_smoothpar_logistic2.npy +0 -0
  23. hydpy/config.py +42 -0
  24. hydpy/core/__init__.py +0 -0
  25. hydpy/core/aliastools.py +214 -0
  26. hydpy/core/autodoctools.py +1947 -0
  27. hydpy/core/auxfiletools.py +1169 -0
  28. hydpy/core/devicetools.py +3810 -0
  29. hydpy/core/exceptiontools.py +269 -0
  30. hydpy/core/filetools.py +1985 -0
  31. hydpy/core/hydpytools.py +3089 -0
  32. hydpy/core/importtools.py +1398 -0
  33. hydpy/core/indextools.py +345 -0
  34. hydpy/core/itemtools.py +1849 -0
  35. hydpy/core/masktools.py +460 -0
  36. hydpy/core/modeltools.py +4868 -0
  37. hydpy/core/netcdftools.py +2683 -0
  38. hydpy/core/objecttools.py +2023 -0
  39. hydpy/core/optiontools.py +1045 -0
  40. hydpy/core/parametertools.py +4674 -0
  41. hydpy/core/printtools.py +222 -0
  42. hydpy/core/propertytools.py +643 -0
  43. hydpy/core/pubtools.py +254 -0
  44. hydpy/core/selectiontools.py +1571 -0
  45. hydpy/core/sequencetools.py +4476 -0
  46. hydpy/core/seriestools.py +339 -0
  47. hydpy/core/testtools.py +2483 -0
  48. hydpy/core/timetools.py +3567 -0
  49. hydpy/core/typingtools.py +333 -0
  50. hydpy/core/variabletools.py +2615 -0
  51. hydpy/cythons/__init__.py +24 -0
  52. hydpy/cythons/annutils.pxd +33 -0
  53. hydpy/cythons/annutils.pyi +25 -0
  54. hydpy/cythons/annutils.pyx +120 -0
  55. hydpy/cythons/autogen/__init__.py +0 -0
  56. hydpy/cythons/autogen/annutils.cp313-win_amd64.pyd +0 -0
  57. hydpy/cythons/autogen/annutils.pxd +42 -0
  58. hydpy/cythons/autogen/annutils.pyx +129 -0
  59. hydpy/cythons/autogen/c_arma.cp313-win_amd64.pyd +0 -0
  60. hydpy/cythons/autogen/c_arma.pxd +179 -0
  61. hydpy/cythons/autogen/c_arma.pyx +356 -0
  62. hydpy/cythons/autogen/c_arma_rimorido.cp313-win_amd64.pyd +0 -0
  63. hydpy/cythons/autogen/c_arma_rimorido.pxd +179 -0
  64. hydpy/cythons/autogen/c_arma_rimorido.pyx +356 -0
  65. hydpy/cythons/autogen/c_conv.cp313-win_amd64.pyd +0 -0
  66. hydpy/cythons/autogen/c_conv.pxd +198 -0
  67. hydpy/cythons/autogen/c_conv.pyx +491 -0
  68. hydpy/cythons/autogen/c_conv_idw.cp313-win_amd64.pyd +0 -0
  69. hydpy/cythons/autogen/c_conv_idw.pxd +124 -0
  70. hydpy/cythons/autogen/c_conv_idw.pyx +264 -0
  71. hydpy/cythons/autogen/c_conv_idw_ed.cp313-win_amd64.pyd +0 -0
  72. hydpy/cythons/autogen/c_conv_idw_ed.pxd +197 -0
  73. hydpy/cythons/autogen/c_conv_idw_ed.pyx +481 -0
  74. hydpy/cythons/autogen/c_conv_nn.cp313-win_amd64.pyd +0 -0
  75. hydpy/cythons/autogen/c_conv_nn.pxd +120 -0
  76. hydpy/cythons/autogen/c_conv_nn.pyx +224 -0
  77. hydpy/cythons/autogen/c_dam.cp313-win_amd64.pyd +0 -0
  78. hydpy/cythons/autogen/c_dam.pxd +805 -0
  79. hydpy/cythons/autogen/c_dam.pyx +1477 -0
  80. hydpy/cythons/autogen/c_dam_llake.cp313-win_amd64.pyd +0 -0
  81. hydpy/cythons/autogen/c_dam_llake.pxd +364 -0
  82. hydpy/cythons/autogen/c_dam_llake.pyx +705 -0
  83. hydpy/cythons/autogen/c_dam_lreservoir.cp313-win_amd64.pyd +0 -0
  84. hydpy/cythons/autogen/c_dam_lreservoir.pxd +365 -0
  85. hydpy/cythons/autogen/c_dam_lreservoir.pyx +708 -0
  86. hydpy/cythons/autogen/c_dam_lretention.cp313-win_amd64.pyd +0 -0
  87. hydpy/cythons/autogen/c_dam_lretention.pxd +340 -0
  88. hydpy/cythons/autogen/c_dam_lretention.pyx +625 -0
  89. hydpy/cythons/autogen/c_dam_pump.cp313-win_amd64.pyd +0 -0
  90. hydpy/cythons/autogen/c_dam_pump.pxd +402 -0
  91. hydpy/cythons/autogen/c_dam_pump.pyx +724 -0
  92. hydpy/cythons/autogen/c_dam_pump_sluice.cp313-win_amd64.pyd +0 -0
  93. hydpy/cythons/autogen/c_dam_pump_sluice.pxd +452 -0
  94. hydpy/cythons/autogen/c_dam_pump_sluice.pyx +829 -0
  95. hydpy/cythons/autogen/c_dam_sluice.cp313-win_amd64.pyd +0 -0
  96. hydpy/cythons/autogen/c_dam_sluice.pxd +404 -0
  97. hydpy/cythons/autogen/c_dam_sluice.pyx +726 -0
  98. hydpy/cythons/autogen/c_dam_v001.cp313-win_amd64.pyd +0 -0
  99. hydpy/cythons/autogen/c_dam_v001.pxd +452 -0
  100. hydpy/cythons/autogen/c_dam_v001.pyx +816 -0
  101. hydpy/cythons/autogen/c_dam_v002.cp313-win_amd64.pyd +0 -0
  102. hydpy/cythons/autogen/c_dam_v002.pxd +394 -0
  103. hydpy/cythons/autogen/c_dam_v002.pyx +703 -0
  104. hydpy/cythons/autogen/c_dam_v003.cp313-win_amd64.pyd +0 -0
  105. hydpy/cythons/autogen/c_dam_v003.pxd +417 -0
  106. hydpy/cythons/autogen/c_dam_v003.pyx +744 -0
  107. hydpy/cythons/autogen/c_dam_v004.cp313-win_amd64.pyd +0 -0
  108. hydpy/cythons/autogen/c_dam_v004.pxd +486 -0
  109. hydpy/cythons/autogen/c_dam_v004.pyx +891 -0
  110. hydpy/cythons/autogen/c_dam_v005.cp313-win_amd64.pyd +0 -0
  111. hydpy/cythons/autogen/c_dam_v005.pxd +524 -0
  112. hydpy/cythons/autogen/c_dam_v005.pyx +928 -0
  113. hydpy/cythons/autogen/c_dummy.cp313-win_amd64.pyd +0 -0
  114. hydpy/cythons/autogen/c_dummy.pxd +151 -0
  115. hydpy/cythons/autogen/c_dummy.pyx +263 -0
  116. hydpy/cythons/autogen/c_dummy_interceptedwater.cp313-win_amd64.pyd +0 -0
  117. hydpy/cythons/autogen/c_dummy_interceptedwater.pxd +69 -0
  118. hydpy/cythons/autogen/c_dummy_interceptedwater.pyx +104 -0
  119. hydpy/cythons/autogen/c_dummy_node2node.cp313-win_amd64.pyd +0 -0
  120. hydpy/cythons/autogen/c_dummy_node2node.pxd +89 -0
  121. hydpy/cythons/autogen/c_dummy_node2node.pyx +148 -0
  122. hydpy/cythons/autogen/c_dummy_snowalbedo.cp313-win_amd64.pyd +0 -0
  123. hydpy/cythons/autogen/c_dummy_snowalbedo.pxd +69 -0
  124. hydpy/cythons/autogen/c_dummy_snowalbedo.pyx +104 -0
  125. hydpy/cythons/autogen/c_dummy_snowcover.cp313-win_amd64.pyd +0 -0
  126. hydpy/cythons/autogen/c_dummy_snowcover.pxd +69 -0
  127. hydpy/cythons/autogen/c_dummy_snowcover.pyx +104 -0
  128. hydpy/cythons/autogen/c_dummy_snowycanopy.cp313-win_amd64.pyd +0 -0
  129. hydpy/cythons/autogen/c_dummy_snowycanopy.pxd +69 -0
  130. hydpy/cythons/autogen/c_dummy_snowycanopy.pyx +104 -0
  131. hydpy/cythons/autogen/c_dummy_soilwater.cp313-win_amd64.pyd +0 -0
  132. hydpy/cythons/autogen/c_dummy_soilwater.pxd +69 -0
  133. hydpy/cythons/autogen/c_dummy_soilwater.pyx +104 -0
  134. hydpy/cythons/autogen/c_evap.cp313-win_amd64.pyd +0 -0
  135. hydpy/cythons/autogen/c_evap.pxd +1029 -0
  136. hydpy/cythons/autogen/c_evap.pyx +2601 -0
  137. hydpy/cythons/autogen/c_evap_aet_hbv96.cp313-win_amd64.pyd +0 -0
  138. hydpy/cythons/autogen/c_evap_aet_hbv96.pxd +227 -0
  139. hydpy/cythons/autogen/c_evap_aet_hbv96.pyx +584 -0
  140. hydpy/cythons/autogen/c_evap_aet_minhas.cp313-win_amd64.pyd +0 -0
  141. hydpy/cythons/autogen/c_evap_aet_minhas.pxd +193 -0
  142. hydpy/cythons/autogen/c_evap_aet_minhas.pyx +478 -0
  143. hydpy/cythons/autogen/c_evap_aet_morsim.cp313-win_amd64.pyd +0 -0
  144. hydpy/cythons/autogen/c_evap_aet_morsim.pxd +681 -0
  145. hydpy/cythons/autogen/c_evap_aet_morsim.pyx +1642 -0
  146. hydpy/cythons/autogen/c_evap_pet_ambav1.cp313-win_amd64.pyd +0 -0
  147. hydpy/cythons/autogen/c_evap_pet_ambav1.pxd +532 -0
  148. hydpy/cythons/autogen/c_evap_pet_ambav1.pyx +1296 -0
  149. hydpy/cythons/autogen/c_evap_pet_hbv96.cp313-win_amd64.pyd +0 -0
  150. hydpy/cythons/autogen/c_evap_pet_hbv96.pxd +179 -0
  151. hydpy/cythons/autogen/c_evap_pet_hbv96.pyx +328 -0
  152. hydpy/cythons/autogen/c_evap_pet_m.cp313-win_amd64.pyd +0 -0
  153. hydpy/cythons/autogen/c_evap_pet_m.pxd +124 -0
  154. hydpy/cythons/autogen/c_evap_pet_m.pyx +214 -0
  155. hydpy/cythons/autogen/c_evap_pet_mlc.cp313-win_amd64.pyd +0 -0
  156. hydpy/cythons/autogen/c_evap_pet_mlc.pxd +126 -0
  157. hydpy/cythons/autogen/c_evap_pet_mlc.pyx +214 -0
  158. hydpy/cythons/autogen/c_evap_ret_fao56.cp313-win_amd64.pyd +0 -0
  159. hydpy/cythons/autogen/c_evap_ret_fao56.pxd +305 -0
  160. hydpy/cythons/autogen/c_evap_ret_fao56.pyx +624 -0
  161. hydpy/cythons/autogen/c_evap_ret_io.cp313-win_amd64.pyd +0 -0
  162. hydpy/cythons/autogen/c_evap_ret_io.pxd +112 -0
  163. hydpy/cythons/autogen/c_evap_ret_io.pyx +176 -0
  164. hydpy/cythons/autogen/c_evap_ret_tw2002.cp313-win_amd64.pyd +0 -0
  165. hydpy/cythons/autogen/c_evap_ret_tw2002.pxd +139 -0
  166. hydpy/cythons/autogen/c_evap_ret_tw2002.pyx +273 -0
  167. hydpy/cythons/autogen/c_exch.cp313-win_amd64.pyd +0 -0
  168. hydpy/cythons/autogen/c_exch.pxd +230 -0
  169. hydpy/cythons/autogen/c_exch.pyx +462 -0
  170. hydpy/cythons/autogen/c_exch_branch_hbv96.cp313-win_amd64.pyd +0 -0
  171. hydpy/cythons/autogen/c_exch_branch_hbv96.pxd +134 -0
  172. hydpy/cythons/autogen/c_exch_branch_hbv96.pyx +255 -0
  173. hydpy/cythons/autogen/c_exch_waterlevel.cp313-win_amd64.pyd +0 -0
  174. hydpy/cythons/autogen/c_exch_waterlevel.pxd +54 -0
  175. hydpy/cythons/autogen/c_exch_waterlevel.pyx +78 -0
  176. hydpy/cythons/autogen/c_exch_weir_hbv96.cp313-win_amd64.pyd +0 -0
  177. hydpy/cythons/autogen/c_exch_weir_hbv96.pxd +156 -0
  178. hydpy/cythons/autogen/c_exch_weir_hbv96.pyx +282 -0
  179. hydpy/cythons/autogen/c_ga.cp313-win_amd64.pyd +0 -0
  180. hydpy/cythons/autogen/c_ga.pxd +353 -0
  181. hydpy/cythons/autogen/c_ga.pyx +1204 -0
  182. hydpy/cythons/autogen/c_ga_garto.cp313-win_amd64.pyd +0 -0
  183. hydpy/cythons/autogen/c_ga_garto.pxd +330 -0
  184. hydpy/cythons/autogen/c_ga_garto.pyx +1105 -0
  185. hydpy/cythons/autogen/c_ga_garto_submodel1.cp313-win_amd64.pyd +0 -0
  186. hydpy/cythons/autogen/c_ga_garto_submodel1.pxd +236 -0
  187. hydpy/cythons/autogen/c_ga_garto_submodel1.pyx +944 -0
  188. hydpy/cythons/autogen/c_gland.cp313-win_amd64.pyd +0 -0
  189. hydpy/cythons/autogen/c_gland.pxd +437 -0
  190. hydpy/cythons/autogen/c_gland.pyx +726 -0
  191. hydpy/cythons/autogen/c_gland_gr4.cp313-win_amd64.pyd +0 -0
  192. hydpy/cythons/autogen/c_gland_gr4.pxd +382 -0
  193. hydpy/cythons/autogen/c_gland_gr4.pyx +605 -0
  194. hydpy/cythons/autogen/c_gland_gr5.cp313-win_amd64.pyd +0 -0
  195. hydpy/cythons/autogen/c_gland_gr5.pxd +368 -0
  196. hydpy/cythons/autogen/c_gland_gr5.pyx +568 -0
  197. hydpy/cythons/autogen/c_gland_gr6.cp313-win_amd64.pyd +0 -0
  198. hydpy/cythons/autogen/c_gland_gr6.pxd +420 -0
  199. hydpy/cythons/autogen/c_gland_gr6.pyx +673 -0
  200. hydpy/cythons/autogen/c_hland.cp313-win_amd64.pyd +0 -0
  201. hydpy/cythons/autogen/c_hland.pxd +855 -0
  202. hydpy/cythons/autogen/c_hland.pyx +2486 -0
  203. hydpy/cythons/autogen/c_hland_96.cp313-win_amd64.pyd +0 -0
  204. hydpy/cythons/autogen/c_hland_96.pxd +631 -0
  205. hydpy/cythons/autogen/c_hland_96.pyx +1724 -0
  206. hydpy/cythons/autogen/c_hland_96c.cp313-win_amd64.pyd +0 -0
  207. hydpy/cythons/autogen/c_hland_96c.pxd +621 -0
  208. hydpy/cythons/autogen/c_hland_96c.pyx +1822 -0
  209. hydpy/cythons/autogen/c_hland_96p.cp313-win_amd64.pyd +0 -0
  210. hydpy/cythons/autogen/c_hland_96p.pxd +683 -0
  211. hydpy/cythons/autogen/c_hland_96p.pyx +1911 -0
  212. hydpy/cythons/autogen/c_kinw.cp313-win_amd64.pyd +0 -0
  213. hydpy/cythons/autogen/c_kinw.pxd +509 -0
  214. hydpy/cythons/autogen/c_kinw.pyx +965 -0
  215. hydpy/cythons/autogen/c_kinw_williams.cp313-win_amd64.pyd +0 -0
  216. hydpy/cythons/autogen/c_kinw_williams.pxd +409 -0
  217. hydpy/cythons/autogen/c_kinw_williams.pyx +763 -0
  218. hydpy/cythons/autogen/c_kinw_williams_ext.cp313-win_amd64.pyd +0 -0
  219. hydpy/cythons/autogen/c_kinw_williams_ext.pxd +220 -0
  220. hydpy/cythons/autogen/c_kinw_williams_ext.pyx +440 -0
  221. hydpy/cythons/autogen/c_lland.cp313-win_amd64.pyd +0 -0
  222. hydpy/cythons/autogen/c_lland.pxd +1386 -0
  223. hydpy/cythons/autogen/c_lland.pyx +3679 -0
  224. hydpy/cythons/autogen/c_lland_dd.cp313-win_amd64.pyd +0 -0
  225. hydpy/cythons/autogen/c_lland_dd.pxd +679 -0
  226. hydpy/cythons/autogen/c_lland_dd.pyx +1719 -0
  227. hydpy/cythons/autogen/c_lland_knauf.cp313-win_amd64.pyd +0 -0
  228. hydpy/cythons/autogen/c_lland_knauf.pxd +1096 -0
  229. hydpy/cythons/autogen/c_lland_knauf.pyx +2784 -0
  230. hydpy/cythons/autogen/c_lland_knauf_ic.cp313-win_amd64.pyd +0 -0
  231. hydpy/cythons/autogen/c_lland_knauf_ic.pxd +1369 -0
  232. hydpy/cythons/autogen/c_lland_knauf_ic.pyx +3625 -0
  233. hydpy/cythons/autogen/c_meteo.cp313-win_amd64.pyd +0 -0
  234. hydpy/cythons/autogen/c_meteo.pxd +469 -0
  235. hydpy/cythons/autogen/c_meteo.pyx +879 -0
  236. hydpy/cythons/autogen/c_meteo_clear_glob_io.cp313-win_amd64.pyd +0 -0
  237. hydpy/cythons/autogen/c_meteo_clear_glob_io.pxd +75 -0
  238. hydpy/cythons/autogen/c_meteo_clear_glob_io.pyx +107 -0
  239. hydpy/cythons/autogen/c_meteo_glob_fao56.cp313-win_amd64.pyd +0 -0
  240. hydpy/cythons/autogen/c_meteo_glob_fao56.pxd +209 -0
  241. hydpy/cythons/autogen/c_meteo_glob_fao56.pyx +339 -0
  242. hydpy/cythons/autogen/c_meteo_glob_io.cp313-win_amd64.pyd +0 -0
  243. hydpy/cythons/autogen/c_meteo_glob_io.pxd +63 -0
  244. hydpy/cythons/autogen/c_meteo_glob_io.pyx +91 -0
  245. hydpy/cythons/autogen/c_meteo_glob_morsim.cp313-win_amd64.pyd +0 -0
  246. hydpy/cythons/autogen/c_meteo_glob_morsim.pxd +289 -0
  247. hydpy/cythons/autogen/c_meteo_glob_morsim.pyx +527 -0
  248. hydpy/cythons/autogen/c_meteo_precip_io.cp313-win_amd64.pyd +0 -0
  249. hydpy/cythons/autogen/c_meteo_precip_io.pxd +112 -0
  250. hydpy/cythons/autogen/c_meteo_precip_io.pyx +176 -0
  251. hydpy/cythons/autogen/c_meteo_psun_sun_glob_io.cp313-win_amd64.pyd +0 -0
  252. hydpy/cythons/autogen/c_meteo_psun_sun_glob_io.pxd +87 -0
  253. hydpy/cythons/autogen/c_meteo_psun_sun_glob_io.pyx +123 -0
  254. hydpy/cythons/autogen/c_meteo_sun_fao56.cp313-win_amd64.pyd +0 -0
  255. hydpy/cythons/autogen/c_meteo_sun_fao56.pxd +209 -0
  256. hydpy/cythons/autogen/c_meteo_sun_fao56.pyx +343 -0
  257. hydpy/cythons/autogen/c_meteo_sun_morsim.cp313-win_amd64.pyd +0 -0
  258. hydpy/cythons/autogen/c_meteo_sun_morsim.pxd +286 -0
  259. hydpy/cythons/autogen/c_meteo_sun_morsim.pyx +519 -0
  260. hydpy/cythons/autogen/c_meteo_temp_io.cp313-win_amd64.pyd +0 -0
  261. hydpy/cythons/autogen/c_meteo_temp_io.pxd +112 -0
  262. hydpy/cythons/autogen/c_meteo_temp_io.pyx +176 -0
  263. hydpy/cythons/autogen/c_musk.cp313-win_amd64.pyd +0 -0
  264. hydpy/cythons/autogen/c_musk.pxd +282 -0
  265. hydpy/cythons/autogen/c_musk.pyx +605 -0
  266. hydpy/cythons/autogen/c_musk_classic.cp313-win_amd64.pyd +0 -0
  267. hydpy/cythons/autogen/c_musk_classic.pxd +138 -0
  268. hydpy/cythons/autogen/c_musk_classic.pyx +226 -0
  269. hydpy/cythons/autogen/c_musk_mct.cp313-win_amd64.pyd +0 -0
  270. hydpy/cythons/autogen/c_musk_mct.pxd +282 -0
  271. hydpy/cythons/autogen/c_musk_mct.pyx +609 -0
  272. hydpy/cythons/autogen/c_rconc.cp313-win_amd64.pyd +0 -0
  273. hydpy/cythons/autogen/c_rconc.pxd +119 -0
  274. hydpy/cythons/autogen/c_rconc.pyx +174 -0
  275. hydpy/cythons/autogen/c_rconc_nash.cp313-win_amd64.pyd +0 -0
  276. hydpy/cythons/autogen/c_rconc_nash.pxd +111 -0
  277. hydpy/cythons/autogen/c_rconc_nash.pyx +185 -0
  278. hydpy/cythons/autogen/c_rconc_uh.cp313-win_amd64.pyd +0 -0
  279. hydpy/cythons/autogen/c_rconc_uh.pxd +92 -0
  280. hydpy/cythons/autogen/c_rconc_uh.pyx +125 -0
  281. hydpy/cythons/autogen/c_sw1d.cp313-win_amd64.pyd +0 -0
  282. hydpy/cythons/autogen/c_sw1d.pxd +511 -0
  283. hydpy/cythons/autogen/c_sw1d.pyx +1263 -0
  284. hydpy/cythons/autogen/c_sw1d_channel.cp313-win_amd64.pyd +0 -0
  285. hydpy/cythons/autogen/c_sw1d_channel.pxd +119 -0
  286. hydpy/cythons/autogen/c_sw1d_channel.pyx +300 -0
  287. hydpy/cythons/autogen/c_sw1d_gate_out.cp313-win_amd64.pyd +0 -0
  288. hydpy/cythons/autogen/c_sw1d_gate_out.pxd +240 -0
  289. hydpy/cythons/autogen/c_sw1d_gate_out.pyx +476 -0
  290. hydpy/cythons/autogen/c_sw1d_lias.cp313-win_amd64.pyd +0 -0
  291. hydpy/cythons/autogen/c_sw1d_lias.pxd +320 -0
  292. hydpy/cythons/autogen/c_sw1d_lias.pyx +619 -0
  293. hydpy/cythons/autogen/c_sw1d_lias_sluice.cp313-win_amd64.pyd +0 -0
  294. hydpy/cythons/autogen/c_sw1d_lias_sluice.pxd +325 -0
  295. hydpy/cythons/autogen/c_sw1d_lias_sluice.pyx +644 -0
  296. hydpy/cythons/autogen/c_sw1d_network.cp313-win_amd64.pyd +0 -0
  297. hydpy/cythons/autogen/c_sw1d_network.pxd +90 -0
  298. hydpy/cythons/autogen/c_sw1d_network.pyx +246 -0
  299. hydpy/cythons/autogen/c_sw1d_pump.cp313-win_amd64.pyd +0 -0
  300. hydpy/cythons/autogen/c_sw1d_pump.pxd +256 -0
  301. hydpy/cythons/autogen/c_sw1d_pump.pyx +502 -0
  302. hydpy/cythons/autogen/c_sw1d_q_in.cp313-win_amd64.pyd +0 -0
  303. hydpy/cythons/autogen/c_sw1d_q_in.pxd +224 -0
  304. hydpy/cythons/autogen/c_sw1d_q_in.pyx +383 -0
  305. hydpy/cythons/autogen/c_sw1d_q_out.cp313-win_amd64.pyd +0 -0
  306. hydpy/cythons/autogen/c_sw1d_q_out.pxd +224 -0
  307. hydpy/cythons/autogen/c_sw1d_q_out.pyx +383 -0
  308. hydpy/cythons/autogen/c_sw1d_storage.cp313-win_amd64.pyd +0 -0
  309. hydpy/cythons/autogen/c_sw1d_storage.pxd +193 -0
  310. hydpy/cythons/autogen/c_sw1d_storage.pyx +349 -0
  311. hydpy/cythons/autogen/c_sw1d_weir_out.cp313-win_amd64.pyd +0 -0
  312. hydpy/cythons/autogen/c_sw1d_weir_out.pxd +212 -0
  313. hydpy/cythons/autogen/c_sw1d_weir_out.pyx +404 -0
  314. hydpy/cythons/autogen/c_test.cp313-win_amd64.pyd +0 -0
  315. hydpy/cythons/autogen/c_test.pxd +175 -0
  316. hydpy/cythons/autogen/c_test.pyx +348 -0
  317. hydpy/cythons/autogen/c_test_discontinous.cp313-win_amd64.pyd +0 -0
  318. hydpy/cythons/autogen/c_test_discontinous.pxd +146 -0
  319. hydpy/cythons/autogen/c_test_discontinous.pyx +256 -0
  320. hydpy/cythons/autogen/c_test_stiff0d.cp313-win_amd64.pyd +0 -0
  321. hydpy/cythons/autogen/c_test_stiff0d.pxd +146 -0
  322. hydpy/cythons/autogen/c_test_stiff0d.pyx +250 -0
  323. hydpy/cythons/autogen/c_test_stiff1d.cp313-win_amd64.pyd +0 -0
  324. hydpy/cythons/autogen/c_test_stiff1d.pxd +145 -0
  325. hydpy/cythons/autogen/c_test_stiff1d.pyx +294 -0
  326. hydpy/cythons/autogen/c_whmod.cp313-win_amd64.pyd +0 -0
  327. hydpy/cythons/autogen/c_whmod.pxd +482 -0
  328. hydpy/cythons/autogen/c_whmod.pyx +1156 -0
  329. hydpy/cythons/autogen/c_whmod_rural.cp313-win_amd64.pyd +0 -0
  330. hydpy/cythons/autogen/c_whmod_rural.pxd +411 -0
  331. hydpy/cythons/autogen/c_whmod_rural.pyx +982 -0
  332. hydpy/cythons/autogen/c_whmod_urban.cp313-win_amd64.pyd +0 -0
  333. hydpy/cythons/autogen/c_whmod_urban.pxd +482 -0
  334. hydpy/cythons/autogen/c_whmod_urban.pyx +1155 -0
  335. hydpy/cythons/autogen/c_wland.cp313-win_amd64.pyd +0 -0
  336. hydpy/cythons/autogen/c_wland.pxd +842 -0
  337. hydpy/cythons/autogen/c_wland.pyx +1890 -0
  338. hydpy/cythons/autogen/c_wland_gd.cp313-win_amd64.pyd +0 -0
  339. hydpy/cythons/autogen/c_wland_gd.pxd +829 -0
  340. hydpy/cythons/autogen/c_wland_gd.pyx +1847 -0
  341. hydpy/cythons/autogen/c_wland_wag.cp313-win_amd64.pyd +0 -0
  342. hydpy/cythons/autogen/c_wland_wag.pxd +810 -0
  343. hydpy/cythons/autogen/c_wland_wag.pyx +1780 -0
  344. hydpy/cythons/autogen/c_wq.cp313-win_amd64.pyd +0 -0
  345. hydpy/cythons/autogen/c_wq.pxd +275 -0
  346. hydpy/cythons/autogen/c_wq.pyx +652 -0
  347. hydpy/cythons/autogen/c_wq_trapeze.cp313-win_amd64.pyd +0 -0
  348. hydpy/cythons/autogen/c_wq_trapeze.pxd +170 -0
  349. hydpy/cythons/autogen/c_wq_trapeze.pyx +400 -0
  350. hydpy/cythons/autogen/c_wq_trapeze_strickler.cp313-win_amd64.pyd +0 -0
  351. hydpy/cythons/autogen/c_wq_trapeze_strickler.pxd +243 -0
  352. hydpy/cythons/autogen/c_wq_trapeze_strickler.pyx +578 -0
  353. hydpy/cythons/autogen/c_wq_walrus.cp313-win_amd64.pyd +0 -0
  354. hydpy/cythons/autogen/c_wq_walrus.pxd +61 -0
  355. hydpy/cythons/autogen/c_wq_walrus.pyx +82 -0
  356. hydpy/cythons/autogen/configutils.cp313-win_amd64.pyd +0 -0
  357. hydpy/cythons/autogen/configutils.pxd +17 -0
  358. hydpy/cythons/autogen/configutils.pyx +119 -0
  359. hydpy/cythons/autogen/interfaceutils.cp313-win_amd64.pyd +0 -0
  360. hydpy/cythons/autogen/interfaceutils.pxd +31 -0
  361. hydpy/cythons/autogen/interfaceutils.pyx +82 -0
  362. hydpy/cythons/autogen/interputils.cp313-win_amd64.pyd +0 -0
  363. hydpy/cythons/autogen/interputils.pxd +42 -0
  364. hydpy/cythons/autogen/interputils.pyx +118 -0
  365. hydpy/cythons/autogen/masterinterface.cp313-win_amd64.pyd +0 -0
  366. hydpy/cythons/autogen/masterinterface.pxd +153 -0
  367. hydpy/cythons/autogen/masterinterface.pyx +222 -0
  368. hydpy/cythons/autogen/pointerutils.cp313-win_amd64.pyd +0 -0
  369. hydpy/cythons/autogen/pointerutils.pxd +31 -0
  370. hydpy/cythons/autogen/pointerutils.pyx +650 -0
  371. hydpy/cythons/autogen/ppolyutils.cp313-win_amd64.pyd +0 -0
  372. hydpy/cythons/autogen/ppolyutils.pxd +35 -0
  373. hydpy/cythons/autogen/ppolyutils.pyx +59 -0
  374. hydpy/cythons/autogen/quadutils.cp313-win_amd64.pyd +0 -0
  375. hydpy/cythons/autogen/quadutils.pxd +26 -0
  376. hydpy/cythons/autogen/quadutils.pyx +973 -0
  377. hydpy/cythons/autogen/rootutils.cp313-win_amd64.pyd +0 -0
  378. hydpy/cythons/autogen/rootutils.pxd +28 -0
  379. hydpy/cythons/autogen/rootutils.pyx +109 -0
  380. hydpy/cythons/autogen/sequenceutils.cp313-win_amd64.pyd +0 -0
  381. hydpy/cythons/autogen/sequenceutils.pxd +45 -0
  382. hydpy/cythons/autogen/sequenceutils.pyx +101 -0
  383. hydpy/cythons/autogen/smoothutils.cp313-win_amd64.pyd +0 -0
  384. hydpy/cythons/autogen/smoothutils.pxd +29 -0
  385. hydpy/cythons/autogen/smoothutils.pyx +833 -0
  386. hydpy/cythons/configutils.pxd +8 -0
  387. hydpy/cythons/configutils.pyi +5 -0
  388. hydpy/cythons/configutils.pyx +110 -0
  389. hydpy/cythons/interfaceutils.pxd +22 -0
  390. hydpy/cythons/interfaceutils.pyi +15 -0
  391. hydpy/cythons/interfaceutils.pyx +73 -0
  392. hydpy/cythons/interputils.pxd +33 -0
  393. hydpy/cythons/interputils.pyi +32 -0
  394. hydpy/cythons/interputils.pyx +109 -0
  395. hydpy/cythons/modelutils.py +2990 -0
  396. hydpy/cythons/pointerutils.pxd +22 -0
  397. hydpy/cythons/pointerutils.pyi +89 -0
  398. hydpy/cythons/pointerutils.pyx +641 -0
  399. hydpy/cythons/ppolyutils.pxd +26 -0
  400. hydpy/cythons/ppolyutils.pyi +21 -0
  401. hydpy/cythons/ppolyutils.pyx +50 -0
  402. hydpy/cythons/quadutils.pxd +17 -0
  403. hydpy/cythons/quadutils.pyi +13 -0
  404. hydpy/cythons/quadutils.pyx +964 -0
  405. hydpy/cythons/rootutils.pxd +19 -0
  406. hydpy/cythons/rootutils.pyi +21 -0
  407. hydpy/cythons/rootutils.pyx +100 -0
  408. hydpy/cythons/sequenceutils.pxd +36 -0
  409. hydpy/cythons/sequenceutils.pyi +7 -0
  410. hydpy/cythons/sequenceutils.pyx +92 -0
  411. hydpy/cythons/smoothutils.pxd +20 -0
  412. hydpy/cythons/smoothutils.pyi +15 -0
  413. hydpy/cythons/smoothutils.pyx +824 -0
  414. hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/land_dill_assl.py +13 -0
  415. hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/land_lahn_kalk.py +13 -0
  416. hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/land_lahn_leun.py +14 -0
  417. hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/land_lahn_marb.py +13 -0
  418. hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/stream_dill_assl_lahn_leun.py +5 -0
  419. hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/stream_lahn_leun_lahn_kalk.py +5 -0
  420. hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/stream_lahn_marb_lahn_leun.py +5 -0
  421. hydpy/data/HydPy-H-Lahn/control/default/land.py +9 -0
  422. hydpy/data/HydPy-H-Lahn/control/default/land_dill_assl.py +57 -0
  423. hydpy/data/HydPy-H-Lahn/control/default/land_lahn_kalk.py +57 -0
  424. hydpy/data/HydPy-H-Lahn/control/default/land_lahn_leun.py +56 -0
  425. hydpy/data/HydPy-H-Lahn/control/default/land_lahn_marb.py +57 -0
  426. hydpy/data/HydPy-H-Lahn/control/default/stream_dill_assl_lahn_leun.py +7 -0
  427. hydpy/data/HydPy-H-Lahn/control/default/stream_lahn_leun_lahn_kalk.py +7 -0
  428. hydpy/data/HydPy-H-Lahn/control/default/stream_lahn_marb_lahn_leun.py +7 -0
  429. hydpy/data/HydPy-H-Lahn/multiple_runs.xml +309 -0
  430. hydpy/data/HydPy-H-Lahn/multiple_runs_alpha.xml +71 -0
  431. hydpy/data/HydPy-H-Lahn/network/default/headwaters.py +11 -0
  432. hydpy/data/HydPy-H-Lahn/network/default/nonheadwaters.py +11 -0
  433. hydpy/data/HydPy-H-Lahn/network/default/streams.py +8 -0
  434. hydpy/data/HydPy-H-Lahn/series/default/dill_assl_obs_q.asc +11387 -0
  435. hydpy/data/HydPy-H-Lahn/series/default/evap_pet_hbv96_input_normalairtemperature.nc +0 -0
  436. hydpy/data/HydPy-H-Lahn/series/default/evap_pet_hbv96_input_normalevapotranspiration.nc +0 -0
  437. hydpy/data/HydPy-H-Lahn/series/default/hland_96_input_p.nc +0 -0
  438. hydpy/data/HydPy-H-Lahn/series/default/hland_96_input_t.nc +0 -0
  439. hydpy/data/HydPy-H-Lahn/series/default/lahn_kalk_obs_q.asc +11387 -0
  440. hydpy/data/HydPy-H-Lahn/series/default/lahn_leun_obs_q.asc +11387 -0
  441. hydpy/data/HydPy-H-Lahn/series/default/lahn_marb_obs_q.asc +11387 -0
  442. hydpy/data/HydPy-H-Lahn/series/default/land_dill_assl_evap_pet_hbv96_input_normalairtemperature.asc +11387 -0
  443. hydpy/data/HydPy-H-Lahn/series/default/land_dill_assl_evap_pet_hbv96_input_normalevapotranspiration.asc +11387 -0
  444. hydpy/data/HydPy-H-Lahn/series/default/land_dill_assl_hland_96_input_p.asc +11387 -0
  445. hydpy/data/HydPy-H-Lahn/series/default/land_dill_assl_hland_96_input_t.asc +11387 -0
  446. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_kalk_evap_pet_hbv96_input_normalairtemperature.asc +11387 -0
  447. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_kalk_evap_pet_hbv96_input_normalevapotranspiration.asc +11387 -0
  448. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_kalk_hland_96_input_p.asc +11387 -0
  449. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_kalk_hland_96_input_t.asc +11387 -0
  450. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_leun_evap_pet_hbv96_input_normalairtemperature.asc +11387 -0
  451. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_leun_evap_pet_hbv96_input_normalevapotranspiration.asc +11387 -0
  452. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_leun_hland_96_input_p.asc +11387 -0
  453. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_leun_hland_96_input_t.asc +11387 -0
  454. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_marb_evap_pet_hbv96_input_normalairtemperature.asc +11387 -0
  455. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_marb_evap_pet_hbv96_input_normalevapotranspiration.asc +11387 -0
  456. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_marb_hland_96_input_p.asc +11387 -0
  457. hydpy/data/HydPy-H-Lahn/series/default/land_lahn_marb_hland_96_input_t.asc +11387 -0
  458. hydpy/data/HydPy-H-Lahn/series/default/obs_q.nc +0 -0
  459. hydpy/data/HydPy-H-Lahn/single_run.xml +152 -0
  460. hydpy/data/HydPy-H-Lahn/single_run.xmlt +143 -0
  461. hydpy/data/__init__.py +17 -0
  462. hydpy/docs/__init__.py +0 -0
  463. hydpy/docs/autofigs/__init__.py +0 -0
  464. hydpy/docs/bib/__init__.py +0 -0
  465. hydpy/docs/bib/refs.bib +566 -0
  466. hydpy/docs/combine_docversions.py +133 -0
  467. hydpy/docs/draw_model_sketches.py +1301 -0
  468. hydpy/docs/enable_autodoc.py +7 -0
  469. hydpy/docs/figs/HydPy-G-GR4.png +0 -0
  470. hydpy/docs/figs/HydPy-G-GR5.png +0 -0
  471. hydpy/docs/figs/HydPy-G-GR6.png +0 -0
  472. hydpy/docs/figs/HydPy-H-HBV96-COSERO.png +0 -0
  473. hydpy/docs/figs/HydPy-H-HBV96-PREVAH.png +0 -0
  474. hydpy/docs/figs/HydPy-H-HBV96.png +0 -0
  475. hydpy/docs/figs/HydPy-H-Lahn.png +0 -0
  476. hydpy/docs/figs/HydPy-KinW-Williams.png +0 -0
  477. hydpy/docs/figs/HydPy-L-DD.png +0 -0
  478. hydpy/docs/figs/HydPy-W-Wag.png +0 -0
  479. hydpy/docs/figs/HydPy_Logo.png +0 -0
  480. hydpy/docs/figs/HydPy_Logo_Text.png +0 -0
  481. hydpy/docs/figs/IDLE-editor.png +0 -0
  482. hydpy/docs/figs/IDLE-shell.png +0 -0
  483. hydpy/docs/figs/LAWA_river-basin-bumbers.png +0 -0
  484. hydpy/docs/figs/__init__.py +0 -0
  485. hydpy/docs/html_/__init__.py +0 -0
  486. hydpy/docs/polish_html.py +57 -0
  487. hydpy/docs/prepare.py +224 -0
  488. hydpy/docs/publish_docs.py +53 -0
  489. hydpy/docs/rst/HydPy-ARMA.rst +27 -0
  490. hydpy/docs/rst/HydPy-Conv.rst +22 -0
  491. hydpy/docs/rst/HydPy-Dam.rst +79 -0
  492. hydpy/docs/rst/HydPy-Dummy.rst +21 -0
  493. hydpy/docs/rst/HydPy-Evap.rst +26 -0
  494. hydpy/docs/rst/HydPy-Exch.rst +36 -0
  495. hydpy/docs/rst/HydPy-G.rst +40 -0
  496. hydpy/docs/rst/HydPy-GA.rst +34 -0
  497. hydpy/docs/rst/HydPy-H.rst +24 -0
  498. hydpy/docs/rst/HydPy-KinW.rst +32 -0
  499. hydpy/docs/rst/HydPy-L.rst +42 -0
  500. hydpy/docs/rst/HydPy-Meteo.rst +28 -0
  501. hydpy/docs/rst/HydPy-Musk.rst +21 -0
  502. hydpy/docs/rst/HydPy-Rconc.rst +17 -0
  503. hydpy/docs/rst/HydPy-SW1D.rst +49 -0
  504. hydpy/docs/rst/HydPy-Test.rst +19 -0
  505. hydpy/docs/rst/HydPy-W.rst +20 -0
  506. hydpy/docs/rst/HydPy-WHMod.rst +19 -0
  507. hydpy/docs/rst/HydPy-WQ.rst +20 -0
  508. hydpy/docs/rst/__init__.py +0 -0
  509. hydpy/docs/rst/additional_repositories.rst +40 -0
  510. hydpy/docs/rst/auxiliaries.rst +31 -0
  511. hydpy/docs/rst/continuous_integration.rst +75 -0
  512. hydpy/docs/rst/core.rst +75 -0
  513. hydpy/docs/rst/cythons.rst +47 -0
  514. hydpy/docs/rst/definitions.rst +506 -0
  515. hydpy/docs/rst/developer_guide.rst +54 -0
  516. hydpy/docs/rst/example_projects.rst +40 -0
  517. hydpy/docs/rst/execution.rst +22 -0
  518. hydpy/docs/rst/framework_tools.rst +56 -0
  519. hydpy/docs/rst/how_to_read_the_reference_manual.rst +156 -0
  520. hydpy/docs/rst/hydpydependencies.rst +55 -0
  521. hydpy/docs/rst/index.rst +125 -0
  522. hydpy/docs/rst/installation.rst +155 -0
  523. hydpy/docs/rst/model_families.rst +79 -0
  524. hydpy/docs/rst/model_overview.rst +291 -0
  525. hydpy/docs/rst/modelimports.rst +10 -0
  526. hydpy/docs/rst/options.rst +119 -0
  527. hydpy/docs/rst/programming_style.rst +572 -0
  528. hydpy/docs/rst/project_structure.rst +520 -0
  529. hydpy/docs/rst/quickstart.rst +304 -0
  530. hydpy/docs/rst/reference_manual.rst +29 -0
  531. hydpy/docs/rst/required_tools.rst +50 -0
  532. hydpy/docs/rst/simulation.rst +514 -0
  533. hydpy/docs/rst/submodel_interfaces.rst +32 -0
  534. hydpy/docs/rst/tests_and_documentation.rst +85 -0
  535. hydpy/docs/rst/user_guide.rst +38 -0
  536. hydpy/docs/rst/version_control.rst +116 -0
  537. hydpy/docs/rst/zbibliography.rst +8 -0
  538. hydpy/docs/sphinx/__init__.py +0 -0
  539. hydpy/docs/sphinx/_themes/basic_hydpy/changes/frameset.html +11 -0
  540. hydpy/docs/sphinx/_themes/basic_hydpy/changes/rstsource.html +15 -0
  541. hydpy/docs/sphinx/_themes/basic_hydpy/changes/versionchanges.html +33 -0
  542. hydpy/docs/sphinx/_themes/basic_hydpy/defindex.html +35 -0
  543. hydpy/docs/sphinx/_themes/basic_hydpy/domainindex.html +56 -0
  544. hydpy/docs/sphinx/_themes/basic_hydpy/genindex-single.html +63 -0
  545. hydpy/docs/sphinx/_themes/basic_hydpy/genindex-split.html +41 -0
  546. hydpy/docs/sphinx/_themes/basic_hydpy/genindex.html +76 -0
  547. hydpy/docs/sphinx/_themes/basic_hydpy/globaltoc.html +11 -0
  548. hydpy/docs/sphinx/_themes/basic_hydpy/layout.html +221 -0
  549. hydpy/docs/sphinx/_themes/basic_hydpy/localtoc.html +15 -0
  550. hydpy/docs/sphinx/_themes/basic_hydpy/opensearch.xml +13 -0
  551. hydpy/docs/sphinx/_themes/basic_hydpy/page.html +13 -0
  552. hydpy/docs/sphinx/_themes/basic_hydpy/relations.html +23 -0
  553. hydpy/docs/sphinx/_themes/basic_hydpy/search.html +65 -0
  554. hydpy/docs/sphinx/_themes/basic_hydpy/searchbox.html +21 -0
  555. hydpy/docs/sphinx/_themes/basic_hydpy/searchfield.html +23 -0
  556. hydpy/docs/sphinx/_themes/basic_hydpy/sourcelink.html +18 -0
  557. hydpy/docs/sphinx/_themes/basic_hydpy/static/basic.css_t +925 -0
  558. hydpy/docs/sphinx/_themes/basic_hydpy/static/doctools.js +156 -0
  559. hydpy/docs/sphinx/_themes/basic_hydpy/static/documentation_options.js_t +13 -0
  560. hydpy/docs/sphinx/_themes/basic_hydpy/static/file.png +0 -0
  561. hydpy/docs/sphinx/_themes/basic_hydpy/static/language_data.js_t +26 -0
  562. hydpy/docs/sphinx/_themes/basic_hydpy/static/minus.png +0 -0
  563. hydpy/docs/sphinx/_themes/basic_hydpy/static/plus.png +0 -0
  564. hydpy/docs/sphinx/_themes/basic_hydpy/static/searchtools.js +574 -0
  565. hydpy/docs/sphinx/_themes/basic_hydpy/static/sphinx_highlight.js +154 -0
  566. hydpy/docs/sphinx/_themes/basic_hydpy/theme.conf +16 -0
  567. hydpy/docs/sphinx/_themes/classic_hydpy/layout.html +23 -0
  568. hydpy/docs/sphinx/_themes/classic_hydpy/static/classic.css_t +358 -0
  569. hydpy/docs/sphinx/_themes/classic_hydpy/static/sidebar.js_t +72 -0
  570. hydpy/docs/sphinx/_themes/classic_hydpy/theme.conf +32 -0
  571. hydpy/docs/sphinx/conf.py +398 -0
  572. hydpy/docs/sphinx/defaultlinks_extension.py +36 -0
  573. hydpy/docs/sphinx/integrationtest_extension.py +104 -0
  574. hydpy/docs/sphinx/projectstructure_extension.py +58 -0
  575. hydpy/docs/sphinx/submodelgraph_extension.py +53 -0
  576. hydpy/exe/__init__.py +0 -0
  577. hydpy/exe/commandtools.py +651 -0
  578. hydpy/exe/hyd.py +277 -0
  579. hydpy/exe/modelimports.py +41 -0
  580. hydpy/exe/replacetools.py +216 -0
  581. hydpy/exe/servertools.py +2348 -0
  582. hydpy/exe/xmltools.py +3280 -0
  583. hydpy/interfaces/__init__.py +0 -0
  584. hydpy/interfaces/aetinterfaces.py +94 -0
  585. hydpy/interfaces/dischargeinterfaces.py +45 -0
  586. hydpy/interfaces/petinterfaces.py +117 -0
  587. hydpy/interfaces/precipinterfaces.py +42 -0
  588. hydpy/interfaces/radiationinterfaces.py +79 -0
  589. hydpy/interfaces/rconcinterfaces.py +30 -0
  590. hydpy/interfaces/routinginterfaces.py +324 -0
  591. hydpy/interfaces/soilinterfaces.py +96 -0
  592. hydpy/interfaces/stateinterfaces.py +98 -0
  593. hydpy/interfaces/tempinterfaces.py +46 -0
  594. hydpy/models/__init__.py +0 -0
  595. hydpy/models/arma/__init__.py +14 -0
  596. hydpy/models/arma/arma_control.py +383 -0
  597. hydpy/models/arma/arma_derived.py +204 -0
  598. hydpy/models/arma/arma_fluxes.py +41 -0
  599. hydpy/models/arma/arma_inlets.py +11 -0
  600. hydpy/models/arma/arma_logs.py +19 -0
  601. hydpy/models/arma/arma_model.py +461 -0
  602. hydpy/models/arma/arma_outlets.py +11 -0
  603. hydpy/models/arma_rimorido.py +381 -0
  604. hydpy/models/conv/__init__.py +12 -0
  605. hydpy/models/conv/conv_control.py +303 -0
  606. hydpy/models/conv/conv_derived.py +271 -0
  607. hydpy/models/conv/conv_fluxes.py +54 -0
  608. hydpy/models/conv/conv_inlets.py +11 -0
  609. hydpy/models/conv/conv_model.py +687 -0
  610. hydpy/models/conv/conv_outlets.py +11 -0
  611. hydpy/models/conv_idw.py +120 -0
  612. hydpy/models/conv_idw_ed.py +184 -0
  613. hydpy/models/conv_nn.py +112 -0
  614. hydpy/models/dam/__init__.py +16 -0
  615. hydpy/models/dam/dam_aides.py +17 -0
  616. hydpy/models/dam/dam_control.py +346 -0
  617. hydpy/models/dam/dam_derived.py +559 -0
  618. hydpy/models/dam/dam_factors.py +46 -0
  619. hydpy/models/dam/dam_fluxes.py +179 -0
  620. hydpy/models/dam/dam_inlets.py +29 -0
  621. hydpy/models/dam/dam_logs.py +52 -0
  622. hydpy/models/dam/dam_model.py +5011 -0
  623. hydpy/models/dam/dam_outlets.py +23 -0
  624. hydpy/models/dam/dam_receivers.py +41 -0
  625. hydpy/models/dam/dam_senders.py +23 -0
  626. hydpy/models/dam/dam_solver.py +75 -0
  627. hydpy/models/dam/dam_states.py +11 -0
  628. hydpy/models/dam_llake.py +499 -0
  629. hydpy/models/dam_lreservoir.py +548 -0
  630. hydpy/models/dam_lretention.py +343 -0
  631. hydpy/models/dam_pump.py +278 -0
  632. hydpy/models/dam_pump_sluice.py +339 -0
  633. hydpy/models/dam_sluice.py +319 -0
  634. hydpy/models/dam_v001.py +1127 -0
  635. hydpy/models/dam_v002.py +381 -0
  636. hydpy/models/dam_v003.py +422 -0
  637. hydpy/models/dam_v004.py +665 -0
  638. hydpy/models/dam_v005.py +479 -0
  639. hydpy/models/dummy/__init__.py +15 -0
  640. hydpy/models/dummy/dummy_control.py +22 -0
  641. hydpy/models/dummy/dummy_fluxes.py +11 -0
  642. hydpy/models/dummy/dummy_inlets.py +11 -0
  643. hydpy/models/dummy/dummy_inputs.py +41 -0
  644. hydpy/models/dummy/dummy_model.py +196 -0
  645. hydpy/models/dummy/dummy_outlets.py +11 -0
  646. hydpy/models/dummy_interceptedwater.py +85 -0
  647. hydpy/models/dummy_node2node.py +83 -0
  648. hydpy/models/dummy_snowalbedo.py +84 -0
  649. hydpy/models/dummy_snowcover.py +84 -0
  650. hydpy/models/dummy_snowycanopy.py +86 -0
  651. hydpy/models/dummy_soilwater.py +85 -0
  652. hydpy/models/evap/__init__.py +13 -0
  653. hydpy/models/evap/evap_control.py +354 -0
  654. hydpy/models/evap/evap_derived.py +236 -0
  655. hydpy/models/evap/evap_factors.py +188 -0
  656. hydpy/models/evap/evap_fixed.py +68 -0
  657. hydpy/models/evap/evap_fluxes.py +150 -0
  658. hydpy/models/evap/evap_inputs.py +54 -0
  659. hydpy/models/evap/evap_logs.py +91 -0
  660. hydpy/models/evap/evap_masks.py +48 -0
  661. hydpy/models/evap/evap_model.py +9170 -0
  662. hydpy/models/evap/evap_parameters.py +149 -0
  663. hydpy/models/evap/evap_sequences.py +32 -0
  664. hydpy/models/evap/evap_states.py +18 -0
  665. hydpy/models/evap_aet_hbv96.py +372 -0
  666. hydpy/models/evap_aet_minhas.py +331 -0
  667. hydpy/models/evap_aet_morsim.py +627 -0
  668. hydpy/models/evap_pet_ambav1.py +483 -0
  669. hydpy/models/evap_pet_hbv96.py +147 -0
  670. hydpy/models/evap_pet_m.py +94 -0
  671. hydpy/models/evap_pet_mlc.py +107 -0
  672. hydpy/models/evap_ret_fao56.py +265 -0
  673. hydpy/models/evap_ret_io.py +74 -0
  674. hydpy/models/evap_ret_tw2002.py +165 -0
  675. hydpy/models/exch/__init__.py +14 -0
  676. hydpy/models/exch/exch_control.py +262 -0
  677. hydpy/models/exch/exch_derived.py +36 -0
  678. hydpy/models/exch/exch_factors.py +26 -0
  679. hydpy/models/exch/exch_fluxes.py +48 -0
  680. hydpy/models/exch/exch_inlets.py +11 -0
  681. hydpy/models/exch/exch_logs.py +12 -0
  682. hydpy/models/exch/exch_model.py +451 -0
  683. hydpy/models/exch/exch_outlets.py +17 -0
  684. hydpy/models/exch/exch_receivers.py +17 -0
  685. hydpy/models/exch_branch_hbv96.py +186 -0
  686. hydpy/models/exch_waterlevel.py +73 -0
  687. hydpy/models/exch_weir_hbv96.py +609 -0
  688. hydpy/models/ga/__init__.py +14 -0
  689. hydpy/models/ga/ga_aides.py +17 -0
  690. hydpy/models/ga/ga_control.py +208 -0
  691. hydpy/models/ga/ga_derived.py +77 -0
  692. hydpy/models/ga/ga_fluxes.py +83 -0
  693. hydpy/models/ga/ga_inputs.py +26 -0
  694. hydpy/models/ga/ga_logs.py +17 -0
  695. hydpy/models/ga/ga_model.py +2952 -0
  696. hydpy/models/ga/ga_states.py +87 -0
  697. hydpy/models/ga_garto.py +1001 -0
  698. hydpy/models/ga_garto_submodel1.py +79 -0
  699. hydpy/models/gland/__init__.py +14 -0
  700. hydpy/models/gland/gland_control.py +90 -0
  701. hydpy/models/gland/gland_derived.py +113 -0
  702. hydpy/models/gland/gland_fluxes.py +137 -0
  703. hydpy/models/gland/gland_inputs.py +12 -0
  704. hydpy/models/gland/gland_model.py +1439 -0
  705. hydpy/models/gland/gland_outlets.py +11 -0
  706. hydpy/models/gland/gland_states.py +90 -0
  707. hydpy/models/gland_gr4.py +501 -0
  708. hydpy/models/gland_gr5.py +463 -0
  709. hydpy/models/gland_gr6.py +487 -0
  710. hydpy/models/hland/__init__.py +20 -0
  711. hydpy/models/hland/hland_aides.py +19 -0
  712. hydpy/models/hland/hland_constants.py +37 -0
  713. hydpy/models/hland/hland_control.py +1530 -0
  714. hydpy/models/hland/hland_derived.py +683 -0
  715. hydpy/models/hland/hland_factors.py +57 -0
  716. hydpy/models/hland/hland_fixed.py +42 -0
  717. hydpy/models/hland/hland_fluxes.py +279 -0
  718. hydpy/models/hland/hland_inputs.py +19 -0
  719. hydpy/models/hland/hland_masks.py +107 -0
  720. hydpy/models/hland/hland_model.py +4664 -0
  721. hydpy/models/hland/hland_outlets.py +11 -0
  722. hydpy/models/hland/hland_parameters.py +227 -0
  723. hydpy/models/hland/hland_sequences.py +382 -0
  724. hydpy/models/hland/hland_states.py +236 -0
  725. hydpy/models/hland_96.py +1812 -0
  726. hydpy/models/hland_96c.py +1196 -0
  727. hydpy/models/hland_96p.py +1204 -0
  728. hydpy/models/kinw/__init__.py +18 -0
  729. hydpy/models/kinw/kinw_aides.py +306 -0
  730. hydpy/models/kinw/kinw_control.py +270 -0
  731. hydpy/models/kinw/kinw_derived.py +197 -0
  732. hydpy/models/kinw/kinw_fixed.py +33 -0
  733. hydpy/models/kinw/kinw_fluxes.py +37 -0
  734. hydpy/models/kinw/kinw_inlets.py +11 -0
  735. hydpy/models/kinw/kinw_model.py +3026 -0
  736. hydpy/models/kinw/kinw_outlets.py +11 -0
  737. hydpy/models/kinw/kinw_solver.py +45 -0
  738. hydpy/models/kinw/kinw_states.py +17 -0
  739. hydpy/models/kinw_williams.py +1299 -0
  740. hydpy/models/kinw_williams_ext.py +768 -0
  741. hydpy/models/lland/__init__.py +42 -0
  742. hydpy/models/lland/lland_aides.py +38 -0
  743. hydpy/models/lland/lland_constants.py +88 -0
  744. hydpy/models/lland/lland_control.py +1329 -0
  745. hydpy/models/lland/lland_derived.py +380 -0
  746. hydpy/models/lland/lland_factors.py +18 -0
  747. hydpy/models/lland/lland_fixed.py +128 -0
  748. hydpy/models/lland/lland_fluxes.py +626 -0
  749. hydpy/models/lland/lland_inlets.py +12 -0
  750. hydpy/models/lland/lland_inputs.py +33 -0
  751. hydpy/models/lland/lland_logs.py +17 -0
  752. hydpy/models/lland/lland_masks.py +212 -0
  753. hydpy/models/lland/lland_model.py +7690 -0
  754. hydpy/models/lland/lland_outlets.py +12 -0
  755. hydpy/models/lland/lland_parameters.py +195 -0
  756. hydpy/models/lland/lland_sequences.py +67 -0
  757. hydpy/models/lland/lland_states.py +280 -0
  758. hydpy/models/lland_dd.py +2270 -0
  759. hydpy/models/lland_knauf.py +2156 -0
  760. hydpy/models/lland_knauf_ic.py +1920 -0
  761. hydpy/models/meteo/__init__.py +12 -0
  762. hydpy/models/meteo/meteo_control.py +154 -0
  763. hydpy/models/meteo/meteo_derived.py +159 -0
  764. hydpy/models/meteo/meteo_factors.py +88 -0
  765. hydpy/models/meteo/meteo_fixed.py +19 -0
  766. hydpy/models/meteo/meteo_fluxes.py +46 -0
  767. hydpy/models/meteo/meteo_inputs.py +47 -0
  768. hydpy/models/meteo/meteo_logs.py +30 -0
  769. hydpy/models/meteo/meteo_model.py +2904 -0
  770. hydpy/models/meteo/meteo_parameters.py +14 -0
  771. hydpy/models/meteo/meteo_sequences.py +22 -0
  772. hydpy/models/meteo_clear_glob_io.py +77 -0
  773. hydpy/models/meteo_glob_fao56.py +217 -0
  774. hydpy/models/meteo_glob_io.py +68 -0
  775. hydpy/models/meteo_glob_morsim.py +444 -0
  776. hydpy/models/meteo_precip_io.py +76 -0
  777. hydpy/models/meteo_psun_sun_glob_io.py +83 -0
  778. hydpy/models/meteo_sun_fao56.py +188 -0
  779. hydpy/models/meteo_sun_morsim.py +466 -0
  780. hydpy/models/meteo_temp_io.py +76 -0
  781. hydpy/models/musk/__init__.py +15 -0
  782. hydpy/models/musk/musk_control.py +328 -0
  783. hydpy/models/musk/musk_derived.py +32 -0
  784. hydpy/models/musk/musk_factors.py +53 -0
  785. hydpy/models/musk/musk_fluxes.py +24 -0
  786. hydpy/models/musk/musk_inlets.py +11 -0
  787. hydpy/models/musk/musk_masks.py +15 -0
  788. hydpy/models/musk/musk_model.py +838 -0
  789. hydpy/models/musk/musk_outlets.py +11 -0
  790. hydpy/models/musk/musk_sequences.py +88 -0
  791. hydpy/models/musk/musk_solver.py +68 -0
  792. hydpy/models/musk/musk_states.py +64 -0
  793. hydpy/models/musk_classic.py +228 -0
  794. hydpy/models/musk_mct.py +1247 -0
  795. hydpy/models/rconc/__init__.py +12 -0
  796. hydpy/models/rconc/rconc_control.py +473 -0
  797. hydpy/models/rconc/rconc_derived.py +76 -0
  798. hydpy/models/rconc/rconc_fluxes.py +19 -0
  799. hydpy/models/rconc/rconc_logs.py +74 -0
  800. hydpy/models/rconc/rconc_model.py +260 -0
  801. hydpy/models/rconc/rconc_states.py +11 -0
  802. hydpy/models/rconc_nash.py +48 -0
  803. hydpy/models/rconc_uh.py +53 -0
  804. hydpy/models/sw1d/__init__.py +17 -0
  805. hydpy/models/sw1d/sw1d_control.py +356 -0
  806. hydpy/models/sw1d/sw1d_derived.py +85 -0
  807. hydpy/models/sw1d/sw1d_factors.py +78 -0
  808. hydpy/models/sw1d/sw1d_fixed.py +12 -0
  809. hydpy/models/sw1d/sw1d_fluxes.py +55 -0
  810. hydpy/models/sw1d/sw1d_inlets.py +17 -0
  811. hydpy/models/sw1d/sw1d_model.py +3385 -0
  812. hydpy/models/sw1d/sw1d_outlets.py +11 -0
  813. hydpy/models/sw1d/sw1d_receivers.py +11 -0
  814. hydpy/models/sw1d/sw1d_senders.py +11 -0
  815. hydpy/models/sw1d/sw1d_states.py +23 -0
  816. hydpy/models/sw1d_channel.py +2051 -0
  817. hydpy/models/sw1d_gate_out.py +599 -0
  818. hydpy/models/sw1d_lias.py +105 -0
  819. hydpy/models/sw1d_lias_sluice.py +531 -0
  820. hydpy/models/sw1d_network.py +1219 -0
  821. hydpy/models/sw1d_pump.py +448 -0
  822. hydpy/models/sw1d_q_in.py +79 -0
  823. hydpy/models/sw1d_q_out.py +81 -0
  824. hydpy/models/sw1d_storage.py +78 -0
  825. hydpy/models/sw1d_weir_out.py +75 -0
  826. hydpy/models/test/__init__.py +14 -0
  827. hydpy/models/test/test_control.py +28 -0
  828. hydpy/models/test/test_fluxes.py +17 -0
  829. hydpy/models/test/test_model.py +201 -0
  830. hydpy/models/test/test_solver.py +48 -0
  831. hydpy/models/test/test_states.py +17 -0
  832. hydpy/models/test_discontinous.py +46 -0
  833. hydpy/models/test_stiff0d.py +47 -0
  834. hydpy/models/test_stiff1d.py +42 -0
  835. hydpy/models/whmod/__init__.py +21 -0
  836. hydpy/models/whmod/whmod_constants.py +77 -0
  837. hydpy/models/whmod/whmod_control.py +333 -0
  838. hydpy/models/whmod/whmod_derived.py +210 -0
  839. hydpy/models/whmod/whmod_factors.py +9 -0
  840. hydpy/models/whmod/whmod_fluxes.py +105 -0
  841. hydpy/models/whmod/whmod_inputs.py +15 -0
  842. hydpy/models/whmod/whmod_masks.py +178 -0
  843. hydpy/models/whmod/whmod_model.py +2091 -0
  844. hydpy/models/whmod/whmod_parameters.py +155 -0
  845. hydpy/models/whmod/whmod_sequences.py +193 -0
  846. hydpy/models/whmod/whmod_states.py +73 -0
  847. hydpy/models/whmod_rural.py +794 -0
  848. hydpy/models/whmod_urban.py +1011 -0
  849. hydpy/models/wland/__init__.py +43 -0
  850. hydpy/models/wland/wland_aides.py +55 -0
  851. hydpy/models/wland/wland_constants.py +103 -0
  852. hydpy/models/wland/wland_control.py +508 -0
  853. hydpy/models/wland/wland_derived.py +330 -0
  854. hydpy/models/wland/wland_factors.py +11 -0
  855. hydpy/models/wland/wland_fixed.py +12 -0
  856. hydpy/models/wland/wland_fluxes.py +166 -0
  857. hydpy/models/wland/wland_inputs.py +33 -0
  858. hydpy/models/wland/wland_masks.py +54 -0
  859. hydpy/models/wland/wland_model.py +3755 -0
  860. hydpy/models/wland/wland_outlets.py +11 -0
  861. hydpy/models/wland/wland_parameters.py +214 -0
  862. hydpy/models/wland/wland_sequences.py +108 -0
  863. hydpy/models/wland/wland_solver.py +45 -0
  864. hydpy/models/wland/wland_states.py +56 -0
  865. hydpy/models/wland_gd.py +888 -0
  866. hydpy/models/wland_wag.py +1244 -0
  867. hydpy/models/wq/__init__.py +14 -0
  868. hydpy/models/wq/wq_control.py +117 -0
  869. hydpy/models/wq/wq_derived.py +182 -0
  870. hydpy/models/wq/wq_factors.py +79 -0
  871. hydpy/models/wq/wq_fluxes.py +17 -0
  872. hydpy/models/wq/wq_model.py +1889 -0
  873. hydpy/models/wq_trapeze.py +168 -0
  874. hydpy/models/wq_trapeze_strickler.py +101 -0
  875. hydpy/models/wq_walrus.py +57 -0
  876. hydpy/py.typed +0 -0
  877. hydpy/tests/.coveragerc +22 -0
  878. hydpy/tests/__init__.py +0 -0
  879. hydpy/tests/check_consistency.py +32 -0
  880. hydpy/tests/hydpydoctestcustomize.pth +1 -0
  881. hydpy/tests/hydpydoctestcustomize.py +15 -0
  882. hydpy/tests/iotesting/__init__.py +0 -0
  883. hydpy/tests/run_doctests.py +233 -0
  884. hydpy-6.2.dev1.data/scripts/hyd.py +277 -0
  885. hydpy-6.2.dev1.dist-info/LICENSE +165 -0
  886. hydpy-6.2.dev1.dist-info/METADATA +163 -0
  887. hydpy-6.2.dev1.dist-info/RECORD +890 -0
  888. hydpy-6.2.dev1.dist-info/WHEEL +5 -0
  889. hydpy-6.2.dev1.dist-info/licenses_hydpy_installer.txt +42 -0
  890. hydpy-6.2.dev1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2904 @@
1
+ """
2
+ .. _`solar time`: https://en.wikipedia.org/wiki/Solar_time
3
+ """
4
+
5
+ # imports...
6
+ # ...from standard library
7
+ import contextlib
8
+
9
+ # ...from HydPy
10
+ from hydpy.core import importtools
11
+ from hydpy.core import modeltools
12
+ from hydpy.core.typingtools import *
13
+ from hydpy.cythons import modelutils
14
+ from hydpy.models.meteo import meteo_parameters
15
+ from hydpy.models.meteo import meteo_fixed
16
+ from hydpy.models.meteo import meteo_control
17
+ from hydpy.models.meteo import meteo_derived
18
+ from hydpy.models.meteo import meteo_sequences
19
+ from hydpy.models.meteo import meteo_inputs
20
+ from hydpy.models.meteo import meteo_factors
21
+ from hydpy.models.meteo import meteo_fluxes
22
+ from hydpy.models.meteo import meteo_logs
23
+
24
+
25
+ class Calc_EarthSunDistance_V1(modeltools.Method):
26
+ r"""Calculate the relative inverse distance between the Earth and the sun
27
+ according to :cite:t:`ref-Allen1998`.
28
+
29
+ Basic equation (:cite:t:`ref-Allen1998`, equation 23):
30
+ :math:`EarthSunDistance = 1 + 0.033 \cdot cos(2 \cdot Pi / 366 \cdot (DOY + 1)`
31
+
32
+ Note that this equation differs slightly from the one given by
33
+ :cite:t:`ref-Allen1998`. The following examples show that
34
+ |Calc_EarthSunDistance_V1| calculates the same distance value for a specific
35
+ "day" (e.g. the 1st March) both for leap years and non-leap years. Hence,
36
+ there is a tiny "jump" between 28th February and 1st March for non-leap years.
37
+
38
+ Examples:
39
+
40
+ We define an initialisation period covering a leap year (2000) and a non-leap
41
+ year (2001):
42
+
43
+ >>> from hydpy.models.meteo import *
44
+ >>> parameterstep()
45
+ >>> from hydpy import pub, round_
46
+ >>> pub.timegrids = "2000-01-01", "2002-01-01", "1d"
47
+ >>> derived.doy.update()
48
+
49
+ The following convenience function applies method |Calc_EarthSunDistance_V1|
50
+ for the given dates and prints the results:
51
+
52
+ >>> def test(*dates):
53
+ ... for date in dates:
54
+ ... model.idx_sim = pub.timegrids.init[date]
55
+ ... model.calc_earthsundistance_v1()
56
+ ... print(date, end=": ")
57
+ ... round_(factors.earthsundistance.value)
58
+
59
+ The results are identical for both years:
60
+
61
+ >>> test("2000-01-01", "2000-02-28", "2000-02-29",
62
+ ... "2000-03-01", "2000-07-01", "2000-12-31")
63
+ 2000-01-01: 1.032995
64
+ 2000-02-28: 1.017471
65
+ 2000-02-29: 1.016988
66
+ 2000-03-01: 1.0165
67
+ 2000-07-01: 0.967
68
+ 2000-12-31: 1.033
69
+
70
+ >>> test("2001-01-01", "2001-02-28",
71
+ ... "2001-03-01", "2001-07-01", "2001-12-31")
72
+ 2001-01-01: 1.032995
73
+ 2001-02-28: 1.017471
74
+ 2001-03-01: 1.0165
75
+ 2001-07-01: 0.967
76
+ 2001-12-31: 1.033
77
+
78
+ The following calculation agrees with example 8 of :cite:t:`ref-Allen1998`:
79
+
80
+ >>> derived.doy(246)
81
+ >>> model.idx_sim = 0
82
+ >>> model.calc_earthsundistance_v1()
83
+ >>> factors.earthsundistance
84
+ earthsundistance(0.984993)
85
+
86
+ .. testsetup::
87
+
88
+ >>> del pub.timegrids
89
+ """
90
+
91
+ FIXEDPARAMETERS = (meteo_fixed.Pi,)
92
+ DERIVEDPARAMETERS = (meteo_derived.DOY,)
93
+ RESULTSEQUENCES = (meteo_factors.EarthSunDistance,)
94
+
95
+ @staticmethod
96
+ def __call__(model: modeltools.Model) -> None:
97
+ fix = model.parameters.fixed.fastaccess
98
+ der = model.parameters.derived.fastaccess
99
+ fac = model.sequences.factors.fastaccess
100
+ fac.earthsundistance = 1.0 + 0.033 * modelutils.cos(
101
+ 2 * fix.pi / 366.0 * (der.doy[model.idx_sim] + 1)
102
+ )
103
+
104
+
105
+ class Calc_SolarDeclination_V1(modeltools.Method):
106
+ r"""Calculate the solar declination according to :cite:t:`ref-Allen1998`.
107
+
108
+ Basic equation (:cite:t:`ref-Allen1998`, equation 24):
109
+ :math:`SolarDeclination =
110
+ 0.409 \cdot sin(2 \cdot Pi / 366 \cdot (DOY + 1) - 1.39)`
111
+
112
+ Note that this equation differs slightly from the one given by
113
+ :cite:t:`ref-Allen1998` due to reasons explained in the documentation on method
114
+ |Calc_EarthSunDistance_V1|.
115
+
116
+ Examples:
117
+
118
+ We define an initialisation period covering both a leap year (2000) and a
119
+ non-leap year (2001):
120
+
121
+ >>> from hydpy.models.meteo import *
122
+ >>> parameterstep()
123
+ >>> from hydpy import pub, round_
124
+ >>> pub.timegrids = "2000-01-01", "2002-01-01", "1d"
125
+ >>> derived.doy.update()
126
+
127
+ The following convenience function applies method |Calc_SolarDeclination_V1|
128
+ for the given dates and prints the results:
129
+
130
+ >>> def test(*dates):
131
+ ... for date in dates:
132
+ ... model.idx_sim = pub.timegrids.init[date]
133
+ ... model.calc_solardeclination_v1()
134
+ ... print(date, end=": ")
135
+ ... round_(factors.solardeclination.value)
136
+
137
+ The results are identical for both years:
138
+
139
+ >>> test("2000-01-01", "2000-02-28", "2000-02-29",
140
+ ... "2000-03-01", "2000-12-31")
141
+ 2000-01-01: -0.401012
142
+ 2000-02-28: -0.150618
143
+ 2000-02-29: -0.144069
144
+ 2000-03-01: -0.137476
145
+ 2000-12-31: -0.402334
146
+
147
+ >>> test("2001-01-01", "2001-02-28",
148
+ ... "2001-03-01", "2001-12-31")
149
+ 2001-01-01: -0.401012
150
+ 2001-02-28: -0.150618
151
+ 2001-03-01: -0.137476
152
+ 2001-12-31: -0.402334
153
+
154
+ The following calculation agrees with example 8 of :cite:t:`ref-Allen1998`:
155
+
156
+ >>> derived.doy(246)
157
+ >>> model.idx_sim = 0
158
+ >>> model.calc_solardeclination_v1()
159
+ >>> factors.solardeclination
160
+ solardeclination(0.117464)
161
+
162
+ .. testsetup::
163
+
164
+ >>> del pub.timegrids
165
+ """
166
+
167
+ FIXEDPARAMETERS = (meteo_fixed.Pi,)
168
+ DERIVEDPARAMETERS = (meteo_derived.DOY,)
169
+ RESULTSEQUENCES = (meteo_factors.SolarDeclination,)
170
+
171
+ @staticmethod
172
+ def __call__(model: modeltools.Model) -> None:
173
+ fix = model.parameters.fixed.fastaccess
174
+ der = model.parameters.derived.fastaccess
175
+ fac = model.sequences.factors.fastaccess
176
+ fac.solardeclination = 0.409 * modelutils.sin(
177
+ 2 * fix.pi / 366 * (der.doy[model.idx_sim] + 1) - 1.39
178
+ )
179
+
180
+
181
+ class Calc_SolarDeclination_V2(modeltools.Method):
182
+ r"""Calculate the solar declination according to :cite:t:`ref-LARSIM`.
183
+
184
+ Basic equation:
185
+ :math:`SolarDeclination = 0.41 \cdot cos \left(
186
+ \frac{2 \cdot Pi \cdot (DOY - 171)}{365} \right)`
187
+
188
+ Examples:
189
+
190
+ We define an initialisation period covering both a leap year (2000) and a
191
+ non-leap year (2001):
192
+
193
+ >>> from hydpy.models.meteo import *
194
+ >>> parameterstep()
195
+ >>> from hydpy import pub, round_
196
+ >>> pub.timegrids = "2000-01-01", "2002-01-01", "1d"
197
+ >>> derived.doy.update()
198
+
199
+ The following convenience function applies method |Calc_SolarDeclination_V2|
200
+ for the given dates and prints the results:
201
+
202
+ >>> def test(*dates):
203
+ ... for date in dates:
204
+ ... model.idx_sim = pub.timegrids.init[date]
205
+ ... model.calc_solardeclination_v2()
206
+ ... print(date, end=": ")
207
+ ... round_(factors.solardeclination.value)
208
+
209
+ The results are identical for both years:
210
+
211
+ >>> test("2000-01-01", "2000-02-28", "2000-02-29",
212
+ ... "2000-03-01", "2000-12-31")
213
+ 2000-01-01: -0.401992
214
+ 2000-02-28: -0.149946
215
+ 2000-02-29: -0.143355
216
+ 2000-03-01: -0.136722
217
+ 2000-12-31: -0.401992
218
+
219
+ >>> test("2001-01-01", "2001-02-28",
220
+ ... "2001-03-01", "2001-12-31")
221
+ 2001-01-01: -0.401992
222
+ 2001-02-28: -0.149946
223
+ 2001-03-01: -0.136722
224
+ 2001-12-31: -0.401992
225
+
226
+ .. testsetup::
227
+
228
+ >>> del pub.timegrids
229
+ """
230
+
231
+ DERIVEDPARAMETERS = (meteo_derived.DOY,)
232
+ FIXEDPARAMETERS = (meteo_fixed.Pi,)
233
+ RESULTSEQUENCES = (meteo_factors.SolarDeclination,)
234
+
235
+ @staticmethod
236
+ def __call__(model: modeltools.Model) -> None:
237
+ der = model.parameters.derived.fastaccess
238
+ fix = model.parameters.fixed.fastaccess
239
+ fac = model.sequences.factors.fastaccess
240
+ fac.solardeclination = 0.41 * modelutils.cos(
241
+ 2.0 * fix.pi * (der.doy[model.idx_sim] - 171.0) / 365.0
242
+ )
243
+
244
+
245
+ class Calc_SunsetHourAngle_V1(modeltools.Method):
246
+ r"""Calculate the sunset hour angle according to :cite:t:`ref-Allen1998`.
247
+
248
+ Basic equation (:cite:t:`ref-Allen1998`, equation 25):
249
+ :math:`SunsetHourAngle = arccos(-tan(LatitudeRad) \cdot tan(SolarDeclination))`
250
+
251
+ Example:
252
+
253
+ The following calculation agrees with example 8 of :cite:t:`ref-Allen1998`:
254
+
255
+ >>> from hydpy.models.meteo import *
256
+ >>> parameterstep()
257
+ >>> derived.doy.shape = 1
258
+ >>> derived.doy(246)
259
+ >>> derived.latituderad(-.35)
260
+ >>> factors.solardeclination = 0.12
261
+ >>> model.calc_sunsethourangle_v1()
262
+ >>> factors.sunsethourangle
263
+ sunsethourangle(1.526767)
264
+ """
265
+
266
+ DERIVEDPARAMETERS = (meteo_derived.LatitudeRad,)
267
+ REQUIREDSEQUENCES = (meteo_factors.SolarDeclination,)
268
+ RESULTSEQUENCES = (meteo_factors.SunsetHourAngle,)
269
+
270
+ @staticmethod
271
+ def __call__(model: modeltools.Model) -> None:
272
+ der = model.parameters.derived.fastaccess
273
+ fac = model.sequences.factors.fastaccess
274
+ fac.sunsethourangle = modelutils.acos(
275
+ -modelutils.tan(der.latituderad) * modelutils.tan(fac.solardeclination)
276
+ )
277
+
278
+
279
+ class Calc_SolarTimeAngle_V1(modeltools.Method):
280
+ r"""Calculate the solar time angle at the midpoint of the current period according
281
+ to :cite:t:`ref-Allen1998`.
282
+
283
+ Basic equations (:cite:t:`ref-Allen1998`, equations 31 to 33):
284
+ :math:`SolarTimeAngle =
285
+ Pi / 12 \cdot ((SCT + (Longitude - UTCLongitude) / 15 + S_c) - 12)`
286
+
287
+ :math:`S_c = 0.1645 \cdot sin(2 \cdot b) -
288
+ 0.1255 \cdot cos(b) - 0.025 \cdot sin(b)`
289
+
290
+ :math:`b = (2 \cdot Pi \cdot (DOY - 80)) / 365`
291
+
292
+ Note there are two slight deviations from the equations given by
293
+ :cite:t:`ref-Allen1998`. The first one is that positive numbers correspond to
294
+ longitudes east of Greenwich and negative numbers to longitudes west of Greenwich.
295
+ The second one is due to the definition of parameter |DOY|, as explained in the
296
+ documentation on method |Calc_EarthSunDistance_V1|.
297
+
298
+ Examples:
299
+
300
+ >>> from hydpy import pub, round_
301
+ >>> pub.timegrids = "2000-09-03", "2000-09-04", "1h"
302
+ >>> from hydpy.models.meteo import *
303
+ >>> parameterstep()
304
+ >>> longitude(15)
305
+ >>> derived.doy.update()
306
+ >>> derived.sct.update()
307
+ >>> derived.utclongitude.update()
308
+ >>> for hour in range(24):
309
+ ... model.idx_sim = hour
310
+ ... model.calc_solartimeangle_v1()
311
+ ... print(hour, end=": ")
312
+ ... round_(factors.solartimeangle.value) # doctest: +ELLIPSIS
313
+ 0: -3.004157
314
+ 1: -2.742358
315
+ ...
316
+ 11: -0.124364
317
+ 12: 0.137435
318
+ ...
319
+ 22: 2.755429
320
+ 23: 3.017229
321
+
322
+ .. testsetup::
323
+
324
+ >>> del pub.timegrids
325
+ """
326
+
327
+ FIXEDPARAMETERS = (meteo_fixed.Pi,)
328
+ CONTROLPARAMETERS = (meteo_control.Longitude,)
329
+ DERIVEDPARAMETERS = (
330
+ meteo_derived.DOY,
331
+ meteo_derived.SCT,
332
+ meteo_derived.UTCLongitude,
333
+ )
334
+ RESULTSEQUENCES = (meteo_factors.SolarTimeAngle,)
335
+
336
+ @staticmethod
337
+ def __call__(model: modeltools.Model) -> None:
338
+ fix = model.parameters.fixed.fastaccess
339
+ con = model.parameters.control.fastaccess
340
+ der = model.parameters.derived.fastaccess
341
+ fac = model.sequences.factors.fastaccess
342
+ d_b = 2.0 * fix.pi * (der.doy[model.idx_sim] - 80.0) / 365.0
343
+ d_sc = (
344
+ 0.1645 * modelutils.sin(2.0 * d_b)
345
+ - 0.1255 * modelutils.cos(d_b)
346
+ - 0.025 * modelutils.sin(d_b)
347
+ )
348
+ d_time = (
349
+ der.sct[model.idx_sim] + (con.longitude - der.utclongitude) / 15.0 + d_sc
350
+ )
351
+ fac.solartimeangle = fix.pi / 12.0 * (d_time - 12.0)
352
+
353
+
354
+ class Calc_TimeOfSunrise_TimeOfSunset_V1(modeltools.Method):
355
+ r"""Calculate the time of sunrise and sunset of the current day according to
356
+ :cite:t:`ref-LARSIM`, based on :cite:t:`ref-Thompson1981`.
357
+
358
+ Basic equations:
359
+ :math:`TimeOfSunset^* = \frac{12}{Pi} \cdot acos \left(
360
+ tan(SolarDeclination) \cdot tan(LatitudeRad) +
361
+ \frac{0.0145}{cos(SolarDeclination) \cdot cos(LatitudeRad)} \right)`
362
+
363
+ :math:`\delta = \frac{4 \cdot (UTCLongitude - Longitude)}{60}`
364
+
365
+ :math:`TimeOfSunset = TimeOfSunset^* + \delta`
366
+
367
+ :math:`TimeOfSunset = 24 - TimeOfSunset^* + \delta`
368
+
369
+ Examples:
370
+
371
+ We calculate the local time of sunrise and sunset for a latitude of
372
+ approximately 52°N and a longitude of 10°E, 5° west of the longitude that
373
+ defines the local time zone:
374
+
375
+ >>> from hydpy.models.meteo import *
376
+ >>> parameterstep()
377
+ >>> longitude(10.0)
378
+ >>> derived.utclongitude(15.0)
379
+ >>> derived.latituderad(0.9)
380
+
381
+
382
+ The sunshine duration varies between seven hours at the winter solstice and 16
383
+ hours at the summer solstice:
384
+
385
+ >>> factors.solardeclination = -0.41
386
+ >>> model.calc_timeofsunrise_timeofsunset_v1()
387
+ >>> factors.timeofsunrise
388
+ timeofsunrise(8.432308)
389
+ >>> factors.timeofsunset
390
+ timeofsunset(16.234359)
391
+ >>> factors.solardeclination = 0.41
392
+ >>> model.calc_timeofsunrise_timeofsunset_v1()
393
+ >>> factors.timeofsunrise
394
+ timeofsunrise(4.002041)
395
+ >>> factors.timeofsunset
396
+ timeofsunset(20.664625)
397
+ """
398
+
399
+ CONTROLPARAMETERS = (meteo_control.Longitude,)
400
+ DERIVEDPARAMETERS = (meteo_derived.LatitudeRad, meteo_derived.UTCLongitude)
401
+ FIXEDPARAMETERS = (meteo_fixed.Pi,)
402
+ REQUIREDSEQUENCES = (meteo_factors.SolarDeclination,)
403
+ RESULTSEQUENCES = (meteo_factors.TimeOfSunrise, meteo_factors.TimeOfSunset)
404
+
405
+ @staticmethod
406
+ def __call__(model: modeltools.Model) -> None:
407
+ con = model.parameters.control.fastaccess
408
+ der = model.parameters.derived.fastaccess
409
+ fix = model.parameters.fixed.fastaccess
410
+ fac = model.sequences.factors.fastaccess
411
+ fac.timeofsunrise = (12.0 / fix.pi) * modelutils.acos(
412
+ modelutils.tan(fac.solardeclination) * modelutils.tan(der.latituderad)
413
+ + 0.0145
414
+ / modelutils.cos(fac.solardeclination)
415
+ / modelutils.cos(der.latituderad)
416
+ )
417
+ fac.timeofsunset = 24.0 - fac.timeofsunrise
418
+ d_dt = (der.utclongitude - con.longitude) * 4.0 / 60.0
419
+ fac.timeofsunrise += d_dt
420
+ fac.timeofsunset += d_dt
421
+
422
+
423
+ class Calc_ExtraterrestrialRadiation_V1(modeltools.Method):
424
+ r"""Calculate the extraterrestrial radiation according to :cite:t:`ref-Allen1998`.
425
+
426
+ Basic equation for daily simulation steps (:cite:t:`ref-Allen1998`, equation 21):
427
+ :math:`ExternalTerrestrialRadiation =
428
+ \frac{SolarConstant}{Pi} \cdot EarthSunDistance \cdot (
429
+ SunsetHourAngle \cdot sin(LatitudeRad) \cdot sin(SolarDeclination) +
430
+ cos(LatitudeRad) \cdot cos(SolarDeclination) \cdot sin(SunsetHourAngle))`
431
+
432
+ Basic equation for (sub)hourly steps (:cite:t:`ref-Allen1998`, eq. 28 to 30):
433
+ :math:`ExternalTerrestrialRadiation =
434
+ \frac{12 \cdot SolarConstant}{Pi} \cdot EarthSunDistance \cdot \Big(
435
+ (\omega_2 - \omega_1) \cdot sin(LatitudeRad) \cdot sin(SolarDeclination) +
436
+ cos(LatitudeRad) \cdot cos(SolarDeclination) \cdot (sin(\omega_2) -
437
+ sin(\omega_1)) \Big)`
438
+
439
+ :math:`\omega_1 = SolarTimeAngle - Pi \cdot Days`
440
+
441
+ :math:`\omega_2 = SolarTimeAngle + Pi \cdot Days`
442
+
443
+ Examples:
444
+
445
+ The following calculation agrees with example 8 of :cite:t:`ref-Allen1998` for
446
+ daily time steps:
447
+
448
+ >>> from hydpy.models.meteo import *
449
+ >>> parameterstep()
450
+ >>> derived.days(1)
451
+ >>> derived.latituderad(-0.35)
452
+ >>> factors.earthsundistance = 0.985
453
+ >>> factors.solardeclination = 0.12
454
+ >>> factors.sunsethourangle = 1.527
455
+ >>> model.calc_extraterrestrialradiation_v1()
456
+ >>> fluxes.extraterrestrialradiation
457
+ extraterrestrialradiation(372.473355)
458
+
459
+ The following calculation repeats the above example for an hourly simulation
460
+ time step, still covering the whole day:
461
+
462
+ >>> import numpy
463
+ >>> longitude(-20)
464
+ >>> derived.utclongitude(-20)
465
+ >>> derived.days(1/24)
466
+ >>> derived.doy.shape = 24
467
+ >>> derived.doy(246)
468
+ >>> derived.sct.shape = 24
469
+ >>> derived.sct = numpy.linspace(0.5, 23.5, 24)
470
+ >>> sum_ = 0.0
471
+ >>> from hydpy import round_
472
+ >>> for hour in range(24):
473
+ ... model.idx_sim = hour
474
+ ... model.calc_solartimeangle_v1()
475
+ ... model.calc_extraterrestrialradiation_v1()
476
+ ... print(hour, end=": ")
477
+ ... round_(fluxes.extraterrestrialradiation.value)
478
+ ... sum_ += fluxes.extraterrestrialradiation
479
+ 0: 0.0
480
+ 1: 0.0
481
+ 2: 0.0
482
+ 3: 0.0
483
+ 4: 0.0
484
+ 5: 0.0
485
+ 6: 116.280258
486
+ 7: 431.467206
487
+ 8: 713.483659
488
+ 9: 943.11066
489
+ 10: 1104.699509
490
+ 11: 1187.238194
491
+ 12: 1185.101838
492
+ 13: 1098.436032
493
+ 14: 933.146907
494
+ 15: 700.498642
495
+ 16: 416.345834
496
+ 17: 100.053027
497
+ 18: 0.0
498
+ 19: 0.0
499
+ 20: 0.0
500
+ 21: 0.0
501
+ 22: 0.0
502
+ 23: 0.0
503
+
504
+ Note that, even with identical values of the local longitude (|Longitude|) and
505
+ the one of the time zone (|UTCLongitude|), the calculated radiation values are
506
+ not symmetrical due to the eccentricity of the Earth"s orbit (see `solar
507
+ time`_).
508
+
509
+ There is a slight deviation between the directly calculated daily value and the
510
+ mean of the hourly values:
511
+
512
+ >>> round_(sum_/24)
513
+ 372.077574
514
+
515
+ For sub-daily simulation time steps, results are most accurate for the shortest
516
+ step size. On the other hand, they can be (extremely) inaccurate for timesteps
517
+ between one hour and one day. We demonstrate this by comparing the mean
518
+ sub-daily values of different step sizes with the directly calculated daily
519
+ value (note the apparent total fail of method
520
+ |Calc_ExtraterrestrialRadiation_V1| for a step size of 720 minutes):
521
+
522
+ >>> for minutes in [1, 5, 15, 30, 60, 90, 120, 144, 160,
523
+ ... 180, 240, 288, 360, 480, 720, 1440]:
524
+ ... derived.days(minutes/60/24)
525
+ ... nmb = int(1440/minutes)
526
+ ... derived.doy.shape = nmb
527
+ ... derived.doy(246)
528
+ ... derived.sct.shape = nmb
529
+ ... derived.sct = numpy.linspace(minutes/60/2, 24-minutes/60/2, nmb)
530
+ ... sum_ = 0.0
531
+ ... for idx in range(nmb):
532
+ ... model.idx_sim = idx
533
+ ... model.calc_solartimeangle_v1()
534
+ ... model.calc_extraterrestrialradiation_v1()
535
+ ... sum_ += fluxes.extraterrestrialradiation
536
+ ... print(minutes, end=": ")
537
+ ... round_(sum_/24 - 372.473355)
538
+ 1: -0.000626
539
+ 5: -0.008549
540
+ 15: -0.100092
541
+ 30: -0.395781
542
+ 60: -0.395781
543
+ 90: -0.395781
544
+ 120: -0.395781
545
+ 144: -14.43193
546
+ 160: -9.539017
547
+ 180: -0.395781
548
+ 240: -44.735212
549
+ 288: -25.486399
550
+ 360: -0.395781
551
+ 480: -44.735212
552
+ 720: -372.473355
553
+ 1440: -356.953632
554
+ """
555
+
556
+ FIXEDPARAMETERS = (meteo_fixed.Pi, meteo_fixed.SolarConstant)
557
+ DERIVEDPARAMETERS = (meteo_derived.Days, meteo_derived.LatitudeRad)
558
+ REQUIREDSEQUENCES = (
559
+ meteo_factors.SolarTimeAngle,
560
+ meteo_factors.EarthSunDistance,
561
+ meteo_factors.SolarDeclination,
562
+ meteo_factors.SunsetHourAngle,
563
+ )
564
+ RESULTSEQUENCES = (meteo_fluxes.ExtraterrestrialRadiation,)
565
+
566
+ @staticmethod
567
+ def __call__(model: modeltools.Model) -> None:
568
+ fix = model.parameters.fixed.fastaccess
569
+ der = model.parameters.derived.fastaccess
570
+ fac = model.sequences.factors.fastaccess
571
+ flu = model.sequences.fluxes.fastaccess
572
+ if der.days < 1.0:
573
+ d_delta = fix.pi * der.days
574
+ d_omega1 = fac.solartimeangle - d_delta
575
+ d_omega2 = fac.solartimeangle + d_delta
576
+ flu.extraterrestrialradiation = max(
577
+ (12.0 * fix.solarconstant / fix.pi * fac.earthsundistance)
578
+ * (
579
+ (
580
+ (d_omega2 - d_omega1)
581
+ * modelutils.sin(der.latituderad)
582
+ * modelutils.sin(fac.solardeclination)
583
+ )
584
+ + (
585
+ modelutils.cos(der.latituderad)
586
+ * modelutils.cos(fac.solardeclination)
587
+ * (modelutils.sin(d_omega2) - modelutils.sin(d_omega1))
588
+ )
589
+ ),
590
+ 0.0,
591
+ )
592
+ else:
593
+ flu.extraterrestrialradiation = (
594
+ fix.solarconstant / fix.pi * fac.earthsundistance
595
+ ) * (
596
+ (
597
+ fac.sunsethourangle
598
+ * modelutils.sin(der.latituderad)
599
+ * modelutils.sin(fac.solardeclination)
600
+ )
601
+ + (
602
+ modelutils.cos(der.latituderad)
603
+ * modelutils.cos(fac.solardeclination)
604
+ * modelutils.sin(fac.sunsethourangle)
605
+ )
606
+ )
607
+
608
+
609
+ class Calc_ExtraterrestrialRadiation_V2(modeltools.Method):
610
+ r"""Calculate the amount of extraterrestrial radiation according to
611
+ :cite:t:`ref-LARSIM`, based on :cite:t:`ref-Thompson1981`.
612
+
613
+ Basic equation:
614
+ :math:`ExternalTerrestrialRadiation =
615
+ \frac{SolarConstant \cdot EarthSunDistance \cdot (
616
+ SunsetHourAngle \cdot sin(LatitudeRad) \cdot sin(SolarDeclination) +
617
+ cos(LatitudeRad) \cdot cos(SolarDeclination) \cdot sin(SunsetHourAngle)
618
+ )}{PI}`
619
+
620
+ :math:`SunsetHourAngle = (TimeOfSunset - TimeOfSunset) \cdot Pi / 24`
621
+
622
+ Examples:
623
+
624
+ First, we calculate the extraterrestrial radiation for a latitude of
625
+ approximately 52°N:
626
+
627
+ >>> from hydpy.models.meteo import *
628
+ >>> parameterstep()
629
+ >>> derived.latituderad(0.9)
630
+
631
+ The sunshine duration varies between seven hours at the winter solstice and 16
632
+ hours at summer solstice, corresponding to mean daily radiations of 70 and
633
+ 514 W/m².
634
+
635
+ >>> factors.solardeclination = -0.41
636
+ >>> factors.earthsundistance = 0.97
637
+ >>> factors.timeofsunrise = 8.4
638
+ >>> factors.timeofsunset = 15.6
639
+ >>> model.calc_extraterrestrialradiation_v2()
640
+ >>> fluxes.extraterrestrialradiation
641
+ extraterrestrialradiation(70.458396)
642
+
643
+ >>> factors.solardeclination = 0.41
644
+ >>> factors.earthsundistance = 1.03
645
+ >>> factors.timeofsunrise = 4.0
646
+ >>> factors.timeofsunset = 20.0
647
+ >>> model.calc_extraterrestrialradiation_v2()
648
+ >>> fluxes.extraterrestrialradiation
649
+ extraterrestrialradiation(514.367012)
650
+ """
651
+
652
+ DERIVEDPARAMETERS = (meteo_derived.LatitudeRad,)
653
+ FIXEDPARAMETERS = (meteo_fixed.Pi, meteo_fixed.SolarConstant)
654
+ REQUIREDSEQUENCES = (
655
+ meteo_factors.SolarDeclination,
656
+ meteo_factors.EarthSunDistance,
657
+ meteo_factors.TimeOfSunrise,
658
+ meteo_factors.TimeOfSunset,
659
+ )
660
+ RESULTSEQUENCES = (meteo_fluxes.ExtraterrestrialRadiation,)
661
+
662
+ @staticmethod
663
+ def __call__(model: modeltools.Model) -> None:
664
+ der = model.parameters.derived.fastaccess
665
+ fix = model.parameters.fixed.fastaccess
666
+ fac = model.sequences.factors.fastaccess
667
+ flu = model.sequences.fluxes.fastaccess
668
+ d_sunsethourangle = (fac.timeofsunset - fac.timeofsunrise) * fix.pi / 24.0
669
+ flu.extraterrestrialradiation = (
670
+ fix.solarconstant * fac.earthsundistance / fix.pi
671
+ ) * (
672
+ d_sunsethourangle
673
+ * modelutils.sin(fac.solardeclination)
674
+ * modelutils.sin(der.latituderad)
675
+ + modelutils.cos(fac.solardeclination)
676
+ * modelutils.cos(der.latituderad)
677
+ * modelutils.sin(d_sunsethourangle)
678
+ )
679
+
680
+
681
+ class Calc_PossibleSunshineDuration_V1(modeltools.Method):
682
+ r"""Calculate the astronomically possible sunshine duration according to
683
+ :cite:t:`ref-Allen1998`.
684
+
685
+ Basic equation for daily timesteps :cite:t:`ref-Allen1998` (equation 34):
686
+ :math:`PossibleSunshineDuration = 24 / Pi \cdot SunsetHourAngle`
687
+
688
+ Basic equation for (sub)hourly timesteps:
689
+ :math:`PossibleSunshineDuration =
690
+ min(max(12 / Pi \cdot (SunsetHourAngle - \tau), 0), Hours)`
691
+
692
+ .. math::
693
+ \tau =
694
+ \begin{cases}
695
+ -SolarTimeAngle - Pi \cdot Days &|\ SolarTimeAngle \leq 0
696
+ \\
697
+ SolarTimeAngle - Pi \cdot Days &|\ SolarTimeAngle > 0
698
+ \end{cases}
699
+
700
+ Examples:
701
+
702
+ The following calculation agrees with example 9 of :cite:t:`ref-Allen1998`:
703
+
704
+ >>> from hydpy.models.meteo import *
705
+ >>> parameterstep()
706
+ >>> derived.days(1)
707
+ >>> derived.hours(24)
708
+ >>> factors.sunsethourangle(1.527)
709
+ >>> model.calc_possiblesunshineduration_v1()
710
+ >>> factors.possiblesunshineduration
711
+ possiblesunshineduration(11.665421)
712
+
713
+ The following calculation repeats the above example for an hourly simulation
714
+ time step, still covering the whole day. Therefore the ratio is only calculated
715
+ during sunrise and sunset and set to 1 at daytime and 0 at nighttime:
716
+
717
+ >>> from hydpy import round_
718
+ >>> import numpy
719
+ >>> derived.days(1/24)
720
+ >>> derived.hours(1)
721
+ >>> solartimeangles = numpy.linspace(-3.004157, 3.017229, 24)
722
+ >>> sum_ = 0.
723
+ >>> for hour, solartimeangle in enumerate(solartimeangles):
724
+ ... factors.solartimeangle = solartimeangle
725
+ ... model.calc_possiblesunshineduration_v1()
726
+ ... print(hour, end=": ") # doctest: +ELLIPSIS
727
+ ... round_(factors.possiblesunshineduration.value)
728
+ ... sum_ += factors.possiblesunshineduration.value
729
+ 0: 0.0
730
+ ...
731
+ 5: 0.0
732
+ 6: 0.857676
733
+ 7: 1.0
734
+ ...
735
+ 16: 1.0
736
+ 17: 0.807745
737
+ 18: 0.0
738
+ ...
739
+ 23: 0.0
740
+
741
+ The sum of the hourly sunshine durations equals the one-step calculation result:
742
+
743
+ >>> round_(sum_)
744
+ 11.665421
745
+ """
746
+
747
+ FIXEDPARAMETERS = (meteo_fixed.Pi,)
748
+ DERIVEDPARAMETERS = (meteo_derived.Days, meteo_derived.Hours)
749
+ REQUIREDSEQUENCES = (meteo_factors.SolarTimeAngle, meteo_factors.SunsetHourAngle)
750
+ RESULTSEQUENCES = (meteo_factors.PossibleSunshineDuration,)
751
+
752
+ @staticmethod
753
+ def __call__(model: modeltools.Model) -> None:
754
+ fix = model.parameters.fixed.fastaccess
755
+ der = model.parameters.derived.fastaccess
756
+ fac = model.sequences.factors.fastaccess
757
+ if der.hours < 24.0:
758
+ if fac.solartimeangle <= 0.0:
759
+ d_thresh = -fac.solartimeangle - fix.pi * der.days
760
+ else:
761
+ d_thresh = fac.solartimeangle - fix.pi * der.days
762
+ fac.possiblesunshineduration = min(
763
+ max(12.0 / fix.pi * (fac.sunsethourangle - d_thresh), 0.0), der.hours
764
+ )
765
+ else:
766
+ fac.possiblesunshineduration = 24.0 / fix.pi * fac.sunsethourangle
767
+
768
+
769
+ class Calc_PossibleSunshineDuration_V2(modeltools.Method):
770
+ r"""Calculate the astronomically possible sunshine duration according to
771
+ :cite:t:`ref-LARSIM`.
772
+
773
+ Basic equation:
774
+ :math:`PossibleSunshineDuration = max \bigl(
775
+ max(SCT-Hours/2, TimeOfSunrise) - min(SCT + Hours / 2, TimeOfSunset), 0 \bigr)`
776
+
777
+ Examples:
778
+
779
+ We focus on winter conditions with a relatively short possible sunshine
780
+ duration:
781
+
782
+ >>> from hydpy.models.meteo import *
783
+ >>> parameterstep()
784
+ >>> factors.timeofsunrise(8.4)
785
+ >>> factors.timeofsunset(15.6)
786
+
787
+ We start with a daily simulation time step. The possible sunshine duration is,
788
+ as expected, the span between sunrise and sunset:
789
+
790
+ >>> from hydpy import pub, round_
791
+ >>> pub.timegrids = "2000-01-01", "2000-01-02", "1d"
792
+ >>> derived.sct.update()
793
+ >>> derived.hours.update()
794
+ >>> model.calc_possiblesunshineduration_v2()
795
+ >>> factors.possiblesunshineduration
796
+ possiblesunshineduration(7.2)
797
+
798
+ The following example calculates the possible hourly sunshine durations of the
799
+ same day:
800
+
801
+ >>> pub.timegrids = "2000-01-01", "2000-01-02", "1h"
802
+ >>> derived.sct.update()
803
+ >>> derived.hours.update()
804
+ >>> sum_ = 0.0
805
+ >>> for idx in range(24):
806
+ ... model.idx_sim = idx
807
+ ... model.calc_possiblesunshineduration_v2()
808
+ ... print(idx+1, end=": ") # doctest: +ELLIPSIS
809
+ ... round_(factors.possiblesunshineduration.value)
810
+ ... sum_ += factors.possiblesunshineduration.value
811
+ 1: 0.0
812
+ ...
813
+ 9: 0.6
814
+ 10: 1.0
815
+ ...
816
+ 15: 1.0
817
+ 16: 0.6
818
+ 17: 0.0
819
+ ...
820
+ 24: 0.0
821
+
822
+ The sum of the possible hourly sunshine durations equals the daily possible
823
+ sunshine, of course:
824
+
825
+ >>> round_(sum_)
826
+ 7.2
827
+
828
+ .. testsetup::
829
+
830
+ >>> del pub.timegrids
831
+ """
832
+
833
+ DERIVEDPARAMETERS = (meteo_derived.SCT, meteo_derived.Hours)
834
+ REQUIREDSEQUENCES = (meteo_factors.TimeOfSunrise, meteo_factors.TimeOfSunset)
835
+ RESULTSEQUENCES = (meteo_factors.PossibleSunshineDuration,)
836
+
837
+ @staticmethod
838
+ def __call__(model: modeltools.Model) -> None:
839
+ der = model.parameters.derived.fastaccess
840
+ fac = model.sequences.factors.fastaccess
841
+ d_stc = der.sct[model.idx_sim]
842
+ d_t0 = max((d_stc - der.hours / 2.0), fac.timeofsunrise)
843
+ d_t1 = min((d_stc + der.hours / 2.0), fac.timeofsunset)
844
+ fac.possiblesunshineduration = max(d_t1 - d_t0, 0.0)
845
+
846
+
847
+ class Calc_DailyPossibleSunshineDuration_V1(modeltools.Method):
848
+ """Calculate the astronomically possible daily sunshine duration.
849
+
850
+ Basic equation:
851
+ :math:`DailyPossibleSunshineDuration = TimeOfSunset - TimeOfSunrise`
852
+
853
+ Examples:
854
+
855
+ >>> from hydpy.models.meteo import *
856
+ >>> parameterstep()
857
+ >>> factors.timeofsunrise(8.4)
858
+ >>> factors.timeofsunset(15.6)
859
+ >>> model.calc_dailypossiblesunshineduration()
860
+ >>> factors.dailypossiblesunshineduration
861
+ dailypossiblesunshineduration(7.2)
862
+ """
863
+
864
+ REQUIREDSEQUENCES = (meteo_factors.TimeOfSunrise, meteo_factors.TimeOfSunset)
865
+ RESULTSEQUENCES = (meteo_factors.DailyPossibleSunshineDuration,)
866
+
867
+ @staticmethod
868
+ def __call__(model: modeltools.Model) -> None:
869
+ fac = model.sequences.factors.fastaccess
870
+ fac.dailypossiblesunshineduration = fac.timeofsunset - fac.timeofsunrise
871
+
872
+
873
+ class Update_LoggedSunshineDuration_V1(modeltools.Method):
874
+ """Log the sunshine duration values of the last 24 hours.
875
+
876
+ Example:
877
+
878
+ The following example shows that each new method call successively moves the
879
+ three memorised values to the right and stores the respective new value on the
880
+ most left position:
881
+
882
+ >>> from hydpy.models.meteo import *
883
+ >>> parameterstep()
884
+ >>> derived.nmblogentries(3)
885
+ >>> logs.loggedsunshineduration.shape = 3
886
+ >>> logs.loggedsunshineduration = 0.0
887
+ >>> from hydpy import UnitTest
888
+ >>> test = UnitTest(model,
889
+ ... model.update_loggedsunshineduration_v1,
890
+ ... last_example=4,
891
+ ... parseqs=(inputs.sunshineduration,
892
+ ... logs.loggedsunshineduration))
893
+ >>> test.nexts.sunshineduration = 1.0, 3.0, 2.0, 4.0
894
+ >>> del test.inits.loggedsunshineduration
895
+ >>> test()
896
+ | ex. | sunshineduration | loggedsunshineduration |
897
+ -------------------------------------------------------------
898
+ | 1 | 1.0 | 1.0 0.0 0.0 |
899
+ | 2 | 3.0 | 3.0 1.0 0.0 |
900
+ | 3 | 2.0 | 2.0 3.0 1.0 |
901
+ | 4 | 4.0 | 4.0 2.0 3.0 |
902
+
903
+ """
904
+
905
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
906
+ REQUIREDSEQUENCES = (meteo_inputs.SunshineDuration,)
907
+ UPDATEDSEQUENCES = (meteo_logs.LoggedSunshineDuration,)
908
+
909
+ @staticmethod
910
+ def __call__(model: modeltools.Model) -> None:
911
+ der = model.parameters.derived.fastaccess
912
+ inp = model.sequences.inputs.fastaccess
913
+ log = model.sequences.logs.fastaccess
914
+ for idx in range(der.nmblogentries - 1, 0, -1):
915
+ log.loggedsunshineduration[idx] = log.loggedsunshineduration[idx - 1]
916
+ log.loggedsunshineduration[0] = inp.sunshineduration
917
+
918
+
919
+ class Update_LoggedGlobalRadiation_V1(modeltools.Method):
920
+ """Log the global radiation values of the last 24 hours.
921
+
922
+ Example:
923
+
924
+ The following example shows that each new method call successively moves the
925
+ three memorised values to the right and stores the respective new value on the
926
+ most left position:
927
+
928
+ >>> from hydpy.models.meteo import *
929
+ >>> parameterstep()
930
+ >>> derived.nmblogentries(3)
931
+ >>> logs.loggedglobalradiation.shape = 3
932
+ >>> logs.loggedglobalradiation = 0.0
933
+ >>> from hydpy import UnitTest
934
+ >>> test = UnitTest(model,
935
+ ... model.update_loggedglobalradiation_v1,
936
+ ... last_example=4,
937
+ ... parseqs=(inputs.globalradiation,
938
+ ... logs.loggedglobalradiation))
939
+ >>> test.nexts.globalradiation = 1.0, 3.0, 2.0, 4.0
940
+ >>> del test.inits.loggedglobalradiation
941
+ >>> test()
942
+ | ex. | globalradiation | loggedglobalradiation |
943
+ -----------------------------------------------------------
944
+ | 1 | 1.0 | 1.0 0.0 0.0 |
945
+ | 2 | 3.0 | 3.0 1.0 0.0 |
946
+ | 3 | 2.0 | 2.0 3.0 1.0 |
947
+ | 4 | 4.0 | 4.0 2.0 3.0 |
948
+
949
+ """
950
+
951
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
952
+ REQUIREDSEQUENCES = (meteo_inputs.GlobalRadiation,)
953
+ UPDATEDSEQUENCES = (meteo_logs.LoggedGlobalRadiation,)
954
+
955
+ @staticmethod
956
+ def __call__(model: modeltools.Model) -> None:
957
+ der = model.parameters.derived.fastaccess
958
+ inp = model.sequences.inputs.fastaccess
959
+ log = model.sequences.logs.fastaccess
960
+ for idx in range(der.nmblogentries - 1, 0, -1):
961
+ log.loggedglobalradiation[idx] = log.loggedglobalradiation[idx - 1]
962
+ log.loggedglobalradiation[0] = inp.globalradiation
963
+
964
+
965
+ class Calc_DailySunshineDuration_V1(modeltools.Method):
966
+ """Calculate the sunshine duration sum of the last 24 hours.
967
+
968
+ Example:
969
+
970
+ >>> from hydpy.models.meteo import *
971
+ >>> parameterstep()
972
+ >>> derived.nmblogentries(3)
973
+ >>> logs.loggedsunshineduration.shape = 3
974
+ >>> logs.loggedsunshineduration = 1.0, 5.0, 3.0
975
+ >>> model.calc_dailysunshineduration_v1()
976
+ >>> factors.dailysunshineduration
977
+ dailysunshineduration(9.0)
978
+ """
979
+
980
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
981
+ REQUIREDSEQUENCES = (meteo_logs.LoggedSunshineDuration,)
982
+ UPDATEDSEQUENCES = (meteo_factors.DailySunshineDuration,)
983
+
984
+ @staticmethod
985
+ def __call__(model: modeltools.Model) -> None:
986
+ der = model.parameters.derived.fastaccess
987
+ log = model.sequences.logs.fastaccess
988
+ fac = model.sequences.factors.fastaccess
989
+ fac.dailysunshineduration = 0.0
990
+ for idx in range(der.nmblogentries):
991
+ fac.dailysunshineduration += log.loggedsunshineduration[idx]
992
+
993
+
994
+ class Calc_DailyGlobalRadiation_V2(modeltools.Method):
995
+ """Calculate the global radiation sum of the last 24 hours.
996
+
997
+ Example:
998
+
999
+ >>> from hydpy.models.meteo import *
1000
+ >>> parameterstep()
1001
+ >>> derived.nmblogentries(3)
1002
+ >>> logs.loggedglobalradiation.shape = 3
1003
+ >>> logs.loggedglobalradiation = 100.0, 800.0, 600.0
1004
+ >>> model.calc_dailyglobalradiation_v2()
1005
+ >>> fluxes.dailyglobalradiation
1006
+ dailyglobalradiation(500.0)
1007
+ """
1008
+
1009
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
1010
+ REQUIREDSEQUENCES = (meteo_logs.LoggedGlobalRadiation,)
1011
+ UPDATEDSEQUENCES = (meteo_fluxes.DailyGlobalRadiation,)
1012
+
1013
+ @staticmethod
1014
+ def __call__(model: modeltools.Model) -> None:
1015
+ der = model.parameters.derived.fastaccess
1016
+ log = model.sequences.logs.fastaccess
1017
+ flu = model.sequences.fluxes.fastaccess
1018
+ flu.dailyglobalradiation = 0.0
1019
+ for idx in range(der.nmblogentries):
1020
+ flu.dailyglobalradiation += log.loggedglobalradiation[idx]
1021
+ flu.dailyglobalradiation /= der.nmblogentries
1022
+
1023
+
1024
+ class Calc_PortionDailyRadiation_V1(modeltools.Method):
1025
+ r"""Calculate the relative sum of radiation according to :cite:t:`ref-LARSIM-Hilfe`.
1026
+
1027
+ Basic equations:
1028
+
1029
+ .. math::
1030
+ SP = S_P^*(SCT + Hours/2) - S_P^*(SCT - Hours/2)
1031
+
1032
+ .. math::
1033
+ S_P^*(t) = \begin{cases}
1034
+ 0
1035
+ &|\
1036
+ TL_P(t) \leq 0
1037
+ \\
1038
+ 50 - 50 \cdot cos\bigl(1.8 \cdot TL_P(t)\bigr) -
1039
+ 3.4 \cdot sin\bigl(3.6 \cdot TL_P(t)\bigr)^2
1040
+ &|\
1041
+ 0 < TL_P(t) \leq 50 \cdot \frac{2 \cdot Pi}{360}
1042
+ \\
1043
+ 50 - 50 \cdot cos\bigl(1.8 \cdot TL_P(t)\bigr) +
1044
+ 3.4 \cdot sin\bigl(3.6 \cdot TL_P(t)\bigr)^2
1045
+ &|\
1046
+ 50 \cdot \frac{2 \cdot Pi}{360} < TL_P(t) <
1047
+ 100 \cdot \frac{2 \cdot Pi}{360}
1048
+ \\
1049
+ 100
1050
+ &|\
1051
+ 100 \cdot \frac{2 \cdot Pi}{360} \leq TL_P(t)
1052
+ \end{cases}
1053
+
1054
+ .. math::
1055
+ TL_P(t) = 100 \cdot \frac{2 \cdot Pi}{360} \cdot
1056
+ \frac{t - TimeOfSunrise}{TimeOfSunset - TimeOfSunrise}
1057
+
1058
+ Examples:
1059
+
1060
+ We focus on winter conditions with a relatively short possible
1061
+ sunshine duration:
1062
+
1063
+ >>> from hydpy.models.meteo import *
1064
+ >>> parameterstep()
1065
+ >>> factors.timeofsunrise(8.4)
1066
+ >>> factors.timeofsunset(15.6)
1067
+
1068
+ We start with an hourly simulation time step. The relative radiation sum is,
1069
+ as expected, zero before sunrise and after sunset. In between, it reaches its
1070
+ maximum around noon:
1071
+
1072
+ >>> from hydpy import pub, round_
1073
+ >>> pub.timegrids = "2000-01-01", "2000-01-02", "1h"
1074
+ >>> derived.sct.update()
1075
+ >>> derived.hours.update()
1076
+ >>> for idx in range(7, 17):
1077
+ ... model.idx_sim = idx
1078
+ ... model.calc_portiondailyradiation_v1()
1079
+ ... print(idx+1, end=": ")
1080
+ ... round_(factors.portiondailyradiation.value)
1081
+ 8: 0.0
1082
+ 9: 0.853709
1083
+ 10: 7.546592
1084
+ 11: 18.473585
1085
+ 12: 23.126115
1086
+ 13: 23.126115
1087
+ 14: 18.473585
1088
+ 15: 7.546592
1089
+ 16: 0.853709
1090
+ 17: 0.0
1091
+
1092
+ The following examples show how method |Calc_PortionDailyRadiation_V1| works
1093
+ for time step sizes longer than one hour:
1094
+
1095
+ >>> pub.timegrids = "2000-01-01", "2000-01-02", "1d"
1096
+ >>> derived.sct.update()
1097
+ >>> derived.hours.update()
1098
+ >>> model.idx_sim = 0
1099
+ >>> model.calc_portiondailyradiation_v1()
1100
+ >>> factors.portiondailyradiation
1101
+ portiondailyradiation(100.0)
1102
+
1103
+ >>> pub.timegrids = "2000-01-01", "2000-01-02", "6h"
1104
+ >>> derived.sct.update()
1105
+ >>> derived.hours.update()
1106
+ >>> for idx in range(4):
1107
+ ... model.idx_sim = idx
1108
+ ... model.calc_portiondailyradiation_v1()
1109
+ ... print((idx+1)*6, end=": ")
1110
+ ... round_(factors.portiondailyradiation.value)
1111
+ 6: 0.0
1112
+ 12: 50.0
1113
+ 18: 50.0
1114
+ 24: 0.0
1115
+
1116
+ >>> pub.timegrids = "2000-01-01", "2000-01-02", "3h"
1117
+ >>> derived.sct.update()
1118
+ >>> derived.hours.update()
1119
+ >>> for idx in range(8):
1120
+ ... model.idx_sim = idx
1121
+ ... model.calc_portiondailyradiation_v1()
1122
+ ... print((idx+1)*3, end=": ")
1123
+ ... round_(factors.portiondailyradiation.value)
1124
+ 3: 0.0
1125
+ 6: 0.0
1126
+ 9: 0.853709
1127
+ 12: 49.146291
1128
+ 15: 49.146291
1129
+ 18: 0.853709
1130
+ 21: 0.0
1131
+ 24: 0.0
1132
+
1133
+ Often, method |Calc_PortionDailyRadiation_V1| calculates a small but
1134
+ unrealistic "bump" around noon (for example, the relative radiation is slightly
1135
+ smaller between 11:30 and 12:00 than it is between 11:00 and 11:30):
1136
+
1137
+ >>> pub.timegrids = "2000-01-01", "2000-01-02", "30m"
1138
+ >>> derived.sct.update()
1139
+ >>> derived.hours.update()
1140
+ >>> for idx in range(15, 33):
1141
+ ... model.idx_sim = idx
1142
+ ... model.calc_portiondailyradiation_v1()
1143
+ ... print((idx+1)/2, end=": ")
1144
+ ... round_(factors.portiondailyradiation.value)
1145
+ 8.0: 0.0
1146
+ 8.5: 0.021762
1147
+ 9.0: 0.831947
1148
+ 9.5: 2.514315
1149
+ 10.0: 5.032276
1150
+ 10.5: 7.989385
1151
+ 11.0: 10.4842
1152
+ 11.5: 11.696873
1153
+ 12.0: 11.429242
1154
+ 12.5: 11.429242
1155
+ 13.0: 11.696873
1156
+ 13.5: 10.4842
1157
+ 14.0: 7.989385
1158
+ 14.5: 5.032276
1159
+ 15.0: 2.514315
1160
+ 15.5: 0.831947
1161
+ 16.0: 0.021762
1162
+ 16.5: 0.0
1163
+
1164
+ .. testsetup::
1165
+
1166
+ >>> del pub.timegrids
1167
+ """
1168
+
1169
+ DERIVEDPARAMETERS = (meteo_derived.SCT, meteo_derived.Hours)
1170
+ FIXEDPARAMETERS = (meteo_fixed.Pi,)
1171
+ REQUIREDSEQUENCES = (meteo_factors.TimeOfSunrise, meteo_factors.TimeOfSunset)
1172
+ RESULTSEQUENCES = (meteo_factors.PortionDailyRadiation,)
1173
+
1174
+ @staticmethod
1175
+ def __call__(model: modeltools.Model) -> None:
1176
+ der = model.parameters.derived.fastaccess
1177
+ fix = model.parameters.fixed.fastaccess
1178
+ fac = model.sequences.factors.fastaccess
1179
+ d_fac = 2.0 * fix.pi / 360.0
1180
+ fac.portiondailyradiation = 0.0
1181
+ for i in range(2):
1182
+ if i:
1183
+ d_dt = der.hours / 2.0
1184
+ else:
1185
+ d_dt = -der.hours / 2.0
1186
+ d_tlp = (100.0 * d_fac) * (
1187
+ (der.sct[model.idx_sim] + d_dt - fac.timeofsunrise)
1188
+ / (fac.timeofsunset - fac.timeofsunrise)
1189
+ )
1190
+ if d_tlp <= 0.0:
1191
+ d_p = 0.0
1192
+ elif d_tlp < 100.0 * d_fac:
1193
+ d_p = 50.0 - 50.0 * modelutils.cos(1.8 * d_tlp)
1194
+ d_temp = 3.4 * modelutils.sin(3.6 * d_tlp) ** 2
1195
+ if d_tlp <= 50.0 * d_fac:
1196
+ d_p -= d_temp
1197
+ else:
1198
+ d_p += d_temp
1199
+ else:
1200
+ d_p = 100.0
1201
+ if i:
1202
+ fac.portiondailyradiation += d_p
1203
+ else:
1204
+ fac.portiondailyradiation -= d_p
1205
+
1206
+
1207
+ class Return_DailyGlobalRadiation_V1(modeltools.Method):
1208
+ r"""Calculate and return the daily global radiation according to
1209
+ :cite:t:`ref-LARSIM`.
1210
+
1211
+ Additional requirements:
1212
+ |Model.idx_sim|
1213
+
1214
+ Basic equation:
1215
+ .. math::
1216
+ ExtraterrestrialRadiation \cdot \begin{cases}
1217
+ AngstromConstant + AngstromFactor \cdot
1218
+ \frac{sunshineduration}{possiblesunshineduration}
1219
+ &|\
1220
+ sunshineduration > 0 \;\; \lor \;\; Days < 1
1221
+ \\
1222
+ AngstromAlternative
1223
+ &|\
1224
+ sunshineduration = 0 \;\; \land \;\; Days \geq 1
1225
+ \end{cases}
1226
+
1227
+ Example:
1228
+
1229
+ You can define month-specific Angstrom coefficients to reflect the annual
1230
+ variability in the relationship between sunshine duration and global radiation.
1231
+ First, we demonstrate this on a daily timestep basis:
1232
+
1233
+ >>> from hydpy import pub, round_
1234
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
1235
+ >>> from hydpy.models.meteo import *
1236
+ >>> parameterstep()
1237
+ >>> derived.moy.update()
1238
+ >>> derived.days.update()
1239
+ >>> angstromconstant.jan = 0.1
1240
+ >>> angstromfactor.jan = 0.5
1241
+ >>> angstromalternative.jan = 0.2
1242
+ >>> angstromconstant.feb = 0.2
1243
+ >>> angstromfactor.feb = 0.6
1244
+ >>> angstromalternative.feb = 0.3
1245
+ >>> fluxes.extraterrestrialradiation = 340.0
1246
+ >>> model.idx_sim = 1
1247
+ >>> round_(model.return_dailyglobalradiation_v1(0.6, 1.0))
1248
+ 136.0
1249
+ >>> model.idx_sim = 2
1250
+ >>> round_(model.return_dailyglobalradiation_v1(0.6, 1.0))
1251
+ 190.4
1252
+
1253
+ If the possible sunshine duration is zero, we generally set global radiation to
1254
+ zero (even if the actual sunshine duration is larger than zero, which might
1255
+ occur as a result of inconsistencies between measured and calculated input
1256
+ data):
1257
+
1258
+ >>> round_(model.return_dailyglobalradiation_v1(0.6, 0.0))
1259
+ 0.0
1260
+
1261
+ When actual sunshine is zero, the alternative Ångström coefficient applies:
1262
+
1263
+ >>> model.idx_sim = 1
1264
+ >>> round_(model.return_dailyglobalradiation_v1(0.0, 1.0))
1265
+ 68.0
1266
+ >>> model.idx_sim = 2
1267
+ >>> round_(model.return_dailyglobalradiation_v1(0.0, 1.0))
1268
+ 102.0
1269
+
1270
+ All of the examples and explanations above hold for short simulation timesteps,
1271
+ except that |AngstromAlternative| never replaces |AngstromConstant|:
1272
+
1273
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1h"
1274
+ >>> derived.moy.update()
1275
+ >>> derived.days.update()
1276
+ >>> model.idx_sim = 1
1277
+ >>> round_(model.return_dailyglobalradiation_v1(0.0, 1.0))
1278
+ 34.0
1279
+
1280
+ .. testsetup::
1281
+
1282
+ >>> del pub.timegrids
1283
+ """
1284
+
1285
+ CONTROLPARAMETERS = (
1286
+ meteo_control.AngstromConstant,
1287
+ meteo_control.AngstromFactor,
1288
+ meteo_control.AngstromAlternative,
1289
+ )
1290
+ DERIVEDPARAMETERS = (meteo_derived.MOY, meteo_derived.Days)
1291
+ REQUIREDSEQUENCES = (meteo_fluxes.ExtraterrestrialRadiation,)
1292
+
1293
+ @staticmethod
1294
+ def __call__(
1295
+ model: modeltools.Model,
1296
+ sunshineduration: float,
1297
+ possiblesunshineduration: float,
1298
+ ) -> float:
1299
+ con = model.parameters.control.fastaccess
1300
+ der = model.parameters.derived.fastaccess
1301
+ flu = model.sequences.fluxes.fastaccess
1302
+ if possiblesunshineduration > 0.0:
1303
+ idx = der.moy[model.idx_sim]
1304
+ if (sunshineduration <= 0.0) and (der.days >= 1.0):
1305
+ return flu.extraterrestrialradiation * con.angstromalternative[idx]
1306
+ return flu.extraterrestrialradiation * (
1307
+ con.angstromconstant[idx]
1308
+ + con.angstromfactor[idx] * sunshineduration / possiblesunshineduration
1309
+ )
1310
+ return 0.0
1311
+
1312
+
1313
+ class Calc_ClearSkySolarRadiation_V1(modeltools.Method):
1314
+ r"""Calculate the clear sky solar radiation according to :cite:t:`ref-Allen1998`.
1315
+
1316
+ Basic equation (:cite:t`ref-Allen1998`, eq. 35):
1317
+ :math:`ClearSkySolarRadiation =
1318
+ ExtraterrestrialRadiation \cdot (AngstromConstant + AngstromFactor)`
1319
+
1320
+ Example:
1321
+
1322
+ We use the Ångström coefficients (a=0.19, b=0.55) recommended for Germany by
1323
+ DVWK-M 504 :cite:t:`ref-DVWK` for January and the default values (a=0.25, b=0.5)
1324
+ for February:
1325
+
1326
+ >>> from hydpy import pub
1327
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
1328
+ >>> from hydpy.models.meteo import *
1329
+ >>> parameterstep()
1330
+ >>> angstromconstant.jan = 0.19
1331
+ >>> angstromfactor.jan = 0.55
1332
+ >>> angstromconstant.feb = 0.25
1333
+ >>> angstromfactor.feb = 0.5
1334
+ >>> derived.moy.update()
1335
+ >>> fluxes.extraterrestrialradiation = 200.0
1336
+ >>> model.idx_sim = 1
1337
+ >>> model.calc_clearskysolarradiation_v1()
1338
+ >>> fluxes.clearskysolarradiation
1339
+ clearskysolarradiation(148.0)
1340
+ >>> model.idx_sim = 2
1341
+ >>> model.calc_clearskysolarradiation_v1()
1342
+ >>> fluxes.clearskysolarradiation
1343
+ clearskysolarradiation(150.0)
1344
+
1345
+ .. testsetup::
1346
+
1347
+ >>> del pub.timegrids
1348
+ """
1349
+
1350
+ CONTROLPARAMETERS = (meteo_control.AngstromConstant, meteo_control.AngstromFactor)
1351
+ DERIVEDPARAMETERS = (meteo_derived.MOY,)
1352
+ REQUIREDSEQUENCES = (meteo_fluxes.ExtraterrestrialRadiation,)
1353
+ RESULTSEQUENCES = (meteo_fluxes.ClearSkySolarRadiation,)
1354
+
1355
+ @staticmethod
1356
+ def __call__(model: modeltools.Model) -> None:
1357
+ con = model.parameters.control.fastaccess
1358
+ der = model.parameters.derived.fastaccess
1359
+ flu = model.sequences.fluxes.fastaccess
1360
+ idx = der.moy[model.idx_sim]
1361
+ flu.clearskysolarradiation = flu.extraterrestrialradiation * (
1362
+ con.angstromconstant[idx] + con.angstromfactor[idx]
1363
+ )
1364
+
1365
+
1366
+ class Calc_GlobalRadiation_V1(modeltools.Method):
1367
+ r"""Calculate the global radiation according to :cite:t:`ref-Allen1998`.
1368
+
1369
+ Basic equation (:cite:t:`ref-Allen1998`, equation 35):
1370
+ :math:`GlobalRadiation = ExtraterrestrialRadiation \cdot (AngstromConstant +
1371
+ AngstromFactor \cdot SunshineDuration / PossibleSunshineDuration)`
1372
+
1373
+ Example:
1374
+
1375
+ We use the Ångström coefficients (a=0.19, b=0.55) recommended for Germany by
1376
+ DVWK-M 504 :cite:t:`ref-DVWK` for January and the default values (a=0.25, b=0.5)
1377
+ for February:
1378
+
1379
+ >>> from hydpy import pub, round_
1380
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
1381
+ >>> from hydpy.models.meteo import *
1382
+ >>> parameterstep()
1383
+ >>> angstromconstant.jan = 0.19
1384
+ >>> angstromfactor.jan = 0.55
1385
+ >>> angstromconstant.feb = 0.25
1386
+ >>> angstromfactor.feb = 0.5
1387
+ >>> derived.moy.update()
1388
+ >>> inputs.sunshineduration = 12.0
1389
+ >>> factors.possiblesunshineduration = 14.0
1390
+ >>> fluxes.extraterrestrialradiation = 200.0
1391
+ >>> model.idx_sim = 1
1392
+ >>> model.calc_globalradiation_v1()
1393
+ >>> fluxes.globalradiation
1394
+ globalradiation(132.285714)
1395
+ >>> model.idx_sim = 2
1396
+ >>> model.calc_globalradiation_v1()
1397
+ >>> fluxes.globalradiation
1398
+ globalradiation(135.714286)
1399
+
1400
+ For zero possible sunshine durations, |Calc_GlobalRadiation_V1| sets
1401
+ |meteo_fluxes.GlobalRadiation| to zero:
1402
+
1403
+ >>> factors.possiblesunshineduration = 0.0
1404
+ >>> model.calc_globalradiation_v1()
1405
+ >>> fluxes.globalradiation
1406
+ globalradiation(0.0)
1407
+
1408
+ .. testsetup::
1409
+
1410
+ >>> del pub.timegrids
1411
+ """
1412
+
1413
+ CONTROLPARAMETERS = (meteo_control.AngstromConstant, meteo_control.AngstromFactor)
1414
+ DERIVEDPARAMETERS = (meteo_derived.MOY,)
1415
+ REQUIREDSEQUENCES = (
1416
+ meteo_inputs.SunshineDuration,
1417
+ meteo_factors.PossibleSunshineDuration,
1418
+ meteo_fluxes.ExtraterrestrialRadiation,
1419
+ )
1420
+ RESULTSEQUENCES = (meteo_fluxes.GlobalRadiation,)
1421
+
1422
+ @staticmethod
1423
+ def __call__(model: modeltools.Model) -> None:
1424
+ con = model.parameters.control.fastaccess
1425
+ der = model.parameters.derived.fastaccess
1426
+ inp = model.sequences.inputs.fastaccess
1427
+ flu = model.sequences.fluxes.fastaccess
1428
+ fac = model.sequences.factors.fastaccess
1429
+ if fac.possiblesunshineduration > 0.0:
1430
+ idx = der.moy[model.idx_sim]
1431
+ flu.globalradiation = flu.extraterrestrialradiation * (
1432
+ con.angstromconstant[idx]
1433
+ + con.angstromfactor[idx]
1434
+ * inp.sunshineduration
1435
+ / fac.possiblesunshineduration
1436
+ )
1437
+ else:
1438
+ flu.globalradiation = 0.0
1439
+
1440
+
1441
+ class Calc_UnadjustedGlobalRadiation_V1(modeltools.Method):
1442
+ r"""Calculate the unadjusted global radiation according to :cite:t:`ref-LARSIM`.
1443
+
1444
+ Additional requirements:
1445
+ |Model.idx_sim|
1446
+
1447
+ Basic equation:
1448
+ .. math::
1449
+ UnadjustedGlobalRadiation =
1450
+ NmbLogEntries \cdot \frac{SP}{100} \cdot \begin{cases}
1451
+ Return\_DailyGlobalRadiation\_V1(
1452
+ SunshineDuration, PossibleSunshineDuration)
1453
+ &|\
1454
+ PossibleSunshineDuration > 0
1455
+ \\
1456
+ Return\_DailyGlobalRadiation\_V1(
1457
+ DailySunshineDuration, DailyPossibleSunshineDuration)
1458
+ &|\
1459
+ PossibleSunshineDuration = 0
1460
+ \end{cases}
1461
+
1462
+ Examples:
1463
+
1464
+ Method |Calc_UnadjustedGlobalRadiation_V1| uses the actual value of
1465
+ |PortionDailyRadiation| and method |Return_DailyGlobalRadiation_V1| to
1466
+ calculate global radiation according to the current values of
1467
+ |meteo_inputs.SunshineDuration| and |meteo_factors.PossibleSunshineDuration|:
1468
+
1469
+ >>> from hydpy import pub
1470
+ >>> pub.timegrids = "2000-01-31", "2000-02-02", "6h"
1471
+ >>> from hydpy.models.meteo import *
1472
+ >>> parameterstep()
1473
+ >>> derived.nmblogentries.update()
1474
+ >>> derived.moy.update()
1475
+ >>> derived.days.update()
1476
+ >>> angstromconstant.jan = 0.1
1477
+ >>> angstromfactor.jan = 0.5
1478
+ >>> angstromalternative.jan = 0.2
1479
+ >>> inputs.sunshineduration = 0.6
1480
+ >>> factors.possiblesunshineduration = 1.0
1481
+ >>> fluxes.extraterrestrialradiation = 340.0
1482
+ >>> factors.portiondailyradiation = 50.0
1483
+ >>> model.idx_sim = 3
1484
+ >>> model.calc_unadjustedglobalradiation_v1()
1485
+ >>> fluxes.unadjustedglobalradiation
1486
+ unadjustedglobalradiation(272.0)
1487
+
1488
+ During nighttime periods, the value of |meteo_factors.PossibleSunshineDuration|
1489
+ is zero. Then, |Calc_GlobalRadiation_V1| uses the values of
1490
+ |DailySunshineDuration| and |DailyPossibleSunshineDuration| as surrogates:
1491
+
1492
+ >>> factors.possiblesunshineduration = 0.0
1493
+ >>> factors.dailysunshineduration = 4.0
1494
+ >>> factors.dailypossiblesunshineduration = 10.0
1495
+ >>> model.calc_unadjustedglobalradiation_v1()
1496
+ >>> fluxes.unadjustedglobalradiation
1497
+ unadjustedglobalradiation(204.0)
1498
+
1499
+ .. testsetup::
1500
+
1501
+ >>> del pub.timegrids
1502
+ """
1503
+
1504
+ SUBMETHODS = (Return_DailyGlobalRadiation_V1,)
1505
+ CONTROLPARAMETERS = (
1506
+ meteo_control.AngstromConstant,
1507
+ meteo_control.AngstromFactor,
1508
+ meteo_control.AngstromAlternative,
1509
+ )
1510
+ DERIVEDPARAMETERS = (
1511
+ meteo_derived.NmbLogEntries,
1512
+ meteo_derived.MOY,
1513
+ meteo_derived.Days,
1514
+ )
1515
+ REQUIREDSEQUENCES = (
1516
+ meteo_inputs.SunshineDuration,
1517
+ meteo_factors.PossibleSunshineDuration,
1518
+ meteo_factors.DailySunshineDuration,
1519
+ meteo_factors.DailyPossibleSunshineDuration,
1520
+ meteo_factors.PortionDailyRadiation,
1521
+ meteo_fluxes.ExtraterrestrialRadiation,
1522
+ )
1523
+ RESULTSEQUENCES = (meteo_fluxes.UnadjustedGlobalRadiation,)
1524
+
1525
+ @staticmethod
1526
+ def __call__(model: modeltools.Model) -> None:
1527
+ der = model.parameters.derived.fastaccess
1528
+ inp = model.sequences.inputs.fastaccess
1529
+ fac = model.sequences.factors.fastaccess
1530
+ flu = model.sequences.fluxes.fastaccess
1531
+ if fac.possiblesunshineduration > 0.0:
1532
+ d_act = inp.sunshineduration
1533
+ d_pos = fac.possiblesunshineduration
1534
+ else:
1535
+ d_act = fac.dailysunshineduration
1536
+ d_pos = fac.dailypossiblesunshineduration
1537
+ flu.unadjustedglobalradiation = (
1538
+ der.nmblogentries * fac.portiondailyradiation / 100.0
1539
+ ) * model.return_dailyglobalradiation_v1(d_act, d_pos)
1540
+
1541
+
1542
+ class Adjust_ClearSkySolarRadiation_V1(modeltools.Method):
1543
+ r"""Use the portion of the daily radiation sum to adjust the clear sky solar
1544
+ radiation's daily average to the current simulation step.
1545
+
1546
+ Basic equation:
1547
+ .. math::
1548
+ C_{new} = N \cdot P / 100 \cdot C_{old}
1549
+ \\ \\
1550
+ C = ClearSkySolarRadiation \\
1551
+ N = NmbLogEntries \\
1552
+ P = PortionDailyRadiation
1553
+
1554
+ Example:
1555
+
1556
+ >>> from hydpy.models.meteo import *
1557
+ >>> parameterstep()
1558
+ >>> derived.nmblogentries(4)
1559
+ >>> factors.portiondailyradiation = 10.0
1560
+ >>> fluxes.clearskysolarradiation = 200.0
1561
+ >>> model.adjust_clearskysolarradiation_v1()
1562
+ >>> fluxes.clearskysolarradiation
1563
+ clearskysolarradiation(80.0)
1564
+ """
1565
+
1566
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
1567
+ REQUIREDSEQUENCES = (meteo_factors.PortionDailyRadiation,)
1568
+ UPDATEDSEQUENCES = (meteo_fluxes.ClearSkySolarRadiation,)
1569
+
1570
+ @staticmethod
1571
+ def __call__(model: modeltools.Model) -> None:
1572
+ der = model.parameters.derived.fastaccess
1573
+ fac = model.sequences.factors.fastaccess
1574
+ flu = model.sequences.fluxes.fastaccess
1575
+ flu.clearskysolarradiation *= (
1576
+ der.nmblogentries * fac.portiondailyradiation / 100.0
1577
+ )
1578
+
1579
+
1580
+ class Update_LoggedUnadjustedGlobalRadiation_V1(modeltools.Method):
1581
+ """Log the unadjusted global radiation values of the last 24 hours.
1582
+
1583
+ Example:
1584
+
1585
+ The following example shows that each new method call successively moves the
1586
+ three memorised values to the right and stores the respective new value on the
1587
+ most left position:
1588
+
1589
+ >>> from hydpy.models.meteo import *
1590
+ >>> simulationstep("8h")
1591
+ >>> parameterstep()
1592
+ >>> derived.nmblogentries.update()
1593
+ >>> logs.loggedunadjustedglobalradiation = 0.0
1594
+ >>> from hydpy import UnitTest
1595
+ >>> test = UnitTest(model,
1596
+ ... model.update_loggedunadjustedglobalradiation_v1,
1597
+ ... last_example=4,
1598
+ ... parseqs=(fluxes.unadjustedglobalradiation,
1599
+ ... logs.loggedunadjustedglobalradiation))
1600
+ >>> test.nexts.unadjustedglobalradiation = 1.0, 3.0, 2.0, 4.0
1601
+ >>> del test.inits.loggedunadjustedglobalradiation
1602
+ >>> test()
1603
+ | ex. | unadjustedglobalradiation | loggedunadjustedglobalradiation |
1604
+ -------------------------------------------------------------------------------
1605
+ | 1 | 1.0 | 1.0 0.0 0.0 |
1606
+ | 2 | 3.0 | 3.0 1.0 0.0 |
1607
+ | 3 | 2.0 | 2.0 3.0 1.0 |
1608
+ | 4 | 4.0 | 4.0 2.0 3.0 |
1609
+ """
1610
+
1611
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
1612
+ REQUIREDSEQUENCES = (meteo_fluxes.UnadjustedGlobalRadiation,)
1613
+ UPDATEDSEQUENCES = (meteo_logs.LoggedUnadjustedGlobalRadiation,)
1614
+
1615
+ @staticmethod
1616
+ def __call__(model: modeltools.Model) -> None:
1617
+ der = model.parameters.derived.fastaccess
1618
+ flu = model.sequences.fluxes.fastaccess
1619
+ log = model.sequences.logs.fastaccess
1620
+ for idx in range(der.nmblogentries - 1, 0, -1):
1621
+ log.loggedunadjustedglobalradiation[idx] = (
1622
+ log.loggedunadjustedglobalradiation[idx - 1]
1623
+ )
1624
+ log.loggedunadjustedglobalradiation[0] = flu.unadjustedglobalradiation
1625
+
1626
+
1627
+ class Calc_DailyGlobalRadiation_V1(modeltools.Method):
1628
+ r"""Calculate the daily global radiation.
1629
+
1630
+ Additional requirements:
1631
+ |Model.idx_sim|
1632
+
1633
+ Basic equation:
1634
+ :math:`DailyGlobalRadiation = Return\_DailyGlobalRadiation\_V1(
1635
+ DailySunshineDuration, DailyPossibleSunshineDuration)`
1636
+
1637
+ Example:
1638
+
1639
+ >>> from hydpy.models.meteo import *
1640
+ >>> parameterstep()
1641
+ >>> from hydpy import pub
1642
+ >>> angstromconstant.jan = 0.1
1643
+ >>> angstromfactor.jan = 0.5
1644
+ >>> angstromconstant.feb = 0.2
1645
+ >>> angstromfactor.feb = 0.6
1646
+
1647
+ We set the extraterrestrial radiation to 200 W/m² and the possible sunshine
1648
+ duration to 12 hours:
1649
+
1650
+ >>> fluxes.extraterrestrialradiation = 200.0
1651
+ >>> factors.dailypossiblesunshineduration = 12.0
1652
+
1653
+ We define a daily simulation step size and update the relevant derived
1654
+ parameters:
1655
+
1656
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
1657
+ >>> derived.moy.update()
1658
+
1659
+ Applying the Ångström coefficients for January and February on the defined
1660
+ extraterrestrial radiation and a sunshine duration of 7.2 hours results in a
1661
+ daily global radiation average of 80 and 112 W/m², respectively:
1662
+
1663
+ >>> model.idx_sim = 1
1664
+ >>> factors.dailysunshineduration = 7.2
1665
+ >>> model.calc_dailyglobalradiation_v1()
1666
+ >>> fluxes.dailyglobalradiation
1667
+ dailyglobalradiation(80.0)
1668
+
1669
+ >>> model.idx_sim = 2
1670
+ >>> model.calc_dailyglobalradiation_v1()
1671
+ >>> fluxes.dailyglobalradiation
1672
+ dailyglobalradiation(112.0)
1673
+
1674
+ Finally, we demonstrate for January that method |Calc_DailyGlobalRadiation_V1|
1675
+ calculates the same values for an hourly simulation time step, as long as the
1676
+ daily sum of sunshine duration remains identical:
1677
+
1678
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1h"
1679
+ >>> derived.moy.update()
1680
+
1681
+ The actual simulation step starts at 11 o'clock and ends at 12 o'clock:
1682
+
1683
+ >>> model.idx_sim = pub.timegrids.init["2000-01-31 11:00"]
1684
+ >>> factors.dailysunshineduration = 7.2
1685
+ >>> model.calc_dailyglobalradiation_v1()
1686
+ >>> fluxes.dailyglobalradiation
1687
+ dailyglobalradiation(80.0)
1688
+
1689
+ .. testsetup::
1690
+
1691
+ >>> del pub.timegrids
1692
+ """
1693
+
1694
+ SUBMETHODS = (Return_DailyGlobalRadiation_V1,)
1695
+ CONTROLPARAMETERS = (
1696
+ meteo_control.AngstromConstant,
1697
+ meteo_control.AngstromFactor,
1698
+ meteo_control.AngstromAlternative,
1699
+ )
1700
+ DERIVEDPARAMETERS = (meteo_derived.MOY, meteo_derived.Days)
1701
+ REQUIREDSEQUENCES = (
1702
+ meteo_factors.DailySunshineDuration,
1703
+ meteo_factors.DailyPossibleSunshineDuration,
1704
+ meteo_fluxes.ExtraterrestrialRadiation,
1705
+ )
1706
+ UPDATEDSEQUENCES = (meteo_fluxes.DailyGlobalRadiation,)
1707
+
1708
+ @staticmethod
1709
+ def __call__(model: modeltools.Model) -> None:
1710
+ fac = model.sequences.factors.fastaccess
1711
+ flu = model.sequences.fluxes.fastaccess
1712
+ flu.dailyglobalradiation = model.return_dailyglobalradiation_v1(
1713
+ fac.dailysunshineduration, fac.dailypossiblesunshineduration
1714
+ )
1715
+
1716
+
1717
+ class Return_SunshineDuration_V1(modeltools.Method):
1718
+ r"""Calculate the sunshine duration reversely to |Return_DailyGlobalRadiation_V1|
1719
+ and return it.
1720
+
1721
+ Basic equation:
1722
+ :math:`\frac{possiblesunshineduration}{AngstromFactor} \cdot \left(
1723
+ \frac{globalradiation}{extraterrestrialradiation} - AngstromConstant \right)`
1724
+
1725
+ Example:
1726
+
1727
+ Essentially, |Return_SunshineDuration_V1| tries to invert
1728
+ |Return_DailyGlobalRadiation_V1| and thus also relies on the Ångström formula.
1729
+ Instead of estimating global radiation from sunshine duration, it estimates
1730
+ sunshine duration from global radiation. We demonstrate this by repeating the
1731
+ first examples of |Calc_GlobalRadiation_V1| "backwards":
1732
+
1733
+ >>> from hydpy import pub, round_
1734
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
1735
+ >>> from hydpy.models.meteo import *
1736
+ >>> parameterstep()
1737
+ >>> derived.moy.update()
1738
+ >>> angstromconstant.jan = 0.1
1739
+ >>> angstromfactor.jan = 0.5
1740
+ >>> angstromalternative.jan = 0.2
1741
+ >>> angstromconstant.feb = 0.2
1742
+ >>> angstromfactor.feb = 0.6
1743
+ >>> angstromalternative.feb = 0.3
1744
+ >>> model.idx_sim = 1
1745
+ >>> round_(model.return_sunshineduration_v1(136.0, 340.0, 1.0))
1746
+ 0.6
1747
+ >>> model.idx_sim = 2
1748
+ >>> round_(model.return_sunshineduration_v1(190.4, 340.0, 1.0))
1749
+ 0.6
1750
+
1751
+ In contrast to |Return_DailyGlobalRadiation_V1|, |Return_SunshineDuration_V1|
1752
+ never applies |AngstromAlternative| instead of |AngstromConstant|. Hence, as
1753
+ in the following repeated examples, |Return_SunshineDuration_V1| might invert
1754
+ |Return_DailyGlobalRadiation_V1| only roughly during periods with little
1755
+ sunshine:
1756
+
1757
+ >>> model.idx_sim = 1
1758
+ >>> round_(model.return_sunshineduration_v1(68.0, 340.0, 1.0))
1759
+ 0.2
1760
+ >>> model.idx_sim = 2
1761
+ >>> round_(model.return_sunshineduration_v1(102.0, 340.0, 1.0))
1762
+ 0.166667
1763
+
1764
+ We must consider additional corner cases. The first one deals with a potential
1765
+ zero division during nighttime. If extraterrestrial radiation is zero,
1766
+ |Return_SunshineDuration_V1| takes the astronomically possible sunshine
1767
+ duration (which should ideally also be zero) as the actual sunshine duration:
1768
+
1769
+ >>> model.idx_sim = 1
1770
+ >>> round_(model.return_sunshineduration_v1(136.0, 0.0, 0.00001))
1771
+ 0.00001
1772
+
1773
+ Measured global radiation smaller than estimated diffusive radiation would
1774
+ result in negative sunshine durations when following the Ångström formula
1775
+ strictly. Additionally, measured global radiation larger than estimated
1776
+ clear-sky radiation would result in sunshine durations larger than the
1777
+ astronomically possible sunshine duration. The following example shows that
1778
+ method |Return_SunshineDuration_V1| prevents such inconsistencies by trimming
1779
+ the estimated sunshine duration when necessary:
1780
+
1781
+ >>> for globrad in (0.0, 34.0, 35.0, 136.0, 203.0, 204.0, 340.0):
1782
+ ... sundur = model.return_sunshineduration_v1(globrad, 340.0, 1.0)
1783
+ ... round_((globrad, sundur))
1784
+ 0.0, 0.0
1785
+ 34.0, 0.0
1786
+ 35.0, 0.005882
1787
+ 136.0, 0.6
1788
+ 203.0, 0.994118
1789
+ 204.0, 1.0
1790
+ 340.0, 1.0
1791
+
1792
+ .. testsetup::
1793
+
1794
+ >>> del pub.timegrids
1795
+ """
1796
+
1797
+ SUBMETHODS = ()
1798
+ CONTROLPARAMETERS = (meteo_control.AngstromConstant, meteo_control.AngstromFactor)
1799
+ DERIVEDPARAMETERS = (meteo_derived.MOY,)
1800
+
1801
+ @staticmethod
1802
+ def __call__(
1803
+ model: modeltools.Model,
1804
+ globalradiation: float,
1805
+ extraterrestrialradiation: float,
1806
+ possiblesunshineduration: float,
1807
+ ) -> float:
1808
+ con = model.parameters.control.fastaccess
1809
+ der = model.parameters.derived.fastaccess
1810
+ if extraterrestrialradiation <= 0.0:
1811
+ return possiblesunshineduration
1812
+ idx = der.moy[model.idx_sim]
1813
+ d_sd = (possiblesunshineduration / con.angstromfactor[idx]) * (
1814
+ globalradiation / extraterrestrialradiation - con.angstromconstant[idx]
1815
+ )
1816
+ return min(max(d_sd, 0.0), possiblesunshineduration)
1817
+
1818
+
1819
+ class Calc_UnadjustedSunshineDuration_V1(modeltools.Method):
1820
+ r"""Calculate the unadjusted sunshine duration reversely to
1821
+ |Calc_UnadjustedGlobalRadiation_V1|.
1822
+
1823
+ Additional requirements:
1824
+ |Model.idx_sim|
1825
+
1826
+ Basic equation:
1827
+ :math:`UnadjustedSunshineDuration = Return\_SunshineDuration
1828
+ \left( GlobalRadiation, NmbLogEntries \cdot \frac{PortionDailyRadiation}{100}
1829
+ \cdot ExtraterrestrialRadiation, PossibleSunshineDuration \right)`
1830
+
1831
+ Example:
1832
+
1833
+ Method |Calc_UnadjustedSunshineDuration_V1| relies on
1834
+ |Return_SunshineDuration_V1| and thus has the same limitation regarding periods
1835
+ with little sunshine. See its documentation for further information. Here, we
1836
+ only demonstrate the proper passing of |meteo_inputs.GlobalRadiation|,
1837
+ |ExtraterrestrialRadiation| (eventually reduced by |PortionDailyRadiation|) and
1838
+ |meteo_factors.PossibleSunshineDuration|:
1839
+
1840
+ >>> from hydpy import pub
1841
+ >>> pub.timegrids = "2000-01-31", "2000-02-02", "6h"
1842
+ >>> from hydpy.models.meteo import *
1843
+ >>> parameterstep()
1844
+ >>> derived.nmblogentries.update()
1845
+ >>> derived.moy.update()
1846
+ >>> angstromconstant.jan = 0.1
1847
+ >>> angstromfactor.jan = 0.5
1848
+ >>> inputs.globalradiation = 272.0
1849
+ >>> factors.possiblesunshineduration = 1.0
1850
+ >>> factors.portiondailyradiation = 50.0
1851
+ >>> fluxes.extraterrestrialradiation = 340.0
1852
+ >>> model.idx_sim = 3
1853
+ >>> model.calc_unadjustedsunshineduration_v1()
1854
+ >>> factors.unadjustedsunshineduration
1855
+ unadjustedsunshineduration(0.6)
1856
+
1857
+ .. testsetup::
1858
+
1859
+ >>> del pub.timegrids
1860
+ """
1861
+
1862
+ SUBMETHODS = (Return_SunshineDuration_V1,)
1863
+ CONTROLPARAMETERS = (meteo_control.AngstromConstant, meteo_control.AngstromFactor)
1864
+ DERIVEDPARAMETERS = (meteo_derived.MOY, meteo_derived.NmbLogEntries)
1865
+ REQUIREDSEQUENCES = (
1866
+ meteo_inputs.GlobalRadiation,
1867
+ meteo_factors.PossibleSunshineDuration,
1868
+ meteo_factors.PortionDailyRadiation,
1869
+ meteo_fluxes.ExtraterrestrialRadiation,
1870
+ )
1871
+ RESULTSEQUENCES = (meteo_factors.UnadjustedSunshineDuration,)
1872
+
1873
+ @staticmethod
1874
+ def __call__(model: modeltools.Model) -> None:
1875
+ der = model.parameters.derived.fastaccess
1876
+ inp = model.sequences.inputs.fastaccess
1877
+ fac = model.sequences.factors.fastaccess
1878
+ flu = model.sequences.fluxes.fastaccess
1879
+ fac.unadjustedsunshineduration = model.return_sunshineduration_v1(
1880
+ inp.globalradiation,
1881
+ flu.extraterrestrialradiation
1882
+ * der.nmblogentries
1883
+ * fac.portiondailyradiation
1884
+ / 100.0,
1885
+ fac.possiblesunshineduration,
1886
+ )
1887
+
1888
+
1889
+ class Calc_GlobalRadiation_V2(modeltools.Method):
1890
+ r"""Adjust the current global radiation to the daily global radiation according to
1891
+ :cite:t:`ref-LARSIM`.
1892
+
1893
+ Additional requirements:
1894
+ |Model.idx_sim|
1895
+
1896
+ Basic equation:
1897
+ :math:`GlobalRadiation = UnadjustedGlobalRadiation \cdot
1898
+ \frac{DailyGlobalRadiation}{\sum LoggedUnadjustedGlobalRadiation / NmbLogEntries}`
1899
+
1900
+ Examples:
1901
+
1902
+ The purpose of method |Calc_GlobalRadiation_V2| is to adjust hourly global
1903
+ radiation values (or those of other short simulation time steps) so that their
1904
+ mean over the last 24 hours equals the global radiation value directly
1905
+ calculated with the relative sunshine duration over the last 24 hours. We try
1906
+ to explain this somewhat counterintuitive approach by extending the
1907
+ documentation examples on method |Calc_DailyGlobalRadiation_V1|.
1908
+
1909
+ Again, we start with a daily simulation time step:
1910
+
1911
+ >>> from hydpy.models.meteo import *
1912
+ >>> simulationstep("1d")
1913
+ >>> parameterstep()
1914
+ >>> derived.nmblogentries.update()
1915
+
1916
+ For such a daily simulation time step, the values of the sequences
1917
+ |UnadjustedGlobalRadiation|, |DailyGlobalRadiation|, and
1918
+ |LoggedUnadjustedGlobalRadiation| must be identical:
1919
+
1920
+ >>> model.idx_sim = 1
1921
+ >>> fluxes.unadjustedglobalradiation = 200.0
1922
+ >>> fluxes.dailyglobalradiation = 200.0
1923
+ >>> logs.loggedunadjustedglobalradiation = 200.0
1924
+
1925
+ After calling |Calc_GlobalRadiation_V2|, the same holds for the adjusted global
1926
+ radiation sum:
1927
+
1928
+ >>> model.calc_globalradiation_v2()
1929
+ >>> fluxes.globalradiation
1930
+ globalradiation(200.0)
1931
+
1932
+ Intuitively, one would not expect method |Calc_GlobalRadiation_V2| to have any
1933
+ effect when applied on daily simulation time steps at all. However, it
1934
+ corrects "wrong" predefined global radiation values:
1935
+
1936
+ >>> fluxes.dailyglobalradiation = 280.0
1937
+ >>> model.calc_globalradiation_v2()
1938
+ >>> fluxes.globalradiation
1939
+ globalradiation(280.0)
1940
+
1941
+ We now demonstrate how method |Calc_GlobalRadiation_V2| works for hourly
1942
+ simulation time steps:
1943
+
1944
+ >>> simulationstep("1h")
1945
+ >>> derived.nmblogentries.update()
1946
+
1947
+ The daily global radiation value does not depend on the simulation timestep.
1948
+ We reset it to 200 W/m²:
1949
+
1950
+ >>> fluxes.dailyglobalradiation = 200.0
1951
+
1952
+ The other global radiation values must be smaller and vary throughout the day.
1953
+ We set them in agreement with the logged sunshine duration specified in the
1954
+ documentation on method |Calc_DailyGlobalRadiation_V1|:
1955
+
1956
+ >>> fluxes.unadjustedglobalradiation = 960.0
1957
+ >>> logs.loggedunadjustedglobalradiation = (
1958
+ ... 960.0, 960.0, 240.0, 120.0, 120.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
1959
+ ... 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 120.0, 480.0, 720.0, 840.0, 960.0)
1960
+
1961
+ Compared with the total 24 hours, the simulation time steps around noon are
1962
+ relatively sunny, both for the current and the last day (see the first and the
1963
+ last entry of the log sequence for the sunshine duration). Accordingly, the
1964
+ hourly global radiation values' mean (230 W/m²) is larger than the directly
1965
+ calculated daily mean (200 W/m²). Method |Calc_GlobalRadiation_V2| uses the
1966
+ fraction of both sums to calculate the adjusted global radiation
1967
+ (:math:`960 \cdot 200 / 230`):
1968
+
1969
+ >>> model.calc_globalradiation_v2()
1970
+ >>> fluxes.globalradiation
1971
+ globalradiation(834.782609)
1972
+ """
1973
+
1974
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
1975
+ REQUIREDSEQUENCES = (
1976
+ meteo_fluxes.UnadjustedGlobalRadiation,
1977
+ meteo_fluxes.DailyGlobalRadiation,
1978
+ meteo_logs.LoggedUnadjustedGlobalRadiation,
1979
+ )
1980
+ RESULTSEQUENCES = (meteo_fluxes.GlobalRadiation,)
1981
+
1982
+ @staticmethod
1983
+ def __call__(model: modeltools.Model) -> None:
1984
+ der = model.parameters.derived.fastaccess
1985
+ flu = model.sequences.fluxes.fastaccess
1986
+ log = model.sequences.logs.fastaccess
1987
+ d_glob_sum = 0.0
1988
+ for idx in range(der.nmblogentries):
1989
+ d_glob_sum += log.loggedunadjustedglobalradiation[idx]
1990
+ d_glob_mean = d_glob_sum / der.nmblogentries
1991
+ flu.globalradiation = (
1992
+ flu.unadjustedglobalradiation * flu.dailyglobalradiation / d_glob_mean
1993
+ )
1994
+
1995
+
1996
+ class Calc_SunshineDuration_V1(modeltools.Method):
1997
+ r"""Calculate the sunshine duration according to :cite:t:`ref-Allen1998`.
1998
+
1999
+ Basic equation (:cite:t:`ref-Allen1998`, equation 35, rearranged):
2000
+ :math:`SunshineDuration =
2001
+ \left(\frac{GlobalRadiation}{ExtraterrestrialRadiation}-AngstromConstant \right)
2002
+ \cdot \frac{PossibleSunshineDuration}{AngstromFactor}`
2003
+
2004
+ Example:
2005
+
2006
+ Essentially, |Calc_SunshineDuration_V1| inverts |Calc_GlobalRadiation_V1| and
2007
+ thus also relies on the Ångström formula. Instead of estimating global
2008
+ radiation from sunshine duration, it estimates global radiation from sunshine
2009
+ duration. We demonstrate this by repeating the examples of
2010
+ |Calc_GlobalRadiation_V1| "backwards":
2011
+
2012
+ >>> from hydpy import pub, round_
2013
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
2014
+ >>> from hydpy.models.meteo import *
2015
+ >>> parameterstep()
2016
+ >>> angstromconstant.jan = 0.19
2017
+ >>> angstromfactor.jan = 0.55
2018
+ >>> angstromconstant.feb = 0.25
2019
+ >>> angstromfactor.feb = 0.5
2020
+ >>> derived.moy.update()
2021
+ >>> factors.possiblesunshineduration = 14.0
2022
+ >>> fluxes.extraterrestrialradiation = 200.0
2023
+ >>> model.idx_sim = 1
2024
+ >>> inputs.globalradiation = 132.285714
2025
+ >>> model.calc_sunshineduration_v1()
2026
+ >>> factors.sunshineduration
2027
+ sunshineduration(12.0)
2028
+ >>> model.idx_sim = 2
2029
+ >>> inputs.globalradiation = 135.714286
2030
+ >>> model.calc_sunshineduration_v1()
2031
+ >>> factors.sunshineduration
2032
+ sunshineduration(12.0)
2033
+
2034
+ |Calc_SunshineDuration_V1| sets |meteo_factors.SunshineDuration| to zero for
2035
+ zero extraterrestrial radiation:
2036
+
2037
+ >>> fluxes.extraterrestrialradiation = 0.0
2038
+ >>> model.calc_sunshineduration_v1()
2039
+ >>> factors.sunshineduration
2040
+ sunshineduration(0.0)
2041
+
2042
+ Inconsistencies between global radiation measurements and the Ångström formula
2043
+ (and the selected coefficients) can result in unrealistic sunshine duration
2044
+ estimates. Method |Calc_SunshineDuration_V1| reduces this problem by lowering
2045
+ too high values to the possible sunshine duration and increasing too low values
2046
+ to zero:
2047
+
2048
+ >>> fluxes.extraterrestrialradiation = 200.0
2049
+ >>> inputs.globalradiation = 210.0
2050
+ >>> model.calc_sunshineduration_v1()
2051
+ >>> factors.sunshineduration
2052
+ sunshineduration(14.0)
2053
+
2054
+ >>> inputs.globalradiation = 0.0
2055
+ >>> model.calc_sunshineduration_v1()
2056
+ >>> factors.sunshineduration
2057
+ sunshineduration(0.0)
2058
+
2059
+ .. testsetup::
2060
+
2061
+ >>> del pub.timegrids
2062
+ """
2063
+
2064
+ CONTROLPARAMETERS = (meteo_control.AngstromConstant, meteo_control.AngstromFactor)
2065
+ DERIVEDPARAMETERS = (meteo_derived.MOY,)
2066
+ REQUIREDSEQUENCES = (
2067
+ meteo_inputs.GlobalRadiation,
2068
+ meteo_factors.PossibleSunshineDuration,
2069
+ meteo_fluxes.ExtraterrestrialRadiation,
2070
+ )
2071
+ RESULTSEQUENCES = (meteo_factors.SunshineDuration,)
2072
+
2073
+ @staticmethod
2074
+ def __call__(model: modeltools.Model) -> None:
2075
+ con = model.parameters.control.fastaccess
2076
+ der = model.parameters.derived.fastaccess
2077
+ inp = model.sequences.inputs.fastaccess
2078
+ flu = model.sequences.fluxes.fastaccess
2079
+ fac = model.sequences.factors.fastaccess
2080
+ if flu.extraterrestrialradiation > 0.0:
2081
+ idx = der.moy[model.idx_sim]
2082
+ d_sd = (
2083
+ (inp.globalradiation / flu.extraterrestrialradiation)
2084
+ - con.angstromconstant[idx]
2085
+ ) * (fac.possiblesunshineduration / con.angstromfactor[idx])
2086
+ fac.sunshineduration = min(max(d_sd, 0.0), fac.possiblesunshineduration)
2087
+ else:
2088
+ fac.sunshineduration = 0.0
2089
+
2090
+
2091
+ class Update_LoggedUnadjustedSunshineDuration_V1(modeltools.Method):
2092
+ """Log the unadjusted sunshine duration values of the last 24 hours.
2093
+
2094
+ Example:
2095
+
2096
+ The following example shows that each new method call successively moves the
2097
+ three memorised values to the right and stores the respective new value on the
2098
+ most left position:
2099
+
2100
+ >>> from hydpy.models.meteo import *
2101
+ >>> simulationstep("8h")
2102
+ >>> parameterstep()
2103
+ >>> derived.nmblogentries.update()
2104
+ >>> logs.loggedunadjustedsunshineduration = 0.0
2105
+ >>> from hydpy import UnitTest
2106
+ >>> test = UnitTest(model,
2107
+ ... model.update_loggedunadjustedsunshineduration_v1,
2108
+ ... last_example=4,
2109
+ ... parseqs=(factors.unadjustedsunshineduration,
2110
+ ... logs.loggedunadjustedsunshineduration))
2111
+ >>> test.nexts.unadjustedsunshineduration = 1.0, 3.0, 2.0, 4.0
2112
+ >>> del test.inits.loggedunadjustedsunshineduration
2113
+ >>> test() # doctest: +ELLIPSIS
2114
+ | ex. | unadjustedsunshineduration | ... loggedunadjustedsunshineduration |
2115
+ -------------------------------------...-----------------------------------
2116
+ | 1 | 1.0 | 1.0 0.0 ... 0.0 |
2117
+ | 2 | 3.0 | 3.0 1.0 ... 0.0 |
2118
+ | 3 | 2.0 | 2.0 3.0 ... 1.0 |
2119
+ | 4 | 4.0 | 4.0 2.0 ... 3.0 |
2120
+ """
2121
+
2122
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
2123
+ REQUIREDSEQUENCES = (meteo_factors.UnadjustedSunshineDuration,)
2124
+ UPDATEDSEQUENCES = (meteo_logs.LoggedUnadjustedSunshineDuration,)
2125
+
2126
+ @staticmethod
2127
+ def __call__(model: modeltools.Model) -> None:
2128
+ der = model.parameters.derived.fastaccess
2129
+ fac = model.sequences.factors.fastaccess
2130
+ log = model.sequences.logs.fastaccess
2131
+ for idx in range(der.nmblogentries - 1, 0, -1):
2132
+ log.loggedunadjustedsunshineduration[idx] = (
2133
+ log.loggedunadjustedsunshineduration[idx - 1]
2134
+ )
2135
+ log.loggedunadjustedsunshineduration[0] = fac.unadjustedsunshineduration
2136
+
2137
+
2138
+ class Calc_DailySunshineDuration_V2(modeltools.Method):
2139
+ r"""Calculate the daily sunshine duration reversely to
2140
+ |Calc_DailyGlobalRadiation_V1|.
2141
+
2142
+ Additional requirements:
2143
+ |Model.idx_sim|
2144
+
2145
+ Basic equation:
2146
+ :math:`DailySunshineDuration = Return\_SunshineDuration \left(
2147
+ DailyGlobalRadiation, ExtraterrestrialRadiation, DailyPossibleSunshineDuration
2148
+ \right)`
2149
+
2150
+ Example:
2151
+
2152
+ Method |Calc_UnadjustedSunshineDuration_V1| relies on
2153
+ |Return_SunshineDuration_V1| and thus comes with the same limitation regarding
2154
+ periods with little sunshine. See its documentation for further information.
2155
+ Here, we only demonstrate the proper passing of |DailyGlobalRadiation|,
2156
+ |ExtraterrestrialRadiation|, and |DailyPossibleSunshineDuration|:
2157
+
2158
+ >>> from hydpy import pub
2159
+ >>> pub.timegrids = "2000-01-30", "2000-02-03", "1d"
2160
+ >>> from hydpy.models.meteo import *
2161
+ >>> parameterstep()
2162
+ >>> derived.moy.update()
2163
+ >>> angstromconstant.jan = 0.1
2164
+ >>> angstromfactor.jan = 0.5
2165
+ >>> factors.dailypossiblesunshineduration = 12.0
2166
+ >>> fluxes.dailyglobalradiation = 80.0
2167
+ >>> fluxes.extraterrestrialradiation = 200.0
2168
+ >>> model.idx_sim = 1
2169
+ >>> model.calc_dailysunshineduration_v2()
2170
+ >>> factors.dailysunshineduration
2171
+ dailysunshineduration(7.2)
2172
+
2173
+ .. testsetup::
2174
+
2175
+ >>> del pub.timegrids
2176
+ """
2177
+
2178
+ SUBMETHODS = (Return_SunshineDuration_V1,)
2179
+ CONTROLPARAMETERS = (meteo_control.AngstromConstant, meteo_control.AngstromFactor)
2180
+ DERIVEDPARAMETERS = (meteo_derived.MOY,)
2181
+ REQUIREDSEQUENCES = (
2182
+ meteo_factors.DailyPossibleSunshineDuration,
2183
+ meteo_fluxes.DailyGlobalRadiation,
2184
+ meteo_fluxes.ExtraterrestrialRadiation,
2185
+ )
2186
+ RESULTSEQUENCES = (meteo_factors.DailySunshineDuration,)
2187
+
2188
+ @staticmethod
2189
+ def __call__(model: modeltools.Model) -> None:
2190
+ fac = model.sequences.factors.fastaccess
2191
+ flu = model.sequences.fluxes.fastaccess
2192
+ fac.dailysunshineduration = model.return_sunshineduration_v1(
2193
+ flu.dailyglobalradiation,
2194
+ flu.extraterrestrialradiation,
2195
+ fac.dailypossiblesunshineduration,
2196
+ )
2197
+
2198
+
2199
+ class Calc_SunshineDuration_V2(modeltools.Method):
2200
+ r"""Adjust the current sunshine duration to the daily sunshine duration like
2201
+ |Calc_GlobalRadiation_V2| adjusts the current global radiation to the daily global
2202
+ radiation.
2203
+
2204
+ Additional requirements:
2205
+ |Model.idx_sim|
2206
+
2207
+ Basic equation:
2208
+ :math:`SunshineDuration = UnadjustedSunshineDuration \cdot
2209
+ \frac{DailySunshineDuration}{\sum LoggedUnadjustedSunshineDuration}`
2210
+
2211
+ Examples:
2212
+
2213
+ |Calc_SunshineDuration_V2| implements a standardisation approach following the
2214
+ reasons and strategy explained in the documentation on method
2215
+ |Calc_GlobalRadiation_V2|. Hence, we first adopt its examples without repeated
2216
+ explanations:
2217
+
2218
+ >>> from hydpy.models.meteo import *
2219
+ >>> simulationstep("1d")
2220
+ >>> parameterstep()
2221
+ >>> derived.nmblogentries.update()
2222
+ >>> model.idx_sim = 1
2223
+ >>> factors.unadjustedsunshineduration = 4.0
2224
+ >>> factors.dailysunshineduration = 4.0
2225
+ >>> logs.loggedunadjustedsunshineduration = 4.0
2226
+ >>> model.calc_sunshineduration_v2()
2227
+ >>> factors.sunshineduration
2228
+ sunshineduration(4.0)
2229
+ >>> factors.dailysunshineduration = 5.6
2230
+ >>> model.calc_sunshineduration_v2()
2231
+ >>> factors.sunshineduration
2232
+ sunshineduration(5.6)
2233
+
2234
+ >>> simulationstep("1h")
2235
+ >>> derived.nmblogentries.update()
2236
+ >>> factors.dailysunshineduration = 4.0
2237
+ >>> factors.unadjustedsunshineduration = 0.8
2238
+ >>> logs.loggedunadjustedsunshineduration = (
2239
+ ... 0.8, 0.8, 0.2, 0.1, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
2240
+ ... 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.4, 0.6, 0.7, 0.8)
2241
+ >>> model.calc_sunshineduration_v2()
2242
+ >>> factors.sunshineduration
2243
+ sunshineduration(0.695652)
2244
+
2245
+ The global radiation of a day cannot be zero due to diffusive radiations, but
2246
+ the sunshine duration can. Hence, |Calc_SunshineDuration_V2| requires a
2247
+ safeguard against zero-divisions not relevant for |Calc_GlobalRadiation_V2|.
2248
+ We decided to generally set the adjusted sunshine duration to zero if the
2249
+ directly calculated daily sunshine duration or the current unadjusted sunshine
2250
+ duration is zero. (Note the sum of the logged unadjusted sunshine duration can
2251
+ only be zero if the present unadjusted sunshine duration is zero):
2252
+
2253
+ >>> factors.unadjustedsunshineduration = 0.0
2254
+ >>> logs.loggedunadjustedsunshineduration = 0.0
2255
+ >>> model.calc_sunshineduration_v2()
2256
+ >>> factors.sunshineduration
2257
+ sunshineduration(0.0)
2258
+ """
2259
+
2260
+ DERIVEDPARAMETERS = (meteo_derived.NmbLogEntries,)
2261
+ REQUIREDSEQUENCES = (
2262
+ meteo_factors.UnadjustedSunshineDuration,
2263
+ meteo_factors.DailySunshineDuration,
2264
+ meteo_factors.PossibleSunshineDuration,
2265
+ meteo_logs.LoggedUnadjustedSunshineDuration,
2266
+ )
2267
+ RESULTSEQUENCES = (meteo_factors.SunshineDuration,)
2268
+
2269
+ @staticmethod
2270
+ def __call__(model: modeltools.Model) -> None:
2271
+ der = model.parameters.derived.fastaccess
2272
+ fac = model.sequences.factors.fastaccess
2273
+ log = model.sequences.logs.fastaccess
2274
+ d_nom = fac.unadjustedsunshineduration * fac.dailysunshineduration
2275
+ if d_nom == 0.0:
2276
+ fac.sunshineduration = 0.0
2277
+ else:
2278
+ d_denom = 0.0
2279
+ for idx in range(der.nmblogentries):
2280
+ d_denom += log.loggedunadjustedsunshineduration[idx]
2281
+ fac.sunshineduration = min(d_nom / d_denom, fac.possiblesunshineduration)
2282
+
2283
+
2284
+ class Calc_Temperature_V1(modeltools.Method):
2285
+ r"""Take the input temperature for each hydrological response unit.
2286
+
2287
+ Basic equation:
2288
+ :math:`Temperature_{factors} = Temperature_{inputs}`
2289
+
2290
+ Example:
2291
+
2292
+ >>> from hydpy.models.meteo import *
2293
+ >>> parameterstep()
2294
+ >>> nmbhru(2)
2295
+ >>> inputs.temperature = 2.0
2296
+ >>> model.calc_temperature_v1()
2297
+ >>> factors.temperature
2298
+ temperature(2.0, 2.0)
2299
+ """
2300
+
2301
+ CONTROLPARAMETERS = (meteo_control.NmbHRU,)
2302
+ REQUIREDSEQUENCES = (meteo_inputs.Temperature,)
2303
+ RESULTSEQUENCES = (meteo_factors.Temperature,)
2304
+
2305
+ @staticmethod
2306
+ def __call__(model: modeltools.Model) -> None:
2307
+ con = model.parameters.control.fastaccess
2308
+ inp = model.sequences.inputs.fastaccess
2309
+ fac = model.sequences.factors.fastaccess
2310
+ for k in range(con.nmbhru):
2311
+ fac.temperature[k] = inp.temperature
2312
+
2313
+
2314
+ class Adjust_Temperature_V1(modeltools.Method):
2315
+ r"""Adjust the previously determined temperature values.
2316
+
2317
+ Basic equation:
2318
+ :math:`Temperature_{new} = TemperatureAddend + Temperature_{old}`
2319
+
2320
+ Example:
2321
+
2322
+ >>> from hydpy.models.meteo import *
2323
+ >>> parameterstep()
2324
+ >>> nmbhru(2)
2325
+ >>> temperatureaddend(-0.6, -1.2)
2326
+ >>> factors.temperature = 2.0
2327
+ >>> model.adjust_temperature_v1()
2328
+ >>> factors.temperature
2329
+ temperature(1.4, 0.8)
2330
+ """
2331
+
2332
+ CONTROLPARAMETERS = (meteo_control.NmbHRU, meteo_control.TemperatureAddend)
2333
+ UPDATEDSEQUENCES = (meteo_factors.Temperature,)
2334
+
2335
+ @staticmethod
2336
+ def __call__(model: modeltools.Model) -> None:
2337
+ con = model.parameters.control.fastaccess
2338
+ fac = model.sequences.factors.fastaccess
2339
+ for k in range(con.nmbhru):
2340
+ fac.temperature[k] += con.temperatureaddend[k]
2341
+
2342
+
2343
+ class Calc_MeanTemperature_V1(modeltools.Method):
2344
+ r"""Calculate the average temperature.
2345
+
2346
+ Basic equation:
2347
+ :math:`MeanTemperature =
2348
+ \sum_{i=1}^{NmbHRU} HRUAreaFraction_i \cdot Temperature_i`
2349
+
2350
+ Example:
2351
+
2352
+ >>> from hydpy.models.meteo import *
2353
+ >>> parameterstep()
2354
+ >>> nmbhru(2)
2355
+ >>> derived.hruareafraction(0.8, 0.2)
2356
+ >>> factors.temperature = 1.0, 2.0
2357
+ >>> model.calc_meantemperature_v1()
2358
+ >>> factors.meantemperature
2359
+ meantemperature(1.2)
2360
+ """
2361
+
2362
+ CONTROLPARAMETERS = (meteo_control.NmbHRU,)
2363
+ DERIVEDPARAMETERS = (meteo_derived.HRUAreaFraction,)
2364
+ REQUIREDSEQUENCES = (meteo_factors.Temperature,)
2365
+ RESULTSEQUENCES = (meteo_factors.MeanTemperature,)
2366
+
2367
+ @staticmethod
2368
+ def __call__(model: modeltools.Model) -> None:
2369
+ con = model.parameters.control.fastaccess
2370
+ der = model.parameters.derived.fastaccess
2371
+ fac = model.sequences.factors.fastaccess
2372
+
2373
+ fac.meantemperature = 0.0
2374
+ for s in range(con.nmbhru):
2375
+ fac.meantemperature += der.hruareafraction[s] * fac.temperature[s]
2376
+
2377
+
2378
+ class Calc_Precipitation_V1(modeltools.Method):
2379
+ r"""Take the input precipitation for each hydrological response unit.
2380
+
2381
+ Basic equation:
2382
+ :math:`Precipitation_{fluxes} = Precipitation_{inputs}`
2383
+
2384
+ Example:
2385
+
2386
+ >>> from hydpy.models.meteo import *
2387
+ >>> parameterstep()
2388
+ >>> nmbhru(2)
2389
+ >>> inputs.precipitation = 2.0
2390
+ >>> model.calc_precipitation_v1()
2391
+ >>> fluxes.precipitation
2392
+ precipitation(2.0, 2.0)
2393
+ """
2394
+
2395
+ CONTROLPARAMETERS = (meteo_control.NmbHRU,)
2396
+ REQUIREDSEQUENCES = (meteo_inputs.Precipitation,)
2397
+ RESULTSEQUENCES = (meteo_fluxes.Precipitation,)
2398
+
2399
+ @staticmethod
2400
+ def __call__(model: modeltools.Model) -> None:
2401
+ con = model.parameters.control.fastaccess
2402
+ inp = model.sequences.inputs.fastaccess
2403
+ flu = model.sequences.fluxes.fastaccess
2404
+ for k in range(con.nmbhru):
2405
+ flu.precipitation[k] = inp.precipitation
2406
+
2407
+
2408
+ class Adjust_Precipitation_V1(modeltools.Method):
2409
+ r"""Adjust the previously determined precipitation values.
2410
+
2411
+ Basic equation:
2412
+ :math:`Precipitation_{new} = PrecipitationFactor \cdot Precipitation_{old}`
2413
+
2414
+ Example:
2415
+
2416
+ >>> from hydpy.models.meteo import *
2417
+ >>> parameterstep()
2418
+ >>> nmbhru(2)
2419
+ >>> precipitationfactor(0.5, 2.0)
2420
+ >>> fluxes.precipitation = 2.0
2421
+ >>> model.adjust_precipitation_v1()
2422
+ >>> fluxes.precipitation
2423
+ precipitation(1.0, 4.0)
2424
+ """
2425
+
2426
+ CONTROLPARAMETERS = (meteo_control.NmbHRU, meteo_control.PrecipitationFactor)
2427
+ UPDATEDSEQUENCES = (meteo_fluxes.Precipitation,)
2428
+
2429
+ @staticmethod
2430
+ def __call__(model: modeltools.Model) -> None:
2431
+ con = model.parameters.control.fastaccess
2432
+ flu = model.sequences.fluxes.fastaccess
2433
+ for k in range(con.nmbhru):
2434
+ flu.precipitation[k] *= con.precipitationfactor[k]
2435
+
2436
+
2437
+ class Calc_MeanPrecipitation_V1(modeltools.Method):
2438
+ r"""Calculate the average precipitation.
2439
+
2440
+ Basic equation:
2441
+ :math:`MeanPrecipitation =
2442
+ \sum_{i=1}^{NmbHRU} HRUAreaFraction_i \cdot Precipitation_i`
2443
+
2444
+ Example:
2445
+
2446
+ >>> from hydpy.models.meteo import *
2447
+ >>> parameterstep()
2448
+ >>> nmbhru(2)
2449
+ >>> derived.hruareafraction(0.8, 0.2)
2450
+ >>> fluxes.precipitation = 1.0, 2.0
2451
+ >>> model.calc_meanprecipitation_v1()
2452
+ >>> fluxes.meanprecipitation
2453
+ meanprecipitation(1.2)
2454
+ """
2455
+
2456
+ CONTROLPARAMETERS = (meteo_control.NmbHRU,)
2457
+ DERIVEDPARAMETERS = (meteo_derived.HRUAreaFraction,)
2458
+ REQUIREDSEQUENCES = (meteo_fluxes.Precipitation,)
2459
+ RESULTSEQUENCES = (meteo_fluxes.MeanPrecipitation,)
2460
+
2461
+ @staticmethod
2462
+ def __call__(model: modeltools.Model) -> None:
2463
+ con = model.parameters.control.fastaccess
2464
+ der = model.parameters.derived.fastaccess
2465
+ flu = model.sequences.fluxes.fastaccess
2466
+
2467
+ flu.meanprecipitation = 0.0
2468
+ for s in range(con.nmbhru):
2469
+ flu.meanprecipitation += der.hruareafraction[s] * flu.precipitation[s]
2470
+
2471
+
2472
+ class Determine_Temperature_V1(modeltools.Method):
2473
+ r"""Interface method that applies the complete application model by executing all
2474
+ "run methods"."""
2475
+
2476
+ @staticmethod
2477
+ def __call__(model: modeltools.AdHocModel) -> None:
2478
+ model.run()
2479
+
2480
+
2481
+ class Get_Temperature_V1(modeltools.Method):
2482
+ """Get the current temperature from the selected hydrological response unit.
2483
+
2484
+ Example:
2485
+
2486
+ >>> from hydpy.models.meteo import *
2487
+ >>> parameterstep()
2488
+ >>> nmbhru(2)
2489
+ >>> factors.temperature = 2.0, 4.0
2490
+ >>> from hydpy import round_
2491
+ >>> round_(model.get_temperature_v1(0))
2492
+ 2.0
2493
+ >>> round_(model.get_temperature_v1(1))
2494
+ 4.0
2495
+ """
2496
+
2497
+ REQUIREDSEQUENCES = (meteo_factors.Temperature,)
2498
+
2499
+ @staticmethod
2500
+ def __call__(model: modeltools.Model, s: int) -> float:
2501
+ fac = model.sequences.factors.fastaccess
2502
+
2503
+ return fac.temperature[s]
2504
+
2505
+
2506
+ class Get_MeanTemperature_V1(modeltools.Method):
2507
+ """Get the mean temperature.
2508
+
2509
+ Example:
2510
+
2511
+ >>> from hydpy.models.meteo import *
2512
+ >>> parameterstep()
2513
+ >>> nmbhru(2)
2514
+ >>> factors.meantemperature = 3.0
2515
+ >>> model.get_meantemperature_v1()
2516
+ 3.0
2517
+ """
2518
+
2519
+ REQUIREDSEQUENCES = (meteo_factors.MeanTemperature,)
2520
+
2521
+ @staticmethod
2522
+ def __call__(model: modeltools.Model) -> float:
2523
+ fac = model.sequences.factors.fastaccess
2524
+
2525
+ return fac.meantemperature
2526
+
2527
+
2528
+ class Determine_Precipitation_V1(modeltools.Method):
2529
+ r"""Interface method that applies the complete application model by executing all
2530
+ "run methods"."""
2531
+
2532
+ @staticmethod
2533
+ def __call__(model: modeltools.AdHocModel) -> None:
2534
+ model.run()
2535
+
2536
+
2537
+ class Get_Precipitation_V1(modeltools.Method):
2538
+ """Get the current precipitation from the selected hydrological response unit.
2539
+
2540
+ Example:
2541
+
2542
+ >>> from hydpy.models.meteo import *
2543
+ >>> parameterstep()
2544
+ >>> nmbhru(2)
2545
+ >>> fluxes.precipitation = 2.0, 4.0
2546
+ >>> from hydpy import round_
2547
+ >>> round_(model.get_precipitation_v1(0))
2548
+ 2.0
2549
+ >>> round_(model.get_precipitation_v1(1))
2550
+ 4.0
2551
+ """
2552
+
2553
+ REQUIREDSEQUENCES = (meteo_fluxes.Precipitation,)
2554
+
2555
+ @staticmethod
2556
+ def __call__(model: modeltools.Model, s: int) -> float:
2557
+ flu = model.sequences.fluxes.fastaccess
2558
+
2559
+ return flu.precipitation[s]
2560
+
2561
+
2562
+ class Get_MeanPrecipitation_V1(modeltools.Method):
2563
+ """Get the mean precipitation.
2564
+
2565
+ Example:
2566
+
2567
+ >>> from hydpy.models.meteo import *
2568
+ >>> parameterstep()
2569
+ >>> nmbhru(2)
2570
+ >>> fluxes.meanprecipitation = 3.0
2571
+ >>> model.get_meanprecipitation_v1()
2572
+ 3.0
2573
+ """
2574
+
2575
+ REQUIREDSEQUENCES = (meteo_fluxes.MeanPrecipitation,)
2576
+
2577
+ @staticmethod
2578
+ def __call__(model: modeltools.Model) -> float:
2579
+ flu = model.sequences.fluxes.fastaccess
2580
+
2581
+ return flu.meanprecipitation
2582
+
2583
+
2584
+ class Process_Radiation_V1(modeltools.ReusableMethod):
2585
+ """Interface method for radiation-related submodels that executes all "run
2586
+ methods"."""
2587
+
2588
+ @staticmethod
2589
+ def __call__(model: modeltools.AdHocModel) -> None:
2590
+ model.run()
2591
+
2592
+
2593
+ class Get_PossibleSunshineDuration_V1(modeltools.Method):
2594
+ """Get the potential sunshine duration in h.
2595
+
2596
+ Example:
2597
+
2598
+ >>> from hydpy.models.meteo import *
2599
+ >>> parameterstep()
2600
+ >>> factors.possiblesunshineduration = 3.0
2601
+ >>> model.get_possiblesunshineduration_v1()
2602
+ 3.0
2603
+ """
2604
+
2605
+ REQUIREDSEQUENCES = (meteo_factors.PossibleSunshineDuration,)
2606
+
2607
+ @staticmethod
2608
+ def __call__(model: modeltools.Model) -> float:
2609
+ fac = model.sequences.factors.fastaccess
2610
+
2611
+ return fac.possiblesunshineduration
2612
+
2613
+
2614
+ class Get_PossibleSunshineDuration_V2(modeltools.Method):
2615
+ """Get the potential sunshine duration in h.
2616
+
2617
+ Example:
2618
+
2619
+ >>> from hydpy.models.meteo import *
2620
+ >>> parameterstep()
2621
+ >>> inputs.possiblesunshineduration = 3.0
2622
+ >>> model.get_possiblesunshineduration_v2()
2623
+ 3.0
2624
+ """
2625
+
2626
+ REQUIREDSEQUENCES = (meteo_inputs.PossibleSunshineDuration,)
2627
+
2628
+ @staticmethod
2629
+ def __call__(model: modeltools.Model) -> float:
2630
+ inp = model.sequences.inputs.fastaccess
2631
+
2632
+ return inp.possiblesunshineduration
2633
+
2634
+
2635
+ class Get_SunshineDuration_V1(modeltools.Method):
2636
+ """Get the actual sunshine duration in h.
2637
+
2638
+ Example:
2639
+
2640
+ >>> from hydpy.models.meteo import *
2641
+ >>> parameterstep()
2642
+ >>> factors.sunshineduration = 3.0
2643
+ >>> model.get_sunshineduration_v1()
2644
+ 3.0
2645
+ """
2646
+
2647
+ REQUIREDSEQUENCES = (meteo_factors.SunshineDuration,)
2648
+
2649
+ @staticmethod
2650
+ def __call__(model: modeltools.Model) -> float:
2651
+ fac = model.sequences.factors.fastaccess
2652
+
2653
+ return fac.sunshineduration
2654
+
2655
+
2656
+ class Get_SunshineDuration_V2(modeltools.Method):
2657
+ """Get the actual sunshine duration in h.
2658
+
2659
+ Example:
2660
+
2661
+ >>> from hydpy.models.meteo import *
2662
+ >>> parameterstep()
2663
+ >>> inputs.sunshineduration = 3.0
2664
+ >>> model.get_sunshineduration_v2()
2665
+ 3.0
2666
+ """
2667
+
2668
+ REQUIREDSEQUENCES = (meteo_inputs.SunshineDuration,)
2669
+
2670
+ @staticmethod
2671
+ def __call__(model: modeltools.Model) -> float:
2672
+ inp = model.sequences.inputs.fastaccess
2673
+
2674
+ return inp.sunshineduration
2675
+
2676
+
2677
+ class Get_ClearSkySolarRadiation_V1(modeltools.Method):
2678
+ """Get the clear sky solar radiation in W/m².
2679
+
2680
+ Example:
2681
+
2682
+ >>> from hydpy.models.meteo import *
2683
+ >>> parameterstep()
2684
+ >>> fluxes.clearskysolarradiation = 3.0
2685
+ >>> model.get_clearskysolarradiation_v1()
2686
+ 3.0
2687
+ """
2688
+
2689
+ REQUIREDSEQUENCES = (meteo_fluxes.ClearSkySolarRadiation,)
2690
+
2691
+ @staticmethod
2692
+ def __call__(model: modeltools.Model) -> float:
2693
+ flu = model.sequences.fluxes.fastaccess
2694
+
2695
+ return flu.clearskysolarradiation
2696
+
2697
+
2698
+ class Get_ClearSkySolarRadiation_V2(modeltools.Method):
2699
+ """Get the clear sky solar radiation in W/m².
2700
+
2701
+ Example:
2702
+
2703
+ >>> from hydpy.models.meteo import *
2704
+ >>> parameterstep()
2705
+ >>> inputs.clearskysolarradiation = 3.0
2706
+ >>> model.get_clearskysolarradiation_v2()
2707
+ 3.0
2708
+ """
2709
+
2710
+ REQUIREDSEQUENCES = (meteo_inputs.ClearSkySolarRadiation,)
2711
+
2712
+ @staticmethod
2713
+ def __call__(model: modeltools.Model) -> float:
2714
+ inp = model.sequences.inputs.fastaccess
2715
+
2716
+ return inp.clearskysolarradiation
2717
+
2718
+
2719
+ class Get_GlobalRadiation_V1(modeltools.Method):
2720
+ """Get the global radiation in W/m².
2721
+
2722
+ Example:
2723
+
2724
+ >>> from hydpy.models.meteo import *
2725
+ >>> parameterstep()
2726
+ >>> fluxes.globalradiation = 3.0
2727
+ >>> model.get_globalradiation_v1()
2728
+ 3.0
2729
+ """
2730
+
2731
+ REQUIREDSEQUENCES = (meteo_fluxes.GlobalRadiation,)
2732
+
2733
+ @staticmethod
2734
+ def __call__(model: modeltools.Model) -> float:
2735
+ flu = model.sequences.fluxes.fastaccess
2736
+
2737
+ return flu.globalradiation
2738
+
2739
+
2740
+ class Get_GlobalRadiation_V2(modeltools.Method):
2741
+ """Get the global radiation in W/m².
2742
+
2743
+ Example:
2744
+
2745
+ >>> from hydpy.models.meteo import *
2746
+ >>> parameterstep()
2747
+ >>> inputs.globalradiation = 3.0
2748
+ >>> model.get_globalradiation_v2()
2749
+ 3.0
2750
+ """
2751
+
2752
+ REQUIREDSEQUENCES = (meteo_inputs.GlobalRadiation,)
2753
+
2754
+ @staticmethod
2755
+ def __call__(model: modeltools.Model) -> float:
2756
+ inp = model.sequences.inputs.fastaccess
2757
+
2758
+ return inp.globalradiation
2759
+
2760
+
2761
+ class Model(modeltools.AdHocModel):
2762
+ """|meteo.DOCNAME.complete|."""
2763
+
2764
+ DOCNAME = modeltools.DocName(short="Meteo")
2765
+ __HYDPY_ROOTMODEL__ = None
2766
+
2767
+ INLET_METHODS = ()
2768
+ RECEIVER_METHODS = ()
2769
+ RUN_METHODS = (
2770
+ Calc_EarthSunDistance_V1,
2771
+ Calc_SolarDeclination_V1,
2772
+ Calc_SolarDeclination_V2,
2773
+ Calc_SunsetHourAngle_V1,
2774
+ Calc_SolarTimeAngle_V1,
2775
+ Calc_TimeOfSunrise_TimeOfSunset_V1,
2776
+ Calc_DailyPossibleSunshineDuration_V1,
2777
+ Calc_PossibleSunshineDuration_V1,
2778
+ Calc_PossibleSunshineDuration_V2,
2779
+ Update_LoggedSunshineDuration_V1,
2780
+ Calc_DailySunshineDuration_V1,
2781
+ Update_LoggedGlobalRadiation_V1,
2782
+ Calc_DailyGlobalRadiation_V2,
2783
+ Calc_ExtraterrestrialRadiation_V1,
2784
+ Calc_ExtraterrestrialRadiation_V2,
2785
+ Calc_DailySunshineDuration_V2,
2786
+ Calc_SunshineDuration_V1,
2787
+ Calc_PortionDailyRadiation_V1,
2788
+ Calc_ClearSkySolarRadiation_V1,
2789
+ Adjust_ClearSkySolarRadiation_V1,
2790
+ Calc_GlobalRadiation_V1,
2791
+ Calc_UnadjustedGlobalRadiation_V1,
2792
+ Calc_UnadjustedSunshineDuration_V1,
2793
+ Update_LoggedUnadjustedGlobalRadiation_V1,
2794
+ Update_LoggedUnadjustedSunshineDuration_V1,
2795
+ Calc_DailyGlobalRadiation_V1,
2796
+ Calc_GlobalRadiation_V2,
2797
+ Calc_SunshineDuration_V2,
2798
+ Calc_Temperature_V1,
2799
+ Adjust_Temperature_V1,
2800
+ Calc_MeanTemperature_V1,
2801
+ Calc_Precipitation_V1,
2802
+ Adjust_Precipitation_V1,
2803
+ Calc_MeanPrecipitation_V1,
2804
+ )
2805
+ INTERFACE_METHODS = (
2806
+ Determine_Temperature_V1,
2807
+ Get_Temperature_V1,
2808
+ Get_MeanTemperature_V1,
2809
+ Determine_Precipitation_V1,
2810
+ Get_Precipitation_V1,
2811
+ Get_MeanPrecipitation_V1,
2812
+ Process_Radiation_V1,
2813
+ Get_PossibleSunshineDuration_V1,
2814
+ Get_PossibleSunshineDuration_V2,
2815
+ Get_SunshineDuration_V1,
2816
+ Get_SunshineDuration_V2,
2817
+ Get_ClearSkySolarRadiation_V1,
2818
+ Get_ClearSkySolarRadiation_V2,
2819
+ Get_GlobalRadiation_V1,
2820
+ Get_GlobalRadiation_V2,
2821
+ )
2822
+ ADD_METHODS = (Return_DailyGlobalRadiation_V1, Return_SunshineDuration_V1)
2823
+ OUTLET_METHODS = ()
2824
+ SENDER_METHODS = ()
2825
+ SUBMODELINTERFACES = ()
2826
+ SUBMODELS = ()
2827
+
2828
+
2829
+ class Sub_BaseModel(modeltools.AdHocModel):
2830
+ """Base class for |meteo.DOCNAME.long| submodels."""
2831
+
2832
+ @staticmethod
2833
+ @contextlib.contextmanager
2834
+ def share_configuration(
2835
+ sharable_configuration: SharableConfiguration,
2836
+ ) -> Generator[None, None, None]:
2837
+ """Take the `landtype_constants` data to adjust all parameters inherited from
2838
+ |meteo_parameters.ZipParameter1D| and the `refweights` parameter instance to
2839
+ adjust the index references of all parameters inherited from
2840
+ |meteo_parameters.ZipParameter1D| and all sequences inherited from
2841
+ |meteo_sequences.FluxSequence1D|:
2842
+
2843
+ >>> from hydpy.core.parametertools import Constants, NameParameter, Parameter
2844
+ >>> consts = Constants(GRASS=1, TREES=3, WATER=2)
2845
+ >>> class LandType(NameParameter):
2846
+ ... __name__ = "temp.py"
2847
+ ... constants = consts
2848
+ >>> class Subarea(Parameter):
2849
+ ... ...
2850
+ >>> from hydpy.models.meteo.meteo_model import Sub_BaseModel
2851
+ >>> with Sub_BaseModel.share_configuration(
2852
+ ... {"landtype_refindices": LandType,
2853
+ ... "refweights": Subarea}):
2854
+ ... from hydpy.models.meteo.meteo_parameters import ZipParameter1D
2855
+ ... ZipParameter1D.constants
2856
+ ... ZipParameter1D.refindices.__name__
2857
+ ... ZipParameter1D._refweights.__name__
2858
+ ... from hydpy.models.meteo.meteo_sequences import FluxSequence1D
2859
+ ... FluxSequence1D._refweights.__name__
2860
+ {'GRASS': 1, 'TREES': 3, 'WATER': 2}
2861
+ 'LandType'
2862
+ 'Subarea'
2863
+ 'Subarea'
2864
+ >>> ZipParameter1D.constants
2865
+ {}
2866
+ >>> ZipParameter1D.refindices
2867
+ >>> ZipParameter1D._refweights
2868
+ >>> FluxSequence1D._refweights
2869
+ """
2870
+ with meteo_parameters.ZipParameter1D.modify_refindices(
2871
+ sharable_configuration["landtype_refindices"]
2872
+ ), meteo_parameters.ZipParameter1D.modify_refweights(
2873
+ sharable_configuration["refweights"]
2874
+ ), meteo_parameters.ZipParameter1D.modify_refweights(
2875
+ sharable_configuration["refweights"]
2876
+ ), meteo_sequences.FluxSequence1D.modify_refweights(
2877
+ sharable_configuration["refweights"]
2878
+ ):
2879
+ yield
2880
+
2881
+ @importtools.define_targetparameter(meteo_control.NmbHRU)
2882
+ def prepare_nmbzones(self, nmbzones: int) -> None:
2883
+ """Set the number of hydrological response units.
2884
+
2885
+ >>> from hydpy.models.meteo_precip_io import *
2886
+ >>> parameterstep()
2887
+ >>> model.prepare_nmbzones(2)
2888
+ >>> nmbhru
2889
+ nmbhru(2)
2890
+ """
2891
+ self.parameters.control.nmbhru(nmbzones)
2892
+
2893
+ @importtools.define_targetparameter(meteo_control.HRUArea)
2894
+ def prepare_subareas(self, subareas: Sequence[float]) -> None:
2895
+ """Set the area of all hydrological response units in km².
2896
+
2897
+ >>> from hydpy.models.meteo_precip_io import *
2898
+ >>> parameterstep()
2899
+ >>> nmbhru(2)
2900
+ >>> model.prepare_subareas([1.0, 3.0])
2901
+ >>> hruarea
2902
+ hruarea(1.0, 3.0)
2903
+ """
2904
+ self.parameters.control.hruarea(subareas)