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.
- hydpy/__init__.py +275 -0
- hydpy/aliases.py +2554 -0
- hydpy/auxs/__init__.py +0 -0
- hydpy/auxs/anntools.py +1305 -0
- hydpy/auxs/armatools.py +883 -0
- hydpy/auxs/calibtools.py +3337 -0
- hydpy/auxs/interptools.py +1094 -0
- hydpy/auxs/iuhtools.py +543 -0
- hydpy/auxs/networktools.py +597 -0
- hydpy/auxs/ppolytools.py +809 -0
- hydpy/auxs/quadtools.py +61 -0
- hydpy/auxs/roottools.py +228 -0
- hydpy/auxs/smoothtools.py +273 -0
- hydpy/auxs/statstools.py +2125 -0
- hydpy/auxs/validtools.py +81 -0
- hydpy/conf/HydPyConfigBase.xsd +68637 -0
- hydpy/conf/HydPyConfigBase.xsdt +358 -0
- hydpy/conf/HydPyConfigMultipleRuns.xsd +25 -0
- hydpy/conf/HydPyConfigSingleRun.xsd +24 -0
- hydpy/conf/__init__.py +0 -0
- hydpy/conf/a_coefficients_explicit_lobatto_sequence.npy +0 -0
- hydpy/conf/support_points_for_smoothpar_logistic2.npy +0 -0
- hydpy/config.py +42 -0
- hydpy/core/__init__.py +0 -0
- hydpy/core/aliastools.py +214 -0
- hydpy/core/autodoctools.py +1947 -0
- hydpy/core/auxfiletools.py +1169 -0
- hydpy/core/devicetools.py +3810 -0
- hydpy/core/exceptiontools.py +269 -0
- hydpy/core/filetools.py +1985 -0
- hydpy/core/hydpytools.py +3089 -0
- hydpy/core/importtools.py +1398 -0
- hydpy/core/indextools.py +345 -0
- hydpy/core/itemtools.py +1849 -0
- hydpy/core/masktools.py +460 -0
- hydpy/core/modeltools.py +4868 -0
- hydpy/core/netcdftools.py +2683 -0
- hydpy/core/objecttools.py +2023 -0
- hydpy/core/optiontools.py +1045 -0
- hydpy/core/parametertools.py +4674 -0
- hydpy/core/printtools.py +222 -0
- hydpy/core/propertytools.py +643 -0
- hydpy/core/pubtools.py +254 -0
- hydpy/core/selectiontools.py +1571 -0
- hydpy/core/sequencetools.py +4476 -0
- hydpy/core/seriestools.py +339 -0
- hydpy/core/testtools.py +2483 -0
- hydpy/core/timetools.py +3567 -0
- hydpy/core/typingtools.py +333 -0
- hydpy/core/variabletools.py +2615 -0
- hydpy/cythons/__init__.py +24 -0
- hydpy/cythons/annutils.pxd +33 -0
- hydpy/cythons/annutils.pyi +25 -0
- hydpy/cythons/annutils.pyx +120 -0
- hydpy/cythons/autogen/__init__.py +0 -0
- hydpy/cythons/autogen/annutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/annutils.pxd +42 -0
- hydpy/cythons/autogen/annutils.pyx +129 -0
- hydpy/cythons/autogen/c_arma.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_arma.pxd +179 -0
- hydpy/cythons/autogen/c_arma.pyx +356 -0
- hydpy/cythons/autogen/c_arma_rimorido.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_arma_rimorido.pxd +179 -0
- hydpy/cythons/autogen/c_arma_rimorido.pyx +356 -0
- hydpy/cythons/autogen/c_conv.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_conv.pxd +198 -0
- hydpy/cythons/autogen/c_conv.pyx +491 -0
- hydpy/cythons/autogen/c_conv_idw.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_conv_idw.pxd +124 -0
- hydpy/cythons/autogen/c_conv_idw.pyx +264 -0
- hydpy/cythons/autogen/c_conv_idw_ed.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_conv_idw_ed.pxd +197 -0
- hydpy/cythons/autogen/c_conv_idw_ed.pyx +481 -0
- hydpy/cythons/autogen/c_conv_nn.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_conv_nn.pxd +120 -0
- hydpy/cythons/autogen/c_conv_nn.pyx +224 -0
- hydpy/cythons/autogen/c_dam.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam.pxd +805 -0
- hydpy/cythons/autogen/c_dam.pyx +1477 -0
- hydpy/cythons/autogen/c_dam_llake.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_llake.pxd +364 -0
- hydpy/cythons/autogen/c_dam_llake.pyx +705 -0
- hydpy/cythons/autogen/c_dam_lreservoir.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_lreservoir.pxd +365 -0
- hydpy/cythons/autogen/c_dam_lreservoir.pyx +708 -0
- hydpy/cythons/autogen/c_dam_lretention.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_lretention.pxd +340 -0
- hydpy/cythons/autogen/c_dam_lretention.pyx +625 -0
- hydpy/cythons/autogen/c_dam_pump.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_pump.pxd +402 -0
- hydpy/cythons/autogen/c_dam_pump.pyx +724 -0
- hydpy/cythons/autogen/c_dam_pump_sluice.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_pump_sluice.pxd +452 -0
- hydpy/cythons/autogen/c_dam_pump_sluice.pyx +829 -0
- hydpy/cythons/autogen/c_dam_sluice.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_sluice.pxd +404 -0
- hydpy/cythons/autogen/c_dam_sluice.pyx +726 -0
- hydpy/cythons/autogen/c_dam_v001.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_v001.pxd +452 -0
- hydpy/cythons/autogen/c_dam_v001.pyx +816 -0
- hydpy/cythons/autogen/c_dam_v002.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_v002.pxd +394 -0
- hydpy/cythons/autogen/c_dam_v002.pyx +703 -0
- hydpy/cythons/autogen/c_dam_v003.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_v003.pxd +417 -0
- hydpy/cythons/autogen/c_dam_v003.pyx +744 -0
- hydpy/cythons/autogen/c_dam_v004.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_v004.pxd +486 -0
- hydpy/cythons/autogen/c_dam_v004.pyx +891 -0
- hydpy/cythons/autogen/c_dam_v005.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dam_v005.pxd +524 -0
- hydpy/cythons/autogen/c_dam_v005.pyx +928 -0
- hydpy/cythons/autogen/c_dummy.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dummy.pxd +151 -0
- hydpy/cythons/autogen/c_dummy.pyx +263 -0
- hydpy/cythons/autogen/c_dummy_interceptedwater.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dummy_interceptedwater.pxd +69 -0
- hydpy/cythons/autogen/c_dummy_interceptedwater.pyx +104 -0
- hydpy/cythons/autogen/c_dummy_node2node.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dummy_node2node.pxd +89 -0
- hydpy/cythons/autogen/c_dummy_node2node.pyx +148 -0
- hydpy/cythons/autogen/c_dummy_snowalbedo.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dummy_snowalbedo.pxd +69 -0
- hydpy/cythons/autogen/c_dummy_snowalbedo.pyx +104 -0
- hydpy/cythons/autogen/c_dummy_snowcover.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dummy_snowcover.pxd +69 -0
- hydpy/cythons/autogen/c_dummy_snowcover.pyx +104 -0
- hydpy/cythons/autogen/c_dummy_snowycanopy.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dummy_snowycanopy.pxd +69 -0
- hydpy/cythons/autogen/c_dummy_snowycanopy.pyx +104 -0
- hydpy/cythons/autogen/c_dummy_soilwater.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_dummy_soilwater.pxd +69 -0
- hydpy/cythons/autogen/c_dummy_soilwater.pyx +104 -0
- hydpy/cythons/autogen/c_evap.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap.pxd +1029 -0
- hydpy/cythons/autogen/c_evap.pyx +2601 -0
- hydpy/cythons/autogen/c_evap_aet_hbv96.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_aet_hbv96.pxd +227 -0
- hydpy/cythons/autogen/c_evap_aet_hbv96.pyx +584 -0
- hydpy/cythons/autogen/c_evap_aet_minhas.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_aet_minhas.pxd +193 -0
- hydpy/cythons/autogen/c_evap_aet_minhas.pyx +478 -0
- hydpy/cythons/autogen/c_evap_aet_morsim.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_aet_morsim.pxd +681 -0
- hydpy/cythons/autogen/c_evap_aet_morsim.pyx +1642 -0
- hydpy/cythons/autogen/c_evap_pet_ambav1.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_pet_ambav1.pxd +532 -0
- hydpy/cythons/autogen/c_evap_pet_ambav1.pyx +1296 -0
- hydpy/cythons/autogen/c_evap_pet_hbv96.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_pet_hbv96.pxd +179 -0
- hydpy/cythons/autogen/c_evap_pet_hbv96.pyx +328 -0
- hydpy/cythons/autogen/c_evap_pet_m.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_pet_m.pxd +124 -0
- hydpy/cythons/autogen/c_evap_pet_m.pyx +214 -0
- hydpy/cythons/autogen/c_evap_pet_mlc.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_pet_mlc.pxd +126 -0
- hydpy/cythons/autogen/c_evap_pet_mlc.pyx +214 -0
- hydpy/cythons/autogen/c_evap_ret_fao56.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_ret_fao56.pxd +305 -0
- hydpy/cythons/autogen/c_evap_ret_fao56.pyx +624 -0
- hydpy/cythons/autogen/c_evap_ret_io.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_ret_io.pxd +112 -0
- hydpy/cythons/autogen/c_evap_ret_io.pyx +176 -0
- hydpy/cythons/autogen/c_evap_ret_tw2002.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_evap_ret_tw2002.pxd +139 -0
- hydpy/cythons/autogen/c_evap_ret_tw2002.pyx +273 -0
- hydpy/cythons/autogen/c_exch.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_exch.pxd +230 -0
- hydpy/cythons/autogen/c_exch.pyx +462 -0
- hydpy/cythons/autogen/c_exch_branch_hbv96.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_exch_branch_hbv96.pxd +134 -0
- hydpy/cythons/autogen/c_exch_branch_hbv96.pyx +255 -0
- hydpy/cythons/autogen/c_exch_waterlevel.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_exch_waterlevel.pxd +54 -0
- hydpy/cythons/autogen/c_exch_waterlevel.pyx +78 -0
- hydpy/cythons/autogen/c_exch_weir_hbv96.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_exch_weir_hbv96.pxd +156 -0
- hydpy/cythons/autogen/c_exch_weir_hbv96.pyx +282 -0
- hydpy/cythons/autogen/c_ga.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_ga.pxd +353 -0
- hydpy/cythons/autogen/c_ga.pyx +1204 -0
- hydpy/cythons/autogen/c_ga_garto.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_ga_garto.pxd +330 -0
- hydpy/cythons/autogen/c_ga_garto.pyx +1105 -0
- hydpy/cythons/autogen/c_ga_garto_submodel1.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_ga_garto_submodel1.pxd +236 -0
- hydpy/cythons/autogen/c_ga_garto_submodel1.pyx +944 -0
- hydpy/cythons/autogen/c_gland.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_gland.pxd +437 -0
- hydpy/cythons/autogen/c_gland.pyx +726 -0
- hydpy/cythons/autogen/c_gland_gr4.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_gland_gr4.pxd +382 -0
- hydpy/cythons/autogen/c_gland_gr4.pyx +605 -0
- hydpy/cythons/autogen/c_gland_gr5.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_gland_gr5.pxd +368 -0
- hydpy/cythons/autogen/c_gland_gr5.pyx +568 -0
- hydpy/cythons/autogen/c_gland_gr6.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_gland_gr6.pxd +420 -0
- hydpy/cythons/autogen/c_gland_gr6.pyx +673 -0
- hydpy/cythons/autogen/c_hland.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_hland.pxd +855 -0
- hydpy/cythons/autogen/c_hland.pyx +2486 -0
- hydpy/cythons/autogen/c_hland_96.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_hland_96.pxd +631 -0
- hydpy/cythons/autogen/c_hland_96.pyx +1724 -0
- hydpy/cythons/autogen/c_hland_96c.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_hland_96c.pxd +621 -0
- hydpy/cythons/autogen/c_hland_96c.pyx +1822 -0
- hydpy/cythons/autogen/c_hland_96p.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_hland_96p.pxd +683 -0
- hydpy/cythons/autogen/c_hland_96p.pyx +1911 -0
- hydpy/cythons/autogen/c_kinw.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_kinw.pxd +509 -0
- hydpy/cythons/autogen/c_kinw.pyx +965 -0
- hydpy/cythons/autogen/c_kinw_williams.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_kinw_williams.pxd +409 -0
- hydpy/cythons/autogen/c_kinw_williams.pyx +763 -0
- hydpy/cythons/autogen/c_kinw_williams_ext.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_kinw_williams_ext.pxd +220 -0
- hydpy/cythons/autogen/c_kinw_williams_ext.pyx +440 -0
- hydpy/cythons/autogen/c_lland.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_lland.pxd +1386 -0
- hydpy/cythons/autogen/c_lland.pyx +3679 -0
- hydpy/cythons/autogen/c_lland_dd.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_lland_dd.pxd +679 -0
- hydpy/cythons/autogen/c_lland_dd.pyx +1719 -0
- hydpy/cythons/autogen/c_lland_knauf.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_lland_knauf.pxd +1096 -0
- hydpy/cythons/autogen/c_lland_knauf.pyx +2784 -0
- hydpy/cythons/autogen/c_lland_knauf_ic.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_lland_knauf_ic.pxd +1369 -0
- hydpy/cythons/autogen/c_lland_knauf_ic.pyx +3625 -0
- hydpy/cythons/autogen/c_meteo.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo.pxd +469 -0
- hydpy/cythons/autogen/c_meteo.pyx +879 -0
- hydpy/cythons/autogen/c_meteo_clear_glob_io.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_clear_glob_io.pxd +75 -0
- hydpy/cythons/autogen/c_meteo_clear_glob_io.pyx +107 -0
- hydpy/cythons/autogen/c_meteo_glob_fao56.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_glob_fao56.pxd +209 -0
- hydpy/cythons/autogen/c_meteo_glob_fao56.pyx +339 -0
- hydpy/cythons/autogen/c_meteo_glob_io.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_glob_io.pxd +63 -0
- hydpy/cythons/autogen/c_meteo_glob_io.pyx +91 -0
- hydpy/cythons/autogen/c_meteo_glob_morsim.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_glob_morsim.pxd +289 -0
- hydpy/cythons/autogen/c_meteo_glob_morsim.pyx +527 -0
- hydpy/cythons/autogen/c_meteo_precip_io.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_precip_io.pxd +112 -0
- hydpy/cythons/autogen/c_meteo_precip_io.pyx +176 -0
- hydpy/cythons/autogen/c_meteo_psun_sun_glob_io.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_psun_sun_glob_io.pxd +87 -0
- hydpy/cythons/autogen/c_meteo_psun_sun_glob_io.pyx +123 -0
- hydpy/cythons/autogen/c_meteo_sun_fao56.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_sun_fao56.pxd +209 -0
- hydpy/cythons/autogen/c_meteo_sun_fao56.pyx +343 -0
- hydpy/cythons/autogen/c_meteo_sun_morsim.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_sun_morsim.pxd +286 -0
- hydpy/cythons/autogen/c_meteo_sun_morsim.pyx +519 -0
- hydpy/cythons/autogen/c_meteo_temp_io.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_meteo_temp_io.pxd +112 -0
- hydpy/cythons/autogen/c_meteo_temp_io.pyx +176 -0
- hydpy/cythons/autogen/c_musk.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_musk.pxd +282 -0
- hydpy/cythons/autogen/c_musk.pyx +605 -0
- hydpy/cythons/autogen/c_musk_classic.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_musk_classic.pxd +138 -0
- hydpy/cythons/autogen/c_musk_classic.pyx +226 -0
- hydpy/cythons/autogen/c_musk_mct.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_musk_mct.pxd +282 -0
- hydpy/cythons/autogen/c_musk_mct.pyx +609 -0
- hydpy/cythons/autogen/c_rconc.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_rconc.pxd +119 -0
- hydpy/cythons/autogen/c_rconc.pyx +174 -0
- hydpy/cythons/autogen/c_rconc_nash.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_rconc_nash.pxd +111 -0
- hydpy/cythons/autogen/c_rconc_nash.pyx +185 -0
- hydpy/cythons/autogen/c_rconc_uh.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_rconc_uh.pxd +92 -0
- hydpy/cythons/autogen/c_rconc_uh.pyx +125 -0
- hydpy/cythons/autogen/c_sw1d.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d.pxd +511 -0
- hydpy/cythons/autogen/c_sw1d.pyx +1263 -0
- hydpy/cythons/autogen/c_sw1d_channel.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_channel.pxd +119 -0
- hydpy/cythons/autogen/c_sw1d_channel.pyx +300 -0
- hydpy/cythons/autogen/c_sw1d_gate_out.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_gate_out.pxd +240 -0
- hydpy/cythons/autogen/c_sw1d_gate_out.pyx +476 -0
- hydpy/cythons/autogen/c_sw1d_lias.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_lias.pxd +320 -0
- hydpy/cythons/autogen/c_sw1d_lias.pyx +619 -0
- hydpy/cythons/autogen/c_sw1d_lias_sluice.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_lias_sluice.pxd +325 -0
- hydpy/cythons/autogen/c_sw1d_lias_sluice.pyx +644 -0
- hydpy/cythons/autogen/c_sw1d_network.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_network.pxd +90 -0
- hydpy/cythons/autogen/c_sw1d_network.pyx +246 -0
- hydpy/cythons/autogen/c_sw1d_pump.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_pump.pxd +256 -0
- hydpy/cythons/autogen/c_sw1d_pump.pyx +502 -0
- hydpy/cythons/autogen/c_sw1d_q_in.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_q_in.pxd +224 -0
- hydpy/cythons/autogen/c_sw1d_q_in.pyx +383 -0
- hydpy/cythons/autogen/c_sw1d_q_out.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_q_out.pxd +224 -0
- hydpy/cythons/autogen/c_sw1d_q_out.pyx +383 -0
- hydpy/cythons/autogen/c_sw1d_storage.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_storage.pxd +193 -0
- hydpy/cythons/autogen/c_sw1d_storage.pyx +349 -0
- hydpy/cythons/autogen/c_sw1d_weir_out.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_sw1d_weir_out.pxd +212 -0
- hydpy/cythons/autogen/c_sw1d_weir_out.pyx +404 -0
- hydpy/cythons/autogen/c_test.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_test.pxd +175 -0
- hydpy/cythons/autogen/c_test.pyx +348 -0
- hydpy/cythons/autogen/c_test_discontinous.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_test_discontinous.pxd +146 -0
- hydpy/cythons/autogen/c_test_discontinous.pyx +256 -0
- hydpy/cythons/autogen/c_test_stiff0d.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_test_stiff0d.pxd +146 -0
- hydpy/cythons/autogen/c_test_stiff0d.pyx +250 -0
- hydpy/cythons/autogen/c_test_stiff1d.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_test_stiff1d.pxd +145 -0
- hydpy/cythons/autogen/c_test_stiff1d.pyx +294 -0
- hydpy/cythons/autogen/c_whmod.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_whmod.pxd +482 -0
- hydpy/cythons/autogen/c_whmod.pyx +1156 -0
- hydpy/cythons/autogen/c_whmod_rural.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_whmod_rural.pxd +411 -0
- hydpy/cythons/autogen/c_whmod_rural.pyx +982 -0
- hydpy/cythons/autogen/c_whmod_urban.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_whmod_urban.pxd +482 -0
- hydpy/cythons/autogen/c_whmod_urban.pyx +1155 -0
- hydpy/cythons/autogen/c_wland.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_wland.pxd +842 -0
- hydpy/cythons/autogen/c_wland.pyx +1890 -0
- hydpy/cythons/autogen/c_wland_gd.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_wland_gd.pxd +829 -0
- hydpy/cythons/autogen/c_wland_gd.pyx +1847 -0
- hydpy/cythons/autogen/c_wland_wag.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_wland_wag.pxd +810 -0
- hydpy/cythons/autogen/c_wland_wag.pyx +1780 -0
- hydpy/cythons/autogen/c_wq.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_wq.pxd +275 -0
- hydpy/cythons/autogen/c_wq.pyx +652 -0
- hydpy/cythons/autogen/c_wq_trapeze.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_wq_trapeze.pxd +170 -0
- hydpy/cythons/autogen/c_wq_trapeze.pyx +400 -0
- hydpy/cythons/autogen/c_wq_trapeze_strickler.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_wq_trapeze_strickler.pxd +243 -0
- hydpy/cythons/autogen/c_wq_trapeze_strickler.pyx +578 -0
- hydpy/cythons/autogen/c_wq_walrus.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/c_wq_walrus.pxd +61 -0
- hydpy/cythons/autogen/c_wq_walrus.pyx +82 -0
- hydpy/cythons/autogen/configutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/configutils.pxd +17 -0
- hydpy/cythons/autogen/configutils.pyx +119 -0
- hydpy/cythons/autogen/interfaceutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/interfaceutils.pxd +31 -0
- hydpy/cythons/autogen/interfaceutils.pyx +82 -0
- hydpy/cythons/autogen/interputils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/interputils.pxd +42 -0
- hydpy/cythons/autogen/interputils.pyx +118 -0
- hydpy/cythons/autogen/masterinterface.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/masterinterface.pxd +153 -0
- hydpy/cythons/autogen/masterinterface.pyx +222 -0
- hydpy/cythons/autogen/pointerutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/pointerutils.pxd +31 -0
- hydpy/cythons/autogen/pointerutils.pyx +650 -0
- hydpy/cythons/autogen/ppolyutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/ppolyutils.pxd +35 -0
- hydpy/cythons/autogen/ppolyutils.pyx +59 -0
- hydpy/cythons/autogen/quadutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/quadutils.pxd +26 -0
- hydpy/cythons/autogen/quadutils.pyx +973 -0
- hydpy/cythons/autogen/rootutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/rootutils.pxd +28 -0
- hydpy/cythons/autogen/rootutils.pyx +109 -0
- hydpy/cythons/autogen/sequenceutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/sequenceutils.pxd +45 -0
- hydpy/cythons/autogen/sequenceutils.pyx +101 -0
- hydpy/cythons/autogen/smoothutils.cp313-win_amd64.pyd +0 -0
- hydpy/cythons/autogen/smoothutils.pxd +29 -0
- hydpy/cythons/autogen/smoothutils.pyx +833 -0
- hydpy/cythons/configutils.pxd +8 -0
- hydpy/cythons/configutils.pyi +5 -0
- hydpy/cythons/configutils.pyx +110 -0
- hydpy/cythons/interfaceutils.pxd +22 -0
- hydpy/cythons/interfaceutils.pyi +15 -0
- hydpy/cythons/interfaceutils.pyx +73 -0
- hydpy/cythons/interputils.pxd +33 -0
- hydpy/cythons/interputils.pyi +32 -0
- hydpy/cythons/interputils.pyx +109 -0
- hydpy/cythons/modelutils.py +2990 -0
- hydpy/cythons/pointerutils.pxd +22 -0
- hydpy/cythons/pointerutils.pyi +89 -0
- hydpy/cythons/pointerutils.pyx +641 -0
- hydpy/cythons/ppolyutils.pxd +26 -0
- hydpy/cythons/ppolyutils.pyi +21 -0
- hydpy/cythons/ppolyutils.pyx +50 -0
- hydpy/cythons/quadutils.pxd +17 -0
- hydpy/cythons/quadutils.pyi +13 -0
- hydpy/cythons/quadutils.pyx +964 -0
- hydpy/cythons/rootutils.pxd +19 -0
- hydpy/cythons/rootutils.pyi +21 -0
- hydpy/cythons/rootutils.pyx +100 -0
- hydpy/cythons/sequenceutils.pxd +36 -0
- hydpy/cythons/sequenceutils.pyi +7 -0
- hydpy/cythons/sequenceutils.pyx +92 -0
- hydpy/cythons/smoothutils.pxd +20 -0
- hydpy/cythons/smoothutils.pyi +15 -0
- hydpy/cythons/smoothutils.pyx +824 -0
- hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/land_dill_assl.py +13 -0
- hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/land_lahn_kalk.py +13 -0
- hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/land_lahn_leun.py +14 -0
- hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/land_lahn_marb.py +13 -0
- hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/stream_dill_assl_lahn_leun.py +5 -0
- hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/stream_lahn_leun_lahn_kalk.py +5 -0
- hydpy/data/HydPy-H-Lahn/conditions/init_1996_01_01_00_00_00/stream_lahn_marb_lahn_leun.py +5 -0
- hydpy/data/HydPy-H-Lahn/control/default/land.py +9 -0
- hydpy/data/HydPy-H-Lahn/control/default/land_dill_assl.py +57 -0
- hydpy/data/HydPy-H-Lahn/control/default/land_lahn_kalk.py +57 -0
- hydpy/data/HydPy-H-Lahn/control/default/land_lahn_leun.py +56 -0
- hydpy/data/HydPy-H-Lahn/control/default/land_lahn_marb.py +57 -0
- hydpy/data/HydPy-H-Lahn/control/default/stream_dill_assl_lahn_leun.py +7 -0
- hydpy/data/HydPy-H-Lahn/control/default/stream_lahn_leun_lahn_kalk.py +7 -0
- hydpy/data/HydPy-H-Lahn/control/default/stream_lahn_marb_lahn_leun.py +7 -0
- hydpy/data/HydPy-H-Lahn/multiple_runs.xml +309 -0
- hydpy/data/HydPy-H-Lahn/multiple_runs_alpha.xml +71 -0
- hydpy/data/HydPy-H-Lahn/network/default/headwaters.py +11 -0
- hydpy/data/HydPy-H-Lahn/network/default/nonheadwaters.py +11 -0
- hydpy/data/HydPy-H-Lahn/network/default/streams.py +8 -0
- hydpy/data/HydPy-H-Lahn/series/default/dill_assl_obs_q.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/evap_pet_hbv96_input_normalairtemperature.nc +0 -0
- hydpy/data/HydPy-H-Lahn/series/default/evap_pet_hbv96_input_normalevapotranspiration.nc +0 -0
- hydpy/data/HydPy-H-Lahn/series/default/hland_96_input_p.nc +0 -0
- hydpy/data/HydPy-H-Lahn/series/default/hland_96_input_t.nc +0 -0
- hydpy/data/HydPy-H-Lahn/series/default/lahn_kalk_obs_q.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/lahn_leun_obs_q.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/lahn_marb_obs_q.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_dill_assl_evap_pet_hbv96_input_normalairtemperature.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_dill_assl_evap_pet_hbv96_input_normalevapotranspiration.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_dill_assl_hland_96_input_p.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_dill_assl_hland_96_input_t.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_kalk_evap_pet_hbv96_input_normalairtemperature.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_kalk_evap_pet_hbv96_input_normalevapotranspiration.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_kalk_hland_96_input_p.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_kalk_hland_96_input_t.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_leun_evap_pet_hbv96_input_normalairtemperature.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_leun_evap_pet_hbv96_input_normalevapotranspiration.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_leun_hland_96_input_p.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_leun_hland_96_input_t.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_marb_evap_pet_hbv96_input_normalairtemperature.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_marb_evap_pet_hbv96_input_normalevapotranspiration.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_marb_hland_96_input_p.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/land_lahn_marb_hland_96_input_t.asc +11387 -0
- hydpy/data/HydPy-H-Lahn/series/default/obs_q.nc +0 -0
- hydpy/data/HydPy-H-Lahn/single_run.xml +152 -0
- hydpy/data/HydPy-H-Lahn/single_run.xmlt +143 -0
- hydpy/data/__init__.py +17 -0
- hydpy/docs/__init__.py +0 -0
- hydpy/docs/autofigs/__init__.py +0 -0
- hydpy/docs/bib/__init__.py +0 -0
- hydpy/docs/bib/refs.bib +566 -0
- hydpy/docs/combine_docversions.py +133 -0
- hydpy/docs/draw_model_sketches.py +1301 -0
- hydpy/docs/enable_autodoc.py +7 -0
- hydpy/docs/figs/HydPy-G-GR4.png +0 -0
- hydpy/docs/figs/HydPy-G-GR5.png +0 -0
- hydpy/docs/figs/HydPy-G-GR6.png +0 -0
- hydpy/docs/figs/HydPy-H-HBV96-COSERO.png +0 -0
- hydpy/docs/figs/HydPy-H-HBV96-PREVAH.png +0 -0
- hydpy/docs/figs/HydPy-H-HBV96.png +0 -0
- hydpy/docs/figs/HydPy-H-Lahn.png +0 -0
- hydpy/docs/figs/HydPy-KinW-Williams.png +0 -0
- hydpy/docs/figs/HydPy-L-DD.png +0 -0
- hydpy/docs/figs/HydPy-W-Wag.png +0 -0
- hydpy/docs/figs/HydPy_Logo.png +0 -0
- hydpy/docs/figs/HydPy_Logo_Text.png +0 -0
- hydpy/docs/figs/IDLE-editor.png +0 -0
- hydpy/docs/figs/IDLE-shell.png +0 -0
- hydpy/docs/figs/LAWA_river-basin-bumbers.png +0 -0
- hydpy/docs/figs/__init__.py +0 -0
- hydpy/docs/html_/__init__.py +0 -0
- hydpy/docs/polish_html.py +57 -0
- hydpy/docs/prepare.py +224 -0
- hydpy/docs/publish_docs.py +53 -0
- hydpy/docs/rst/HydPy-ARMA.rst +27 -0
- hydpy/docs/rst/HydPy-Conv.rst +22 -0
- hydpy/docs/rst/HydPy-Dam.rst +79 -0
- hydpy/docs/rst/HydPy-Dummy.rst +21 -0
- hydpy/docs/rst/HydPy-Evap.rst +26 -0
- hydpy/docs/rst/HydPy-Exch.rst +36 -0
- hydpy/docs/rst/HydPy-G.rst +40 -0
- hydpy/docs/rst/HydPy-GA.rst +34 -0
- hydpy/docs/rst/HydPy-H.rst +24 -0
- hydpy/docs/rst/HydPy-KinW.rst +32 -0
- hydpy/docs/rst/HydPy-L.rst +42 -0
- hydpy/docs/rst/HydPy-Meteo.rst +28 -0
- hydpy/docs/rst/HydPy-Musk.rst +21 -0
- hydpy/docs/rst/HydPy-Rconc.rst +17 -0
- hydpy/docs/rst/HydPy-SW1D.rst +49 -0
- hydpy/docs/rst/HydPy-Test.rst +19 -0
- hydpy/docs/rst/HydPy-W.rst +20 -0
- hydpy/docs/rst/HydPy-WHMod.rst +19 -0
- hydpy/docs/rst/HydPy-WQ.rst +20 -0
- hydpy/docs/rst/__init__.py +0 -0
- hydpy/docs/rst/additional_repositories.rst +40 -0
- hydpy/docs/rst/auxiliaries.rst +31 -0
- hydpy/docs/rst/continuous_integration.rst +75 -0
- hydpy/docs/rst/core.rst +75 -0
- hydpy/docs/rst/cythons.rst +47 -0
- hydpy/docs/rst/definitions.rst +506 -0
- hydpy/docs/rst/developer_guide.rst +54 -0
- hydpy/docs/rst/example_projects.rst +40 -0
- hydpy/docs/rst/execution.rst +22 -0
- hydpy/docs/rst/framework_tools.rst +56 -0
- hydpy/docs/rst/how_to_read_the_reference_manual.rst +156 -0
- hydpy/docs/rst/hydpydependencies.rst +55 -0
- hydpy/docs/rst/index.rst +125 -0
- hydpy/docs/rst/installation.rst +155 -0
- hydpy/docs/rst/model_families.rst +79 -0
- hydpy/docs/rst/model_overview.rst +291 -0
- hydpy/docs/rst/modelimports.rst +10 -0
- hydpy/docs/rst/options.rst +119 -0
- hydpy/docs/rst/programming_style.rst +572 -0
- hydpy/docs/rst/project_structure.rst +520 -0
- hydpy/docs/rst/quickstart.rst +304 -0
- hydpy/docs/rst/reference_manual.rst +29 -0
- hydpy/docs/rst/required_tools.rst +50 -0
- hydpy/docs/rst/simulation.rst +514 -0
- hydpy/docs/rst/submodel_interfaces.rst +32 -0
- hydpy/docs/rst/tests_and_documentation.rst +85 -0
- hydpy/docs/rst/user_guide.rst +38 -0
- hydpy/docs/rst/version_control.rst +116 -0
- hydpy/docs/rst/zbibliography.rst +8 -0
- hydpy/docs/sphinx/__init__.py +0 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/changes/frameset.html +11 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/changes/rstsource.html +15 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/changes/versionchanges.html +33 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/defindex.html +35 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/domainindex.html +56 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/genindex-single.html +63 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/genindex-split.html +41 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/genindex.html +76 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/globaltoc.html +11 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/layout.html +221 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/localtoc.html +15 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/opensearch.xml +13 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/page.html +13 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/relations.html +23 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/search.html +65 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/searchbox.html +21 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/searchfield.html +23 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/sourcelink.html +18 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/basic.css_t +925 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/doctools.js +156 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/documentation_options.js_t +13 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/file.png +0 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/language_data.js_t +26 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/minus.png +0 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/plus.png +0 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/searchtools.js +574 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/static/sphinx_highlight.js +154 -0
- hydpy/docs/sphinx/_themes/basic_hydpy/theme.conf +16 -0
- hydpy/docs/sphinx/_themes/classic_hydpy/layout.html +23 -0
- hydpy/docs/sphinx/_themes/classic_hydpy/static/classic.css_t +358 -0
- hydpy/docs/sphinx/_themes/classic_hydpy/static/sidebar.js_t +72 -0
- hydpy/docs/sphinx/_themes/classic_hydpy/theme.conf +32 -0
- hydpy/docs/sphinx/conf.py +398 -0
- hydpy/docs/sphinx/defaultlinks_extension.py +36 -0
- hydpy/docs/sphinx/integrationtest_extension.py +104 -0
- hydpy/docs/sphinx/projectstructure_extension.py +58 -0
- hydpy/docs/sphinx/submodelgraph_extension.py +53 -0
- hydpy/exe/__init__.py +0 -0
- hydpy/exe/commandtools.py +651 -0
- hydpy/exe/hyd.py +277 -0
- hydpy/exe/modelimports.py +41 -0
- hydpy/exe/replacetools.py +216 -0
- hydpy/exe/servertools.py +2348 -0
- hydpy/exe/xmltools.py +3280 -0
- hydpy/interfaces/__init__.py +0 -0
- hydpy/interfaces/aetinterfaces.py +94 -0
- hydpy/interfaces/dischargeinterfaces.py +45 -0
- hydpy/interfaces/petinterfaces.py +117 -0
- hydpy/interfaces/precipinterfaces.py +42 -0
- hydpy/interfaces/radiationinterfaces.py +79 -0
- hydpy/interfaces/rconcinterfaces.py +30 -0
- hydpy/interfaces/routinginterfaces.py +324 -0
- hydpy/interfaces/soilinterfaces.py +96 -0
- hydpy/interfaces/stateinterfaces.py +98 -0
- hydpy/interfaces/tempinterfaces.py +46 -0
- hydpy/models/__init__.py +0 -0
- hydpy/models/arma/__init__.py +14 -0
- hydpy/models/arma/arma_control.py +383 -0
- hydpy/models/arma/arma_derived.py +204 -0
- hydpy/models/arma/arma_fluxes.py +41 -0
- hydpy/models/arma/arma_inlets.py +11 -0
- hydpy/models/arma/arma_logs.py +19 -0
- hydpy/models/arma/arma_model.py +461 -0
- hydpy/models/arma/arma_outlets.py +11 -0
- hydpy/models/arma_rimorido.py +381 -0
- hydpy/models/conv/__init__.py +12 -0
- hydpy/models/conv/conv_control.py +303 -0
- hydpy/models/conv/conv_derived.py +271 -0
- hydpy/models/conv/conv_fluxes.py +54 -0
- hydpy/models/conv/conv_inlets.py +11 -0
- hydpy/models/conv/conv_model.py +687 -0
- hydpy/models/conv/conv_outlets.py +11 -0
- hydpy/models/conv_idw.py +120 -0
- hydpy/models/conv_idw_ed.py +184 -0
- hydpy/models/conv_nn.py +112 -0
- hydpy/models/dam/__init__.py +16 -0
- hydpy/models/dam/dam_aides.py +17 -0
- hydpy/models/dam/dam_control.py +346 -0
- hydpy/models/dam/dam_derived.py +559 -0
- hydpy/models/dam/dam_factors.py +46 -0
- hydpy/models/dam/dam_fluxes.py +179 -0
- hydpy/models/dam/dam_inlets.py +29 -0
- hydpy/models/dam/dam_logs.py +52 -0
- hydpy/models/dam/dam_model.py +5011 -0
- hydpy/models/dam/dam_outlets.py +23 -0
- hydpy/models/dam/dam_receivers.py +41 -0
- hydpy/models/dam/dam_senders.py +23 -0
- hydpy/models/dam/dam_solver.py +75 -0
- hydpy/models/dam/dam_states.py +11 -0
- hydpy/models/dam_llake.py +499 -0
- hydpy/models/dam_lreservoir.py +548 -0
- hydpy/models/dam_lretention.py +343 -0
- hydpy/models/dam_pump.py +278 -0
- hydpy/models/dam_pump_sluice.py +339 -0
- hydpy/models/dam_sluice.py +319 -0
- hydpy/models/dam_v001.py +1127 -0
- hydpy/models/dam_v002.py +381 -0
- hydpy/models/dam_v003.py +422 -0
- hydpy/models/dam_v004.py +665 -0
- hydpy/models/dam_v005.py +479 -0
- hydpy/models/dummy/__init__.py +15 -0
- hydpy/models/dummy/dummy_control.py +22 -0
- hydpy/models/dummy/dummy_fluxes.py +11 -0
- hydpy/models/dummy/dummy_inlets.py +11 -0
- hydpy/models/dummy/dummy_inputs.py +41 -0
- hydpy/models/dummy/dummy_model.py +196 -0
- hydpy/models/dummy/dummy_outlets.py +11 -0
- hydpy/models/dummy_interceptedwater.py +85 -0
- hydpy/models/dummy_node2node.py +83 -0
- hydpy/models/dummy_snowalbedo.py +84 -0
- hydpy/models/dummy_snowcover.py +84 -0
- hydpy/models/dummy_snowycanopy.py +86 -0
- hydpy/models/dummy_soilwater.py +85 -0
- hydpy/models/evap/__init__.py +13 -0
- hydpy/models/evap/evap_control.py +354 -0
- hydpy/models/evap/evap_derived.py +236 -0
- hydpy/models/evap/evap_factors.py +188 -0
- hydpy/models/evap/evap_fixed.py +68 -0
- hydpy/models/evap/evap_fluxes.py +150 -0
- hydpy/models/evap/evap_inputs.py +54 -0
- hydpy/models/evap/evap_logs.py +91 -0
- hydpy/models/evap/evap_masks.py +48 -0
- hydpy/models/evap/evap_model.py +9170 -0
- hydpy/models/evap/evap_parameters.py +149 -0
- hydpy/models/evap/evap_sequences.py +32 -0
- hydpy/models/evap/evap_states.py +18 -0
- hydpy/models/evap_aet_hbv96.py +372 -0
- hydpy/models/evap_aet_minhas.py +331 -0
- hydpy/models/evap_aet_morsim.py +627 -0
- hydpy/models/evap_pet_ambav1.py +483 -0
- hydpy/models/evap_pet_hbv96.py +147 -0
- hydpy/models/evap_pet_m.py +94 -0
- hydpy/models/evap_pet_mlc.py +107 -0
- hydpy/models/evap_ret_fao56.py +265 -0
- hydpy/models/evap_ret_io.py +74 -0
- hydpy/models/evap_ret_tw2002.py +165 -0
- hydpy/models/exch/__init__.py +14 -0
- hydpy/models/exch/exch_control.py +262 -0
- hydpy/models/exch/exch_derived.py +36 -0
- hydpy/models/exch/exch_factors.py +26 -0
- hydpy/models/exch/exch_fluxes.py +48 -0
- hydpy/models/exch/exch_inlets.py +11 -0
- hydpy/models/exch/exch_logs.py +12 -0
- hydpy/models/exch/exch_model.py +451 -0
- hydpy/models/exch/exch_outlets.py +17 -0
- hydpy/models/exch/exch_receivers.py +17 -0
- hydpy/models/exch_branch_hbv96.py +186 -0
- hydpy/models/exch_waterlevel.py +73 -0
- hydpy/models/exch_weir_hbv96.py +609 -0
- hydpy/models/ga/__init__.py +14 -0
- hydpy/models/ga/ga_aides.py +17 -0
- hydpy/models/ga/ga_control.py +208 -0
- hydpy/models/ga/ga_derived.py +77 -0
- hydpy/models/ga/ga_fluxes.py +83 -0
- hydpy/models/ga/ga_inputs.py +26 -0
- hydpy/models/ga/ga_logs.py +17 -0
- hydpy/models/ga/ga_model.py +2952 -0
- hydpy/models/ga/ga_states.py +87 -0
- hydpy/models/ga_garto.py +1001 -0
- hydpy/models/ga_garto_submodel1.py +79 -0
- hydpy/models/gland/__init__.py +14 -0
- hydpy/models/gland/gland_control.py +90 -0
- hydpy/models/gland/gland_derived.py +113 -0
- hydpy/models/gland/gland_fluxes.py +137 -0
- hydpy/models/gland/gland_inputs.py +12 -0
- hydpy/models/gland/gland_model.py +1439 -0
- hydpy/models/gland/gland_outlets.py +11 -0
- hydpy/models/gland/gland_states.py +90 -0
- hydpy/models/gland_gr4.py +501 -0
- hydpy/models/gland_gr5.py +463 -0
- hydpy/models/gland_gr6.py +487 -0
- hydpy/models/hland/__init__.py +20 -0
- hydpy/models/hland/hland_aides.py +19 -0
- hydpy/models/hland/hland_constants.py +37 -0
- hydpy/models/hland/hland_control.py +1530 -0
- hydpy/models/hland/hland_derived.py +683 -0
- hydpy/models/hland/hland_factors.py +57 -0
- hydpy/models/hland/hland_fixed.py +42 -0
- hydpy/models/hland/hland_fluxes.py +279 -0
- hydpy/models/hland/hland_inputs.py +19 -0
- hydpy/models/hland/hland_masks.py +107 -0
- hydpy/models/hland/hland_model.py +4664 -0
- hydpy/models/hland/hland_outlets.py +11 -0
- hydpy/models/hland/hland_parameters.py +227 -0
- hydpy/models/hland/hland_sequences.py +382 -0
- hydpy/models/hland/hland_states.py +236 -0
- hydpy/models/hland_96.py +1812 -0
- hydpy/models/hland_96c.py +1196 -0
- hydpy/models/hland_96p.py +1204 -0
- hydpy/models/kinw/__init__.py +18 -0
- hydpy/models/kinw/kinw_aides.py +306 -0
- hydpy/models/kinw/kinw_control.py +270 -0
- hydpy/models/kinw/kinw_derived.py +197 -0
- hydpy/models/kinw/kinw_fixed.py +33 -0
- hydpy/models/kinw/kinw_fluxes.py +37 -0
- hydpy/models/kinw/kinw_inlets.py +11 -0
- hydpy/models/kinw/kinw_model.py +3026 -0
- hydpy/models/kinw/kinw_outlets.py +11 -0
- hydpy/models/kinw/kinw_solver.py +45 -0
- hydpy/models/kinw/kinw_states.py +17 -0
- hydpy/models/kinw_williams.py +1299 -0
- hydpy/models/kinw_williams_ext.py +768 -0
- hydpy/models/lland/__init__.py +42 -0
- hydpy/models/lland/lland_aides.py +38 -0
- hydpy/models/lland/lland_constants.py +88 -0
- hydpy/models/lland/lland_control.py +1329 -0
- hydpy/models/lland/lland_derived.py +380 -0
- hydpy/models/lland/lland_factors.py +18 -0
- hydpy/models/lland/lland_fixed.py +128 -0
- hydpy/models/lland/lland_fluxes.py +626 -0
- hydpy/models/lland/lland_inlets.py +12 -0
- hydpy/models/lland/lland_inputs.py +33 -0
- hydpy/models/lland/lland_logs.py +17 -0
- hydpy/models/lland/lland_masks.py +212 -0
- hydpy/models/lland/lland_model.py +7690 -0
- hydpy/models/lland/lland_outlets.py +12 -0
- hydpy/models/lland/lland_parameters.py +195 -0
- hydpy/models/lland/lland_sequences.py +67 -0
- hydpy/models/lland/lland_states.py +280 -0
- hydpy/models/lland_dd.py +2270 -0
- hydpy/models/lland_knauf.py +2156 -0
- hydpy/models/lland_knauf_ic.py +1920 -0
- hydpy/models/meteo/__init__.py +12 -0
- hydpy/models/meteo/meteo_control.py +154 -0
- hydpy/models/meteo/meteo_derived.py +159 -0
- hydpy/models/meteo/meteo_factors.py +88 -0
- hydpy/models/meteo/meteo_fixed.py +19 -0
- hydpy/models/meteo/meteo_fluxes.py +46 -0
- hydpy/models/meteo/meteo_inputs.py +47 -0
- hydpy/models/meteo/meteo_logs.py +30 -0
- hydpy/models/meteo/meteo_model.py +2904 -0
- hydpy/models/meteo/meteo_parameters.py +14 -0
- hydpy/models/meteo/meteo_sequences.py +22 -0
- hydpy/models/meteo_clear_glob_io.py +77 -0
- hydpy/models/meteo_glob_fao56.py +217 -0
- hydpy/models/meteo_glob_io.py +68 -0
- hydpy/models/meteo_glob_morsim.py +444 -0
- hydpy/models/meteo_precip_io.py +76 -0
- hydpy/models/meteo_psun_sun_glob_io.py +83 -0
- hydpy/models/meteo_sun_fao56.py +188 -0
- hydpy/models/meteo_sun_morsim.py +466 -0
- hydpy/models/meteo_temp_io.py +76 -0
- hydpy/models/musk/__init__.py +15 -0
- hydpy/models/musk/musk_control.py +328 -0
- hydpy/models/musk/musk_derived.py +32 -0
- hydpy/models/musk/musk_factors.py +53 -0
- hydpy/models/musk/musk_fluxes.py +24 -0
- hydpy/models/musk/musk_inlets.py +11 -0
- hydpy/models/musk/musk_masks.py +15 -0
- hydpy/models/musk/musk_model.py +838 -0
- hydpy/models/musk/musk_outlets.py +11 -0
- hydpy/models/musk/musk_sequences.py +88 -0
- hydpy/models/musk/musk_solver.py +68 -0
- hydpy/models/musk/musk_states.py +64 -0
- hydpy/models/musk_classic.py +228 -0
- hydpy/models/musk_mct.py +1247 -0
- hydpy/models/rconc/__init__.py +12 -0
- hydpy/models/rconc/rconc_control.py +473 -0
- hydpy/models/rconc/rconc_derived.py +76 -0
- hydpy/models/rconc/rconc_fluxes.py +19 -0
- hydpy/models/rconc/rconc_logs.py +74 -0
- hydpy/models/rconc/rconc_model.py +260 -0
- hydpy/models/rconc/rconc_states.py +11 -0
- hydpy/models/rconc_nash.py +48 -0
- hydpy/models/rconc_uh.py +53 -0
- hydpy/models/sw1d/__init__.py +17 -0
- hydpy/models/sw1d/sw1d_control.py +356 -0
- hydpy/models/sw1d/sw1d_derived.py +85 -0
- hydpy/models/sw1d/sw1d_factors.py +78 -0
- hydpy/models/sw1d/sw1d_fixed.py +12 -0
- hydpy/models/sw1d/sw1d_fluxes.py +55 -0
- hydpy/models/sw1d/sw1d_inlets.py +17 -0
- hydpy/models/sw1d/sw1d_model.py +3385 -0
- hydpy/models/sw1d/sw1d_outlets.py +11 -0
- hydpy/models/sw1d/sw1d_receivers.py +11 -0
- hydpy/models/sw1d/sw1d_senders.py +11 -0
- hydpy/models/sw1d/sw1d_states.py +23 -0
- hydpy/models/sw1d_channel.py +2051 -0
- hydpy/models/sw1d_gate_out.py +599 -0
- hydpy/models/sw1d_lias.py +105 -0
- hydpy/models/sw1d_lias_sluice.py +531 -0
- hydpy/models/sw1d_network.py +1219 -0
- hydpy/models/sw1d_pump.py +448 -0
- hydpy/models/sw1d_q_in.py +79 -0
- hydpy/models/sw1d_q_out.py +81 -0
- hydpy/models/sw1d_storage.py +78 -0
- hydpy/models/sw1d_weir_out.py +75 -0
- hydpy/models/test/__init__.py +14 -0
- hydpy/models/test/test_control.py +28 -0
- hydpy/models/test/test_fluxes.py +17 -0
- hydpy/models/test/test_model.py +201 -0
- hydpy/models/test/test_solver.py +48 -0
- hydpy/models/test/test_states.py +17 -0
- hydpy/models/test_discontinous.py +46 -0
- hydpy/models/test_stiff0d.py +47 -0
- hydpy/models/test_stiff1d.py +42 -0
- hydpy/models/whmod/__init__.py +21 -0
- hydpy/models/whmod/whmod_constants.py +77 -0
- hydpy/models/whmod/whmod_control.py +333 -0
- hydpy/models/whmod/whmod_derived.py +210 -0
- hydpy/models/whmod/whmod_factors.py +9 -0
- hydpy/models/whmod/whmod_fluxes.py +105 -0
- hydpy/models/whmod/whmod_inputs.py +15 -0
- hydpy/models/whmod/whmod_masks.py +178 -0
- hydpy/models/whmod/whmod_model.py +2091 -0
- hydpy/models/whmod/whmod_parameters.py +155 -0
- hydpy/models/whmod/whmod_sequences.py +193 -0
- hydpy/models/whmod/whmod_states.py +73 -0
- hydpy/models/whmod_rural.py +794 -0
- hydpy/models/whmod_urban.py +1011 -0
- hydpy/models/wland/__init__.py +43 -0
- hydpy/models/wland/wland_aides.py +55 -0
- hydpy/models/wland/wland_constants.py +103 -0
- hydpy/models/wland/wland_control.py +508 -0
- hydpy/models/wland/wland_derived.py +330 -0
- hydpy/models/wland/wland_factors.py +11 -0
- hydpy/models/wland/wland_fixed.py +12 -0
- hydpy/models/wland/wland_fluxes.py +166 -0
- hydpy/models/wland/wland_inputs.py +33 -0
- hydpy/models/wland/wland_masks.py +54 -0
- hydpy/models/wland/wland_model.py +3755 -0
- hydpy/models/wland/wland_outlets.py +11 -0
- hydpy/models/wland/wland_parameters.py +214 -0
- hydpy/models/wland/wland_sequences.py +108 -0
- hydpy/models/wland/wland_solver.py +45 -0
- hydpy/models/wland/wland_states.py +56 -0
- hydpy/models/wland_gd.py +888 -0
- hydpy/models/wland_wag.py +1244 -0
- hydpy/models/wq/__init__.py +14 -0
- hydpy/models/wq/wq_control.py +117 -0
- hydpy/models/wq/wq_derived.py +182 -0
- hydpy/models/wq/wq_factors.py +79 -0
- hydpy/models/wq/wq_fluxes.py +17 -0
- hydpy/models/wq/wq_model.py +1889 -0
- hydpy/models/wq_trapeze.py +168 -0
- hydpy/models/wq_trapeze_strickler.py +101 -0
- hydpy/models/wq_walrus.py +57 -0
- hydpy/py.typed +0 -0
- hydpy/tests/.coveragerc +22 -0
- hydpy/tests/__init__.py +0 -0
- hydpy/tests/check_consistency.py +32 -0
- hydpy/tests/hydpydoctestcustomize.pth +1 -0
- hydpy/tests/hydpydoctestcustomize.py +15 -0
- hydpy/tests/iotesting/__init__.py +0 -0
- hydpy/tests/run_doctests.py +233 -0
- hydpy-6.2.dev1.data/scripts/hyd.py +277 -0
- hydpy-6.2.dev1.dist-info/LICENSE +165 -0
- hydpy-6.2.dev1.dist-info/METADATA +163 -0
- hydpy-6.2.dev1.dist-info/RECORD +890 -0
- hydpy-6.2.dev1.dist-info/WHEEL +5 -0
- hydpy-6.2.dev1.dist-info/licenses_hydpy_installer.txt +42 -0
- hydpy-6.2.dev1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1094 @@
|
|
|
1
|
+
"""This module enables model developers to easily include linear and nonlinear
|
|
2
|
+
interpolation techniques into their model methods.
|
|
3
|
+
|
|
4
|
+
The implemented classes |SimpleInterpolator| and |SeasonalInterpolator| serve as base
|
|
5
|
+
classes for (very complex) control parameters. Subclassing them is sufficient for
|
|
6
|
+
making the functionalities of the modules |interptools|, |anntools|, and |ppolytools|
|
|
7
|
+
available to the user.
|
|
8
|
+
|
|
9
|
+
The relevant models perform the interpolation during simulation runs, so we implemented
|
|
10
|
+
the related methods in the Cython extension module |interputils|.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
# import...
|
|
14
|
+
# ...from standard library
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import abc
|
|
17
|
+
import itertools
|
|
18
|
+
|
|
19
|
+
# ...from site-packages
|
|
20
|
+
import numpy
|
|
21
|
+
|
|
22
|
+
# ...from HydPy
|
|
23
|
+
import hydpy
|
|
24
|
+
from hydpy import config
|
|
25
|
+
from hydpy.core import exceptiontools
|
|
26
|
+
from hydpy.core import objecttools
|
|
27
|
+
from hydpy.core import parametertools
|
|
28
|
+
from hydpy.core import propertytools
|
|
29
|
+
from hydpy.core import timetools
|
|
30
|
+
from hydpy.core import variabletools
|
|
31
|
+
from hydpy.core.typingtools import *
|
|
32
|
+
from hydpy.cythons import interputils
|
|
33
|
+
|
|
34
|
+
if TYPE_CHECKING:
|
|
35
|
+
from matplotlib import pyplot
|
|
36
|
+
else:
|
|
37
|
+
pyplot = exceptiontools.OptionalImport("pyplot", ["matplotlib.pyplot"], locals())
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class _Labeled:
|
|
41
|
+
def _update_labels(self) -> None:
|
|
42
|
+
xlabel = getattr(self, "XLABEL", None)
|
|
43
|
+
if xlabel:
|
|
44
|
+
pyplot.xlabel(xlabel)
|
|
45
|
+
ylabel = getattr(self, "YLABEL", None)
|
|
46
|
+
if ylabel:
|
|
47
|
+
pyplot.ylabel(ylabel)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class InterpAlgorithm(_Labeled):
|
|
51
|
+
"""Base class for defining interpolation algorithms usable by classes
|
|
52
|
+
|SimpleInterpolator| and |SeasonalInterpolator|."""
|
|
53
|
+
|
|
54
|
+
nmb_inputs: propertytools.BaseProperty[Never, int]
|
|
55
|
+
"""The number of input values."""
|
|
56
|
+
inputs: propertytools.BaseProperty[Never, VectorFloat]
|
|
57
|
+
"""The current input values."""
|
|
58
|
+
nmb_outputs: propertytools.BaseProperty[Never, int]
|
|
59
|
+
"""The lastly calculated output values."""
|
|
60
|
+
outputs: propertytools.BaseProperty[Never, VectorFloat]
|
|
61
|
+
"""The lastly calculated output values."""
|
|
62
|
+
output_derivatives: propertytools.BaseProperty[Never, VectorFloat]
|
|
63
|
+
"""The lastly calculated first-order derivatives."""
|
|
64
|
+
|
|
65
|
+
@abc.abstractmethod
|
|
66
|
+
def calculate_values(self) -> None:
|
|
67
|
+
"""Calculate the output values based on the input values defined previously."""
|
|
68
|
+
|
|
69
|
+
@abc.abstractmethod
|
|
70
|
+
def calculate_derivatives(self, idx: int, /) -> None:
|
|
71
|
+
"""Calculate the derivatives of the output values with respect to the input
|
|
72
|
+
value of the given index."""
|
|
73
|
+
|
|
74
|
+
@abc.abstractmethod
|
|
75
|
+
def verify(self) -> None:
|
|
76
|
+
"""Raise a |RuntimeError| if the actual |InterpAlgorithm| object is
|
|
77
|
+
ill-defined."""
|
|
78
|
+
|
|
79
|
+
@abc.abstractmethod
|
|
80
|
+
def assignrepr(self, prefix: str, indent: int = 0) -> str:
|
|
81
|
+
"""Return a string representation of the actual |InterpAlgorithm| object
|
|
82
|
+
prefixed with the given string."""
|
|
83
|
+
|
|
84
|
+
def print_table(self, xs: VectorFloat | MatrixFloat) -> None:
|
|
85
|
+
"""Process the given input data and print the interpolated output values as
|
|
86
|
+
well as all partial first-order derivatives.
|
|
87
|
+
|
|
88
|
+
The documentation on class |PPoly| includes some examples of a strictly
|
|
89
|
+
univariate interpolator. Here, we take up some examples discussed for class
|
|
90
|
+
|ANN| to show that method |InterpAlgorithm.print_table| also correctly reports
|
|
91
|
+
all outputs and derivatives for multivariate interpolators.
|
|
92
|
+
|
|
93
|
+
A single-input single-output example:
|
|
94
|
+
|
|
95
|
+
>>> from hydpy import ANN, nan
|
|
96
|
+
>>> ann = ANN(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
|
|
97
|
+
... weights_input=4.0, weights_output=3.0,
|
|
98
|
+
... intercepts_hidden=-16.0, intercepts_output=-1.0)
|
|
99
|
+
>>> ann.print_table([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0])
|
|
100
|
+
x y dy/dx
|
|
101
|
+
0.0 -1.0 0.000001
|
|
102
|
+
1.0 -0.999982 0.000074
|
|
103
|
+
2.0 -0.998994 0.004023
|
|
104
|
+
3.0 -0.946041 0.211952
|
|
105
|
+
4.0 0.5 3.0
|
|
106
|
+
5.0 1.946041 0.211952
|
|
107
|
+
6.0 1.998994 0.004023
|
|
108
|
+
7.0 1.999982 0.000074
|
|
109
|
+
8.0 2.0 0.000001
|
|
110
|
+
|
|
111
|
+
A multivariate example (three input and two output values result in six partial
|
|
112
|
+
derivatives):
|
|
113
|
+
|
|
114
|
+
>>> ann.nmb_inputs = 3
|
|
115
|
+
>>> ann.nmb_neurons = (4,)
|
|
116
|
+
>>> ann.nmb_outputs = 2
|
|
117
|
+
>>> ann.weights_input = [[ 0.2, -0.1, -1.7, 0.6],
|
|
118
|
+
... [ 0.9, 0.2, 0.8, 0.0],
|
|
119
|
+
... [-0.5, -1.0, 2.3, -0.4]]
|
|
120
|
+
>>> ann.weights_output = [[ 0.0, 2.0],
|
|
121
|
+
... [-0.5, 1.0],
|
|
122
|
+
... [ 0.4, 2.4],
|
|
123
|
+
... [ 0.8, -0.9]]
|
|
124
|
+
>>> ann.intercepts_hidden = [ 0.9, 0.0, -0.4, -0.2]
|
|
125
|
+
>>> ann.intercepts_output = [ 1.3, -2.0]
|
|
126
|
+
>>> ann.print_table([[-0.1, 1.3, 1.6]])
|
|
127
|
+
x1 x2 x3 y1 y2 dy1/dx1 dy2/dx1 dy1/dx2 dy2/dx2 \
|
|
128
|
+
dy1/dx3 dy2/dx3
|
|
129
|
+
-0.1 1.3 1.6 1.822222 1.876983 0.099449 -0.103039 -0.01303 0.365739 \
|
|
130
|
+
0.027041 -0.203965
|
|
131
|
+
|
|
132
|
+
A combined example (two inputs, one output):
|
|
133
|
+
|
|
134
|
+
>>> ANN(nmb_inputs=2, nmb_neurons=(2, 1), nmb_outputs=1,
|
|
135
|
+
... weights_input=[[1000.0, 500.0],
|
|
136
|
+
... [1000.0, 500.0]],
|
|
137
|
+
... weights_hidden=[[[1000.0],
|
|
138
|
+
... [-1000.0]]],
|
|
139
|
+
... weights_output=[[1.0]],
|
|
140
|
+
... intercepts_hidden=[[-750.0, -750.0],
|
|
141
|
+
... [-750.0, nan]],
|
|
142
|
+
... intercepts_output=[0.0],
|
|
143
|
+
... ).print_table([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]])
|
|
144
|
+
x1 x2 y dy/dx1 dy/dx2
|
|
145
|
+
0.0 0.0 0.0 0.0 0.0
|
|
146
|
+
1.0 0.0 1.0 0.0 0.0
|
|
147
|
+
0.0 1.0 1.0 0.0 0.0
|
|
148
|
+
1.0 1.0 0.0 0.0 0.0
|
|
149
|
+
"""
|
|
150
|
+
r = objecttools.repr_
|
|
151
|
+
|
|
152
|
+
ni, no = self.nmb_inputs, self.nmb_outputs
|
|
153
|
+
nt = ni + no
|
|
154
|
+
table = numpy.empty((len(xs) + 1, nt + ni * no), dtype=object)
|
|
155
|
+
|
|
156
|
+
xns = "x" if ni == 1 else [f"x{i}" for i in range(1, ni + 1)]
|
|
157
|
+
yns = "y" if no == 1 else [f"y{i}" for i in range(1, no + 1)]
|
|
158
|
+
table[0, :ni] = xns
|
|
159
|
+
table[0, ni:nt] = yns
|
|
160
|
+
table[0, nt:] = [f"d{yn}/d{xn}" for xn, yn in itertools.product(xns, yns)]
|
|
161
|
+
|
|
162
|
+
# Mypy problem? See issue https://github.com/python/mypy/issues/8586:
|
|
163
|
+
xs_: float | Iterable[float]
|
|
164
|
+
for ri, xs_ in enumerate(xs):
|
|
165
|
+
ri += 1
|
|
166
|
+
if isinstance(xs_, float):
|
|
167
|
+
xs_ = (xs_,)
|
|
168
|
+
for xi, x in enumerate(xs_):
|
|
169
|
+
table[ri, xi] = r(x)
|
|
170
|
+
self.inputs[xi] = x
|
|
171
|
+
self.calculate_values()
|
|
172
|
+
for yi, y in enumerate(self.outputs):
|
|
173
|
+
table[ri, ni + yi] = r(y)
|
|
174
|
+
for xi in range(ni):
|
|
175
|
+
self.calculate_derivatives(xi)
|
|
176
|
+
for yi in range(no):
|
|
177
|
+
table[ri, nt + no * xi + yi] = r(self.output_derivatives[yi])
|
|
178
|
+
|
|
179
|
+
for j in range(table.shape[1] - 1):
|
|
180
|
+
length = max(len(v) for v in table[:, j])
|
|
181
|
+
table[:, j] = [v.ljust(length) for v in table[:, j]]
|
|
182
|
+
for row in table:
|
|
183
|
+
print(*row, sep=" ")
|
|
184
|
+
|
|
185
|
+
def plot(
|
|
186
|
+
self,
|
|
187
|
+
xmin: float,
|
|
188
|
+
xmax: float,
|
|
189
|
+
*,
|
|
190
|
+
idx_input: int = 0,
|
|
191
|
+
idx_output: int = 0,
|
|
192
|
+
points: int = 100,
|
|
193
|
+
**kwargs: Any,
|
|
194
|
+
) -> pyplot.Figure:
|
|
195
|
+
"""Plot the relationship between particular input (`idx_input`) and output
|
|
196
|
+
(`idx_output`) values defined by the actual |InterpAlgorithm| object.
|
|
197
|
+
|
|
198
|
+
You need to define the lower and the upper bound of the x-axis via arguments
|
|
199
|
+
`xmin` and `xmax`. You can increase or decrease the accuracy of the plot by
|
|
200
|
+
changing the number of points evaluated within this interval (default is 100).
|
|
201
|
+
For visual configuration, pass arbitrary |matplotlib| `pyplot` plotting
|
|
202
|
+
arguments as keyword arguments.
|
|
203
|
+
|
|
204
|
+
See the documentation on classes |ANN| and |PPoly| for some examples.
|
|
205
|
+
"""
|
|
206
|
+
xs_ = numpy.linspace(xmin, xmax, points)
|
|
207
|
+
ys_ = numpy.zeros(xs_.shape)
|
|
208
|
+
for idx, x__ in enumerate(xs_):
|
|
209
|
+
self.inputs[idx_input] = x__
|
|
210
|
+
self.calculate_values()
|
|
211
|
+
ys_[idx] = self.outputs[idx_output]
|
|
212
|
+
pyplot.plot(xs_, ys_, **kwargs)
|
|
213
|
+
self._update_labels()
|
|
214
|
+
return pyplot.gcf()
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class BaseInterpolator(_Labeled):
|
|
218
|
+
"""Base class for |SimpleInterpolator| and |SeasonalInterpolator|."""
|
|
219
|
+
|
|
220
|
+
NDIM = 0
|
|
221
|
+
TIME = None
|
|
222
|
+
SPAN = (None, None)
|
|
223
|
+
|
|
224
|
+
name: str
|
|
225
|
+
"""Class name in lowercase letters."""
|
|
226
|
+
subvars: parametertools.SubParameters
|
|
227
|
+
"""The |SubParameters| object containing the current |BaseInterpolator| object."""
|
|
228
|
+
subpars: parametertools.SubParameters
|
|
229
|
+
"""The |SubParameters| object containing the current |BaseInterpolator| object."""
|
|
230
|
+
fastaccess: parametertools.FastAccessParameter
|
|
231
|
+
"""The `fastaccess` object providing access to the interpolator functionalities
|
|
232
|
+
implemented in Cython."""
|
|
233
|
+
|
|
234
|
+
__hydpy__subclasscounter__: ClassVar[int]
|
|
235
|
+
|
|
236
|
+
def __init_subclass__(cls) -> None:
|
|
237
|
+
cls.name = cls.__name__.lower()
|
|
238
|
+
subclasscounter = variabletools.Variable.__hydpy__subclasscounter__ + 1
|
|
239
|
+
variabletools.Variable.__hydpy__subclasscounter__ = subclasscounter
|
|
240
|
+
cls.__hydpy__subclasscounter__ = subclasscounter
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class SimpleInterpolator(BaseInterpolator):
|
|
244
|
+
"""Parameter base class for handling interpolation problems.
|
|
245
|
+
|
|
246
|
+
|SimpleInterpolator| serves as a base class for parameter objects that accept
|
|
247
|
+
an |InterpAlgorithm| object as their "value", which allows model users to select
|
|
248
|
+
interpolation algorithms and configure them according to the data at hand. If, for
|
|
249
|
+
example, linear interpolation is sufficient, one can prepare and hand over a
|
|
250
|
+
|PPoly| object:
|
|
251
|
+
|
|
252
|
+
>>> from hydpy.auxs.interptools import SimpleInterpolator
|
|
253
|
+
>>> simpleinterpolator = SimpleInterpolator(None)
|
|
254
|
+
>>> simpleinterpolator
|
|
255
|
+
simpleinterpolator(?)
|
|
256
|
+
|
|
257
|
+
>>> from hydpy import ANN, PPoly, print_vector
|
|
258
|
+
>>> simpleinterpolator(PPoly.from_data(xs=[0.0, 1.0], ys=[0.0, 2.0]))
|
|
259
|
+
>>> simpleinterpolator
|
|
260
|
+
simpleinterpolator(
|
|
261
|
+
PPoly(
|
|
262
|
+
Poly(x0=0.0, cs=(0.0, 2.0)),
|
|
263
|
+
)
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
Besides handling an |InterpAlgorithm| object and connecting it to its model
|
|
267
|
+
instance, |SimpleInterpolator| provides no own functionalities. Instead, its
|
|
268
|
+
user-available properties and methods call the identically named properties and
|
|
269
|
+
methods of the handled interpolator, thereby passing all possible arguments without
|
|
270
|
+
modification. Hence, read the documentation on the subclasses of |InterpAlgorithm|
|
|
271
|
+
for further information.
|
|
272
|
+
|
|
273
|
+
The following technical checks ensure the proper implementation of all delegations:
|
|
274
|
+
|
|
275
|
+
>>> simpleinterpolator(ANN(nmb_inputs=2, nmb_outputs=3))
|
|
276
|
+
>>> simpleinterpolator.nmb_inputs
|
|
277
|
+
2
|
|
278
|
+
>>> simpleinterpolator.nmb_outputs
|
|
279
|
+
3
|
|
280
|
+
>>> simpleinterpolator.algorithm.inputs = 1.0, 2.0
|
|
281
|
+
>>> print_vector(simpleinterpolator.inputs)
|
|
282
|
+
1.0, 2.0
|
|
283
|
+
>>> simpleinterpolator.algorithm.outputs = 3.0, 4.0, 5.0
|
|
284
|
+
>>> print_vector(simpleinterpolator.outputs)
|
|
285
|
+
3.0, 4.0, 5.0
|
|
286
|
+
>>> simpleinterpolator.algorithm.output_derivatives = 6.0, 7.0, 8.0
|
|
287
|
+
>>> print_vector(simpleinterpolator.output_derivatives)
|
|
288
|
+
6.0, 7.0, 8.0
|
|
289
|
+
>>> from unittest.mock import patch
|
|
290
|
+
>>> with patch.object(ANN, "verify") as mock:
|
|
291
|
+
... assert simpleinterpolator.verify() is None
|
|
292
|
+
>>> mock.assert_called_with()
|
|
293
|
+
>>> with patch.object(ANN, "calculate_values") as mock:
|
|
294
|
+
... assert simpleinterpolator.calculate_values() is None
|
|
295
|
+
>>> mock.assert_called_with()
|
|
296
|
+
>>> with patch.object(ANN, "calculate_derivatives") as mock:
|
|
297
|
+
... assert simpleinterpolator.calculate_derivatives(3) is None
|
|
298
|
+
>>> mock.assert_called_with(3)
|
|
299
|
+
>>> with patch.object(ANN, "print_table") as mock:
|
|
300
|
+
... assert simpleinterpolator.print_table(xs=[1.0, 2.0]) is None
|
|
301
|
+
>>> mock.assert_called_with(xs=[1.0, 2.0])
|
|
302
|
+
>>> kwargs = dict(xmin=0.0, xmax=1.0, idx_input=1, idx_output=2, points=10, opt="?")
|
|
303
|
+
>>> with patch.object(ANN, "plot") as mock:
|
|
304
|
+
... mock.return_value = "figure"
|
|
305
|
+
... assert simpleinterpolator.plot(**kwargs) == "figure"
|
|
306
|
+
>>> mock.assert_called_with(**kwargs)
|
|
307
|
+
"""
|
|
308
|
+
|
|
309
|
+
TYPE = "interputils.SimpleInterpolator"
|
|
310
|
+
|
|
311
|
+
_algorithm: InterpAlgorithm | None
|
|
312
|
+
|
|
313
|
+
__simpleinterpolator: interputils.SimpleInterpolator | None
|
|
314
|
+
|
|
315
|
+
def __init__(self, subvars: parametertools.SubParameters) -> None:
|
|
316
|
+
self.subvars = subvars
|
|
317
|
+
self.subpars = subvars
|
|
318
|
+
self.fastaccess = parametertools.FastAccessParameter()
|
|
319
|
+
self._algorithm = None
|
|
320
|
+
self.__simpleinterpolator = None
|
|
321
|
+
self._do_refresh = True
|
|
322
|
+
|
|
323
|
+
def __hydpy__connect_variable2subgroup__(self) -> None:
|
|
324
|
+
"""Connect the actual |SimpleInterpolator| object with the given
|
|
325
|
+
|SubParameters| object."""
|
|
326
|
+
self.fastaccess = self.subpars.fastaccess
|
|
327
|
+
setattr(self.fastaccess, self.name, self.__simpleinterpolator)
|
|
328
|
+
|
|
329
|
+
def __call__(self, algorithm: InterpAlgorithm) -> None:
|
|
330
|
+
self._algorithm = algorithm
|
|
331
|
+
self.__simpleinterpolator = interputils.SimpleInterpolator(algorithm)
|
|
332
|
+
setattr(self.fastaccess, self.name, self.__simpleinterpolator)
|
|
333
|
+
|
|
334
|
+
@property
|
|
335
|
+
def algorithm(self) -> InterpAlgorithm:
|
|
336
|
+
"""The handled interpolation algorithm.
|
|
337
|
+
|
|
338
|
+
Trying to access the "I" object before defining it results in the following
|
|
339
|
+
error:
|
|
340
|
+
|
|
341
|
+
>>> from hydpy.auxs.interptools import SimpleInterpolator
|
|
342
|
+
>>> SimpleInterpolator(None).algorithm
|
|
343
|
+
Traceback (most recent call last):
|
|
344
|
+
...
|
|
345
|
+
RuntimeError: For parameter `simpleinterpolator` of element `?`, no \
|
|
346
|
+
interpolator has been defined so far.
|
|
347
|
+
"""
|
|
348
|
+
if self._algorithm:
|
|
349
|
+
return self._algorithm
|
|
350
|
+
raise RuntimeError(
|
|
351
|
+
f"For parameter {objecttools.elementphrase(self)}, no interpolator has "
|
|
352
|
+
f"been defined so far."
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
@property
|
|
356
|
+
def nmb_inputs(self) -> int:
|
|
357
|
+
"""The number of input values."""
|
|
358
|
+
return self.algorithm.nmb_inputs
|
|
359
|
+
|
|
360
|
+
@property
|
|
361
|
+
def nmb_outputs(self) -> int:
|
|
362
|
+
"""The number of output values."""
|
|
363
|
+
return self.algorithm.nmb_outputs
|
|
364
|
+
|
|
365
|
+
@property
|
|
366
|
+
def inputs(self) -> VectorFloat:
|
|
367
|
+
"""The current input values."""
|
|
368
|
+
return self.algorithm.inputs
|
|
369
|
+
|
|
370
|
+
@property
|
|
371
|
+
def outputs(self) -> VectorFloat:
|
|
372
|
+
"""The current input values."""
|
|
373
|
+
return self.algorithm.outputs
|
|
374
|
+
|
|
375
|
+
@property
|
|
376
|
+
def output_derivatives(self) -> VectorFloat:
|
|
377
|
+
"""The current input values."""
|
|
378
|
+
return self.algorithm.output_derivatives
|
|
379
|
+
|
|
380
|
+
def verify(self) -> None:
|
|
381
|
+
"""Raise a |RuntimeError| if the current |InterpAlgorithm| object shows
|
|
382
|
+
inconsistencies."""
|
|
383
|
+
self.algorithm.verify()
|
|
384
|
+
|
|
385
|
+
def calculate_values(self) -> None:
|
|
386
|
+
"""Calculate the output values based on the input values defined previously."""
|
|
387
|
+
self.algorithm.calculate_values()
|
|
388
|
+
|
|
389
|
+
def calculate_derivatives(self, idx: int, /) -> None:
|
|
390
|
+
"""Calculate the derivatives of the output values with respect to the input
|
|
391
|
+
value of the given index."""
|
|
392
|
+
self.algorithm.calculate_derivatives(idx)
|
|
393
|
+
|
|
394
|
+
def print_table(self, xs: VectorFloat | MatrixFloat) -> None:
|
|
395
|
+
"""Process the given input data and print the interpolated output values as
|
|
396
|
+
well as all partial first-order derivatives."""
|
|
397
|
+
self.algorithm.print_table(xs=xs)
|
|
398
|
+
|
|
399
|
+
def plot(
|
|
400
|
+
self,
|
|
401
|
+
xmin: float,
|
|
402
|
+
xmax: float,
|
|
403
|
+
*,
|
|
404
|
+
idx_input: int = 0,
|
|
405
|
+
idx_output: int = 0,
|
|
406
|
+
points: int = 100,
|
|
407
|
+
**kwargs: float | str | None,
|
|
408
|
+
) -> pyplot.Figure:
|
|
409
|
+
"""Plot the relationship between particular input (`idx_input`) and output
|
|
410
|
+
(`idx_output`) values defined by the actual |InterpAlgorithm| object."""
|
|
411
|
+
figure = self.algorithm.plot(
|
|
412
|
+
xmin=xmin,
|
|
413
|
+
xmax=xmax,
|
|
414
|
+
idx_input=idx_input,
|
|
415
|
+
idx_output=idx_output,
|
|
416
|
+
points=points,
|
|
417
|
+
**kwargs,
|
|
418
|
+
)
|
|
419
|
+
self._update_labels()
|
|
420
|
+
return figure
|
|
421
|
+
|
|
422
|
+
def __repr__(self) -> str:
|
|
423
|
+
if self._algorithm is None:
|
|
424
|
+
return f"{self.name}(?)"
|
|
425
|
+
return "\n".join(
|
|
426
|
+
(f"{self.name}(", self._algorithm.assignrepr(prefix=" ", indent=4), ")")
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class SeasonalInterpolator(BaseInterpolator):
|
|
431
|
+
"""Represent interpolation patterns showing an annual cycle.
|
|
432
|
+
|
|
433
|
+
Class |SeasonalInterpolator| is an alternative implementation of class
|
|
434
|
+
|SeasonalParameter| designed for handling multiple |InterpAlgorithm| objects that
|
|
435
|
+
are valid for different times of the year. The total output of
|
|
436
|
+
|SeasonalInterpolator| is the weighted mean of the outputs of its |InterpAlgorithm|
|
|
437
|
+
objects. The required weights depend on the season and are available within the
|
|
438
|
+
|SeasonalInterpolator.ratios| matrix.
|
|
439
|
+
|
|
440
|
+
To explain this in more detail, we modify an example of the documentatiob on class
|
|
441
|
+
|SeasonalParameter|. Let us define a |SeasonalInterpolator| object that contains
|
|
442
|
+
interpolators for January 1, March 1, and July 1, two of type |ANN| and one of type
|
|
443
|
+
|PPoly|:
|
|
444
|
+
|
|
445
|
+
>>> from hydpy import ANN, Poly, PPoly, pub, SeasonalInterpolator
|
|
446
|
+
>>> pub.timegrids = "2000-01-01", "2000-10-01", "1d"
|
|
447
|
+
>>> seasonalinterpolator = SeasonalInterpolator(None)
|
|
448
|
+
>>> seasonalinterpolator(
|
|
449
|
+
... _1_1_12=ANN(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
|
|
450
|
+
... weights_input=0.0, weights_output=0.0,
|
|
451
|
+
... intercepts_hidden=0.0, intercepts_output=1.0),
|
|
452
|
+
... _7_1_12=ANN(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
|
|
453
|
+
... weights_input=4.0, weights_output=3.0,
|
|
454
|
+
... intercepts_hidden=-16.0, intercepts_output=-1.0),
|
|
455
|
+
... _3_1_12=PPoly(Poly(x0=0.0, cs=(-1.0,))))
|
|
456
|
+
|
|
457
|
+
The confusing time order in the initialisation call above does not pose a problem,
|
|
458
|
+
as class |SeasonalInterpolator| performs time sorting internally:
|
|
459
|
+
|
|
460
|
+
>>> seasonalinterpolator
|
|
461
|
+
seasonalinterpolator(
|
|
462
|
+
toy_1_1_12_0_0=ANN(
|
|
463
|
+
weights_input=[[0.0]],
|
|
464
|
+
weights_output=[[0.0]],
|
|
465
|
+
intercepts_hidden=[[0.0]],
|
|
466
|
+
intercepts_output=[1.0],
|
|
467
|
+
),
|
|
468
|
+
toy_3_1_12_0_0=PPoly(
|
|
469
|
+
Poly(x0=0.0, cs=(-1.0,)),
|
|
470
|
+
),
|
|
471
|
+
toy_7_1_12_0_0=ANN(
|
|
472
|
+
weights_input=[[4.0]],
|
|
473
|
+
weights_output=[[3.0]],
|
|
474
|
+
intercepts_hidden=[[-16.0]],
|
|
475
|
+
intercepts_output=[-1.0],
|
|
476
|
+
),
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
Use method |SeasonalInterpolator.plot| to visualise all interpolators at once:
|
|
480
|
+
|
|
481
|
+
>>> figure = seasonalinterpolator.plot(xmin=0.0, xmax=8.0)
|
|
482
|
+
|
|
483
|
+
You can use the `pyplot` API of `matplotlib` to modify the figure or to save it to
|
|
484
|
+
disk (or print it to the screen, in case the interactive mode of `matplotlib` is
|
|
485
|
+
disabled):
|
|
486
|
+
|
|
487
|
+
>>> from hydpy.core.testtools import save_autofig
|
|
488
|
+
>>> save_autofig("SeasonalInterpolator_plot.png", figure=figure)
|
|
489
|
+
|
|
490
|
+
.. image:: SeasonalInterpolator_plot.png
|
|
491
|
+
|
|
492
|
+
Property |SeasonalInterpolator.shape| reflects the number of required weighting
|
|
493
|
+
ratios for each time of year (in this example, 366 days per year) and each
|
|
494
|
+
interpolator (in this example, three):
|
|
495
|
+
|
|
496
|
+
>>> seasonalinterpolator.shape
|
|
497
|
+
(366, 3)
|
|
498
|
+
|
|
499
|
+
The following plot shows the |SeasonalInterpolator.ratios| used for weighting (note
|
|
500
|
+
that the missing values for October, November, and December are irrelevant for the
|
|
501
|
+
initialisation period):
|
|
502
|
+
|
|
503
|
+
.. testsetup::
|
|
504
|
+
|
|
505
|
+
>>> from matplotlib import pyplot
|
|
506
|
+
>>> from hydpy.docs import autofigs
|
|
507
|
+
>>> import os
|
|
508
|
+
>>> for idx, toy in enumerate(seasonalinterpolator.toys):
|
|
509
|
+
... _ = pyplot.plot(seasonalinterpolator.ratios[:, idx], label=str(toy))
|
|
510
|
+
>>> _ = pyplot.legend()
|
|
511
|
+
>>> _ = pyplot.xticks(ticks=[0, 60, 182], labels=["Jan 1", "Mar 1", "Jul 1"])
|
|
512
|
+
>>> filename = "SeasonalInterpolator_ratios.png"
|
|
513
|
+
>>> pyplot.savefig(os.path.join(autofigs.__path__[0], filename))
|
|
514
|
+
>>> pyplot.clf()
|
|
515
|
+
|
|
516
|
+
... image:: SeasonalInterpolator_ratios.png
|
|
517
|
+
|
|
518
|
+
For example, on July 1 (which is the 183rd day of a leap year), only the output of
|
|
519
|
+
the third interpolator is relevant:
|
|
520
|
+
|
|
521
|
+
>>> from hydpy import print_vector
|
|
522
|
+
>>> print_vector(seasonalinterpolator.ratios[182])
|
|
523
|
+
0.0, 0.0, 1.0
|
|
524
|
+
|
|
525
|
+
On June 30 and July 2, the second and the first interpolators are also relevant:
|
|
526
|
+
|
|
527
|
+
>>> print_vector(seasonalinterpolator.ratios[181])
|
|
528
|
+
0.0, 0.008197, 0.991803
|
|
529
|
+
>>> print_vector(seasonalinterpolator.ratios[183])
|
|
530
|
+
0.005435, 0.0, 0.994565
|
|
531
|
+
|
|
532
|
+
Inserting data, processing this data, and fetching the output works as explained
|
|
533
|
+
for class |SimpleInterpolator|, except that you must additionally pass the index of
|
|
534
|
+
the actual time of year. For example, the index value `182` activates the third
|
|
535
|
+
interpolator only, configured as in the first example of the documentation on |ANN|:
|
|
536
|
+
|
|
537
|
+
>>> from hydpy import round_
|
|
538
|
+
>>> for input_ in range(9):
|
|
539
|
+
... seasonalinterpolator.inputs[0] = input_
|
|
540
|
+
... seasonalinterpolator.calculate_values(182)
|
|
541
|
+
... round_([input_, seasonalinterpolator.outputs[0]])
|
|
542
|
+
0, -1.0
|
|
543
|
+
1, -0.999982
|
|
544
|
+
2, -0.998994
|
|
545
|
+
3, -0.946041
|
|
546
|
+
4, 0.5
|
|
547
|
+
5, 1.946041
|
|
548
|
+
6, 1.998994
|
|
549
|
+
7, 1.999982
|
|
550
|
+
8, 2.0
|
|
551
|
+
|
|
552
|
+
To demonstrate that the final output values are the weighted mean of the output
|
|
553
|
+
values of the different interpolators, we repeat the above example for January 13.
|
|
554
|
+
For this day of the year, the first and the second interpolator have ratios of 0.8
|
|
555
|
+
and 0.2, respectively:
|
|
556
|
+
|
|
557
|
+
>>> print_vector(seasonalinterpolator.ratios[12])
|
|
558
|
+
0.8, 0.2, 0.0
|
|
559
|
+
|
|
560
|
+
Both interpolators calculate constant values. The sum of the outputs of the first
|
|
561
|
+
(1.0) and the second interpolator (-1.0) multiplied with their weights for January
|
|
562
|
+
13 is 0.6.
|
|
563
|
+
|
|
564
|
+
>>> seasonalinterpolator.calculate_values(12)
|
|
565
|
+
>>> round_(seasonalinterpolator.outputs[0])
|
|
566
|
+
0.6
|
|
567
|
+
|
|
568
|
+
It is of great importance that all contained interpolators are consistent. Class
|
|
569
|
+
|SeasonalInterpolator| performs some related checks:
|
|
570
|
+
|
|
571
|
+
>>> seasonalinterpolator = SeasonalInterpolator(None)
|
|
572
|
+
>>> seasonalinterpolator.calculate_values(0)
|
|
573
|
+
Traceback (most recent call last):
|
|
574
|
+
...
|
|
575
|
+
RuntimeError: The parameter `seasonalinterpolator` of element `?` has not been \
|
|
576
|
+
properly prepared so far.
|
|
577
|
+
|
|
578
|
+
>>> seasonalinterpolator(1)
|
|
579
|
+
Traceback (most recent call last):
|
|
580
|
+
...
|
|
581
|
+
TypeError: Type `int` is not (a subclass of) type `InterpAlgorithm`.
|
|
582
|
+
|
|
583
|
+
>>> seasonalinterpolator(_13_1_12=PPoly(Poly(x0=0.0, cs=(0.0,))))
|
|
584
|
+
Traceback (most recent call last):
|
|
585
|
+
...
|
|
586
|
+
ValueError: While trying to add a season specific interpolator to parameter \
|
|
587
|
+
`seasonalinterpolator` of element `?`, the following error occurred: While trying to \
|
|
588
|
+
initialise a TOY object based on argument value `_13_1_12` of type `str`, the \
|
|
589
|
+
following error occurred: While trying to retrieve the month, the following error \
|
|
590
|
+
occurred: The value of property `month` of TOY (time of year) objects must lie within \
|
|
591
|
+
the range `(1, 12)`, but the given value is `13`.
|
|
592
|
+
|
|
593
|
+
>>> seasonalinterpolator(PPoly(Poly(x0=0.0, cs=(0.0,))))
|
|
594
|
+
>>> seasonalinterpolator
|
|
595
|
+
seasonalinterpolator(
|
|
596
|
+
PPoly(
|
|
597
|
+
Poly(x0=0.0, cs=(0.0,)),
|
|
598
|
+
)
|
|
599
|
+
)
|
|
600
|
+
|
|
601
|
+
>>> seasonalinterpolator(PPoly(Poly(x0=0.0, cs=(0.0,))),
|
|
602
|
+
... _7_1_12=PPoly(Poly(x0=1.0, cs=(1.0,))),
|
|
603
|
+
... _3_1_12=PPoly(Poly(x0=20, cs=(1.0,))))
|
|
604
|
+
Traceback (most recent call last):
|
|
605
|
+
...
|
|
606
|
+
ValueError: Type `SeasonalInterpolator` accepts either a single positional \
|
|
607
|
+
argument or an arbitrary number of keyword arguments, but for the corresponding \
|
|
608
|
+
parameter of element `?` 1 positional and 2 keyword arguments have been given.
|
|
609
|
+
|
|
610
|
+
>>> seasonalinterpolator(_1_1_12=ANN(nmb_inputs=2, nmb_outputs=1),
|
|
611
|
+
... _7_1_12=PPoly(Poly(x0=1.0, cs=(1.0,))),
|
|
612
|
+
... _3_1_12=PPoly(Poly(x0=20, cs=(1.0,))))
|
|
613
|
+
Traceback (most recent call last):
|
|
614
|
+
...
|
|
615
|
+
RuntimeError: The number of input and output values of all interpolators \
|
|
616
|
+
handled by parameter `seasonalinterpolator` of element `?` must be defined in advance \
|
|
617
|
+
and be the same, which is not the case for at least two given interpolators.
|
|
618
|
+
|
|
619
|
+
For safety, each failure results in a total loss of the previously defined
|
|
620
|
+
interpolators:
|
|
621
|
+
|
|
622
|
+
>>> seasonalinterpolator
|
|
623
|
+
seasonalinterpolator()
|
|
624
|
+
|
|
625
|
+
You can add interpolators via attribute access:
|
|
626
|
+
|
|
627
|
+
>>> seasonalinterpolator.toy_1_1_12 = PPoly(Poly(x0=0.0, cs=(0.0,)))
|
|
628
|
+
|
|
629
|
+
If you set an attribute, everything updates automatically, e.g.:
|
|
630
|
+
|
|
631
|
+
>>> round_(seasonalinterpolator.ratios[0])
|
|
632
|
+
1.0
|
|
633
|
+
|
|
634
|
+
The mentioned safety checks also apply when adding interpolators via attribute
|
|
635
|
+
access:
|
|
636
|
+
|
|
637
|
+
>>> seasonalinterpolator.toy_7_1_12 = ANN(nmb_inputs=2, nmb_outputs=1)
|
|
638
|
+
Traceback (most recent call last):
|
|
639
|
+
...
|
|
640
|
+
RuntimeError: While trying to assign a new interpolator to parameter \
|
|
641
|
+
`seasonalinterpolator` of element `?` based on the string `toy_7_1_12`, the following \
|
|
642
|
+
error occurred: The number of input and output values of all interpolators handled by \
|
|
643
|
+
parameter `seasonalinterpolator` of element `?` must be defined in advance and be the \
|
|
644
|
+
same, which is not the case for at least two given interpolators.
|
|
645
|
+
|
|
646
|
+
Besides setting new interpolators, getting and deleting them also works:
|
|
647
|
+
|
|
648
|
+
>>> seasonalinterpolator.toy_1_1_12 = PPoly(Poly(x0=0.0, cs=(0.0,)))
|
|
649
|
+
>>> seasonalinterpolator.toy_1_1_12
|
|
650
|
+
PPoly(
|
|
651
|
+
Poly(x0=0.0, cs=(0.0,)),
|
|
652
|
+
)
|
|
653
|
+
>>> del seasonalinterpolator.toy_1_1_12
|
|
654
|
+
|
|
655
|
+
There are two error messages related to specific attribute access problems:
|
|
656
|
+
|
|
657
|
+
>>> seasonalinterpolator.toy_1_1_12
|
|
658
|
+
Traceback (most recent call last):
|
|
659
|
+
...
|
|
660
|
+
AttributeError: While trying to look up for an interpolator handled by parameter \
|
|
661
|
+
`seasonalinterpolator` of element `?` based on the string `toy_1_1_12`, the following \
|
|
662
|
+
error occurred: No interpolator is registered under a TOY object named `toy_1_1_12_0_0`.
|
|
663
|
+
|
|
664
|
+
>>> del seasonalinterpolator.toy_1_1_12
|
|
665
|
+
Traceback (most recent call last):
|
|
666
|
+
...
|
|
667
|
+
AttributeError: While trying to remove an interpolator from parameter \
|
|
668
|
+
`seasonalinterpolator` of element `?` based on the string `toy_1_1_12`, the following \
|
|
669
|
+
error occurred: No interpolator is registered under a TOY object named `toy_1_1_12_0_0`.
|
|
670
|
+
|
|
671
|
+
>>> seasonalinterpolator.toy_1_1_12 = 1
|
|
672
|
+
Traceback (most recent call last):
|
|
673
|
+
...
|
|
674
|
+
TypeError: While trying to assign a new interpolator to parameter \
|
|
675
|
+
`seasonalinterpolator` of element `?` based on the string `toy_1_1_12`, the following \
|
|
676
|
+
error occurred: Value `1` of type `int` has been given, but an object of type \
|
|
677
|
+
`InterpAlgorithm` is required.
|
|
678
|
+
|
|
679
|
+
Setting and deleting "normal" attributes is supported:
|
|
680
|
+
|
|
681
|
+
>>> seasonalinterpolator.temp = 999
|
|
682
|
+
>>> seasonalinterpolator.temp
|
|
683
|
+
999
|
|
684
|
+
>>> del seasonalinterpolator.temp
|
|
685
|
+
>>> seasonalinterpolator.temp
|
|
686
|
+
Traceback (most recent call last):
|
|
687
|
+
...
|
|
688
|
+
AttributeError: 'SeasonalInterpolator' object has no attribute 'temp'
|
|
689
|
+
"""
|
|
690
|
+
|
|
691
|
+
TYPE = "interputils.SeasonalInterpolator"
|
|
692
|
+
|
|
693
|
+
nmb_algorithms: int
|
|
694
|
+
|
|
695
|
+
_toy2algorithm: list[tuple[timetools.TOY, InterpAlgorithm]]
|
|
696
|
+
_do_refresh: bool
|
|
697
|
+
__seasonalinterpolator: interputils.SeasonalInterpolator | None
|
|
698
|
+
|
|
699
|
+
def __init__(self, subvars: parametertools.SubParameters) -> None:
|
|
700
|
+
self.subvars = subvars
|
|
701
|
+
self.subpars = subvars
|
|
702
|
+
self.fastaccess = parametertools.FastAccessParameter()
|
|
703
|
+
self._toy2algorithm = []
|
|
704
|
+
self.__seasonalinterpolator = None
|
|
705
|
+
self._do_refresh = True
|
|
706
|
+
|
|
707
|
+
@overload
|
|
708
|
+
def __call__(self, __algorithm: InterpAlgorithm) -> None: ...
|
|
709
|
+
|
|
710
|
+
@overload
|
|
711
|
+
def __call__(self, **algorithm: InterpAlgorithm) -> None: ...
|
|
712
|
+
|
|
713
|
+
def __call__(
|
|
714
|
+
self, *algorithm: InterpAlgorithm, **algorithms: InterpAlgorithm
|
|
715
|
+
) -> None:
|
|
716
|
+
self._toy2algorithm = []
|
|
717
|
+
self._do_refresh = False
|
|
718
|
+
try:
|
|
719
|
+
if (len(algorithm) > 1) or (algorithm and algorithms):
|
|
720
|
+
raise ValueError(
|
|
721
|
+
f"Type `{type(self).__name__}` accepts either a single positional "
|
|
722
|
+
f"argument or an arbitrary number of keyword arguments, but for "
|
|
723
|
+
f"the corresponding parameter of element "
|
|
724
|
+
f"`{objecttools.devicename(self)}` {len(algorithm)} positional "
|
|
725
|
+
f"and {len(algorithms)} keyword arguments have been given."
|
|
726
|
+
)
|
|
727
|
+
if algorithm:
|
|
728
|
+
algorithms["_1"] = algorithm[0]
|
|
729
|
+
for toystr, value in algorithms.items():
|
|
730
|
+
if not isinstance(value, InterpAlgorithm):
|
|
731
|
+
raise TypeError(
|
|
732
|
+
f"Type `{type(value).__name__}` is not (a subclass of) type "
|
|
733
|
+
f"`InterpAlgorithm`."
|
|
734
|
+
)
|
|
735
|
+
try:
|
|
736
|
+
self._add_toyalgorithpair(toystr, value)
|
|
737
|
+
except BaseException:
|
|
738
|
+
objecttools.augment_excmessage(
|
|
739
|
+
f"While trying to add a season specific interpolator to "
|
|
740
|
+
f"parameter `{self.name}` of element "
|
|
741
|
+
f"`{objecttools.devicename(self)}`"
|
|
742
|
+
)
|
|
743
|
+
except BaseException as exc:
|
|
744
|
+
self._toy2algorithm.clear()
|
|
745
|
+
raise exc
|
|
746
|
+
finally:
|
|
747
|
+
self._do_refresh = True
|
|
748
|
+
self.refresh()
|
|
749
|
+
|
|
750
|
+
def _add_toyalgorithpair(self, name: str, value: InterpAlgorithm) -> None:
|
|
751
|
+
toy_new = timetools.TOY(name)
|
|
752
|
+
if len(self._toy2algorithm) == 0:
|
|
753
|
+
self._toy2algorithm.append((toy_new, value))
|
|
754
|
+
secs_new = toy_new.seconds_passed
|
|
755
|
+
if secs_new > self._toy2algorithm[-1][0].seconds_passed:
|
|
756
|
+
self._toy2algorithm.append((toy_new, value))
|
|
757
|
+
else:
|
|
758
|
+
for idx, (toy_old, _) in enumerate(self._toy2algorithm[:]):
|
|
759
|
+
secs_old = toy_old.seconds_passed
|
|
760
|
+
if secs_new == secs_old:
|
|
761
|
+
self._toy2algorithm[idx] = toy_new, value
|
|
762
|
+
break
|
|
763
|
+
if secs_new < secs_old:
|
|
764
|
+
self._toy2algorithm.insert(idx, (toy_new, value))
|
|
765
|
+
break
|
|
766
|
+
|
|
767
|
+
def __hydpy__connect_variable2subgroup__(self) -> None:
|
|
768
|
+
"""Connect the actual |SeasonalInterpolator| object with the given
|
|
769
|
+
|SubParameters| object."""
|
|
770
|
+
self.fastaccess = self.subpars.fastaccess
|
|
771
|
+
setattr(self.fastaccess, self.name, self.__seasonalinterpolator)
|
|
772
|
+
|
|
773
|
+
def refresh(self) -> None:
|
|
774
|
+
"""Prepare the actual |SeasonalInterpolator| object for calculations.
|
|
775
|
+
|
|
776
|
+
Class |SeasonalInterpolator| stores its |InterpAlgorithm| objects by reference.
|
|
777
|
+
Therefore, despite all automated refreshings (explained in the general
|
|
778
|
+
documentation on class |SeasonalInterpolator|), it is still possible to destroy
|
|
779
|
+
the inner consistency of a |SeasonalInterpolator| instance:
|
|
780
|
+
|
|
781
|
+
>>> from hydpy import ANN, SeasonalInterpolator
|
|
782
|
+
>>> seasonalinterpolator = SeasonalInterpolator(None)
|
|
783
|
+
>>> seasonalinterpolator.simulationstep = "1d"
|
|
784
|
+
>>> jan = ANN(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
|
|
785
|
+
... weights_input=0.0, weights_output=0.0,
|
|
786
|
+
... intercepts_hidden=0.0, intercepts_output=1.0)
|
|
787
|
+
>>> seasonalinterpolator(_1_1_12=jan)
|
|
788
|
+
>>> jan.nmb_inputs, jan.nmb_outputs = 2, 3
|
|
789
|
+
>>> jan.nmb_inputs, jan.nmb_outputs
|
|
790
|
+
(2, 3)
|
|
791
|
+
>>> seasonalinterpolator.nmb_inputs, seasonalinterpolator.nmb_outputs
|
|
792
|
+
(1, 1)
|
|
793
|
+
|
|
794
|
+
Due to the Cython implementation of the actual interpolation, such an
|
|
795
|
+
inconsistencies might result in a program crash without any informative error
|
|
796
|
+
message. Therefore, whenever you are think some inconsistency might have crept
|
|
797
|
+
in and you want to repair it, call method |SeasonalInterpolator.refresh|
|
|
798
|
+
manually:
|
|
799
|
+
|
|
800
|
+
>>> seasonalinterpolator.refresh()
|
|
801
|
+
>>> jan.nmb_inputs, jan.nmb_outputs
|
|
802
|
+
(2, 3)
|
|
803
|
+
>>> seasonalinterpolator.nmb_inputs, seasonalinterpolator.nmb_outputs
|
|
804
|
+
(2, 3)
|
|
805
|
+
"""
|
|
806
|
+
if self._do_refresh:
|
|
807
|
+
if self.algorithms:
|
|
808
|
+
self.__seasonalinterpolator = interputils.SeasonalInterpolator(
|
|
809
|
+
self.algorithms
|
|
810
|
+
)
|
|
811
|
+
setattr(self.fastaccess, self.name, self._seasonalinterpolator)
|
|
812
|
+
self._prepare_shape()
|
|
813
|
+
if self._seasonalinterpolator.nmb_algorithms > 1:
|
|
814
|
+
self._interp()
|
|
815
|
+
else:
|
|
816
|
+
self._seasonalinterpolator.ratios[:, 0] = 1.0
|
|
817
|
+
self.verify()
|
|
818
|
+
else:
|
|
819
|
+
self.__seasonalinterpolator = None
|
|
820
|
+
|
|
821
|
+
def verify(self) -> None:
|
|
822
|
+
"""Raise a |RuntimeError| and remove all handled interpolators if they are
|
|
823
|
+
defined inconsistently.
|
|
824
|
+
|
|
825
|
+
Class |SeasonalInterpolator| stores its |InterpAlgorithm| objects by reference.
|
|
826
|
+
Therefore, despite all automated refreshings (explained in the general
|
|
827
|
+
documentation on class |SeasonalInterpolator|), it is still possible to destroy
|
|
828
|
+
the inner consistency of a |SeasonalInterpolator| instance:
|
|
829
|
+
|
|
830
|
+
>>> from hydpy import ANN, pub, SeasonalInterpolator
|
|
831
|
+
>>> seasonalinterpolator = SeasonalInterpolator(None)
|
|
832
|
+
>>> pub.options.simulationstep = "1d"
|
|
833
|
+
>>> jan = ANN(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
|
|
834
|
+
... weights_input=0.0, weights_output=0.0,
|
|
835
|
+
... intercepts_hidden=0.0, intercepts_output=1.0)
|
|
836
|
+
>>> seasonalinterpolator(_1_1_12=jan)
|
|
837
|
+
>>> jan.nmb_inputs, jan.nmb_outputs = 2, 3
|
|
838
|
+
>>> jan.nmb_inputs, jan.nmb_outputs
|
|
839
|
+
(2, 3)
|
|
840
|
+
>>> seasonalinterpolator.nmb_inputs, seasonalinterpolator.nmb_outputs
|
|
841
|
+
(1, 1)
|
|
842
|
+
|
|
843
|
+
Due to the Cython implementation of the actual interpolation, such an
|
|
844
|
+
inconsistencies might result in a program crash without any informative error
|
|
845
|
+
message. Therefore, whenever you are think some inconsistency might have crept
|
|
846
|
+
in, and you want to know if your suspicion is correct, call method
|
|
847
|
+
|SeasonalInterpolator.verify|.
|
|
848
|
+
|
|
849
|
+
>>> seasonalinterpolator.verify()
|
|
850
|
+
Traceback (most recent call last):
|
|
851
|
+
...
|
|
852
|
+
RuntimeError: The number of input and output values of all interpolators \
|
|
853
|
+
handled by parameter `seasonalinterpolator` of element `?` must be defined in advance \
|
|
854
|
+
and be the same, which is not the case for at least two given interpolators.
|
|
855
|
+
|
|
856
|
+
>>> seasonalinterpolator
|
|
857
|
+
seasonalinterpolator()
|
|
858
|
+
|
|
859
|
+
>>> seasonalinterpolator.verify()
|
|
860
|
+
Traceback (most recent call last):
|
|
861
|
+
...
|
|
862
|
+
RuntimeError: Seasonal interpolators need to handle at least one \
|
|
863
|
+
interpolation algorithm object, but for parameter `seasonalinterpolator` of element \
|
|
864
|
+
`?` none is defined so far.
|
|
865
|
+
"""
|
|
866
|
+
if not self.algorithms:
|
|
867
|
+
self._toy2algorithm = []
|
|
868
|
+
raise RuntimeError(
|
|
869
|
+
f"Seasonal interpolators need to handle at least one interpolation "
|
|
870
|
+
f"algorithm object, but for parameter "
|
|
871
|
+
f"{objecttools.elementphrase(self)} none is defined so far."
|
|
872
|
+
)
|
|
873
|
+
for _, seasonalinterpolator in self:
|
|
874
|
+
seasonalinterpolator.verify()
|
|
875
|
+
if (self.nmb_inputs != seasonalinterpolator.nmb_inputs) or (
|
|
876
|
+
self.nmb_outputs != seasonalinterpolator.nmb_outputs
|
|
877
|
+
):
|
|
878
|
+
self._toy2algorithm = []
|
|
879
|
+
raise RuntimeError(
|
|
880
|
+
f"The number of input and output values of all interpolators "
|
|
881
|
+
f"handled by parameter {objecttools.elementphrase(self)} must be "
|
|
882
|
+
f"defined in advance and be the same, which is not the case for "
|
|
883
|
+
f"at least two given interpolators."
|
|
884
|
+
)
|
|
885
|
+
|
|
886
|
+
def _interp(self) -> None:
|
|
887
|
+
ratios = self.ratios
|
|
888
|
+
ratios[:, :] = numpy.nan
|
|
889
|
+
toys = self.toys
|
|
890
|
+
centred = timetools.TOY.centred_timegrid()
|
|
891
|
+
for tdx, (date, rel) in enumerate(zip(*centred)):
|
|
892
|
+
if rel:
|
|
893
|
+
xnew = timetools.TOY(date)
|
|
894
|
+
for idx_1, x_1 in enumerate(toys):
|
|
895
|
+
if x_1 > xnew:
|
|
896
|
+
idx_0 = idx_1 - 1
|
|
897
|
+
x_0 = toys[idx_0]
|
|
898
|
+
break
|
|
899
|
+
else:
|
|
900
|
+
idx_0 = -1
|
|
901
|
+
idx_1 = 0
|
|
902
|
+
x_0 = toys[idx_0]
|
|
903
|
+
x_1 = toys[idx_1]
|
|
904
|
+
ratios[tdx, :] = 0.0
|
|
905
|
+
ratios[tdx, idx_1] = (xnew - x_0) / (x_1 - x_0)
|
|
906
|
+
ratios[tdx, idx_0] = 1.0 - ratios[tdx, idx_1]
|
|
907
|
+
|
|
908
|
+
@property
|
|
909
|
+
def shape(self) -> tuple[int, int]:
|
|
910
|
+
"""The shape of array |SeasonalInterpolator.ratios|."""
|
|
911
|
+
shape = self.ratios.shape
|
|
912
|
+
return int(shape[0]), int(shape[1])
|
|
913
|
+
|
|
914
|
+
def _prepare_shape(self) -> None:
|
|
915
|
+
"""Private on purpose."""
|
|
916
|
+
nmb_weights = timetools.Period("366d") / hydpy.pub.options.simulationstep
|
|
917
|
+
nmb_weights = int(numpy.ceil(round(nmb_weights, 10)))
|
|
918
|
+
shape = (nmb_weights, self._seasonalinterpolator.nmb_algorithms)
|
|
919
|
+
getattr(self.fastaccess, self.name).ratios = numpy.zeros(
|
|
920
|
+
shape, dtype=config.NP_FLOAT
|
|
921
|
+
)
|
|
922
|
+
|
|
923
|
+
@property
|
|
924
|
+
def toys(self) -> tuple[timetools.TOY, ...]:
|
|
925
|
+
"""A sorted |tuple| of all contained |TOY| objects."""
|
|
926
|
+
return tuple(toy for (toy, _) in self)
|
|
927
|
+
|
|
928
|
+
@property
|
|
929
|
+
def algorithms(self) -> tuple[InterpAlgorithm, ...]:
|
|
930
|
+
"""A sorted |tuple| of all handled interpolators."""
|
|
931
|
+
return tuple(seasonalinterpolator for (_, seasonalinterpolator) in self)
|
|
932
|
+
|
|
933
|
+
@property
|
|
934
|
+
def ratios(self) -> MatrixFloat:
|
|
935
|
+
"""The ratios for weighting the interpolator outputs."""
|
|
936
|
+
return numpy.asarray(self._seasonalinterpolator.ratios)
|
|
937
|
+
|
|
938
|
+
@property
|
|
939
|
+
def _seasonalinterpolator(self) -> interputils.SeasonalInterpolator:
|
|
940
|
+
seasonalinterpolator = self.__seasonalinterpolator
|
|
941
|
+
if seasonalinterpolator:
|
|
942
|
+
return seasonalinterpolator
|
|
943
|
+
raise RuntimeError(
|
|
944
|
+
f"The parameter {objecttools.elementphrase(self)} has not been properly "
|
|
945
|
+
f"prepared so far."
|
|
946
|
+
)
|
|
947
|
+
|
|
948
|
+
@property
|
|
949
|
+
def nmb_inputs(self) -> int:
|
|
950
|
+
"""The general number of input values of the interpolators."""
|
|
951
|
+
return self._seasonalinterpolator.nmb_inputs
|
|
952
|
+
|
|
953
|
+
@property
|
|
954
|
+
def inputs(self) -> VectorFloat:
|
|
955
|
+
"""The general input data for the interpolators."""
|
|
956
|
+
return numpy.asarray(self._seasonalinterpolator.inputs)
|
|
957
|
+
|
|
958
|
+
@property
|
|
959
|
+
def nmb_outputs(self) -> int:
|
|
960
|
+
"""The general number of output values of all interpolators."""
|
|
961
|
+
return self._seasonalinterpolator.nmb_outputs
|
|
962
|
+
|
|
963
|
+
@property
|
|
964
|
+
def outputs(self) -> VectorFloat:
|
|
965
|
+
"""The weighted output of the interpolators."""
|
|
966
|
+
return numpy.asarray(self._seasonalinterpolator.outputs)
|
|
967
|
+
|
|
968
|
+
def calculate_values(self, idx: int, /) -> None:
|
|
969
|
+
"""Calculate the weighted output values based on the input values defined
|
|
970
|
+
previously for the given index referencing the actual time of year."""
|
|
971
|
+
self._seasonalinterpolator.calculate_values(idx)
|
|
972
|
+
|
|
973
|
+
def plot(
|
|
974
|
+
self,
|
|
975
|
+
xmin: float,
|
|
976
|
+
xmax: float,
|
|
977
|
+
*,
|
|
978
|
+
idx_input: int = 0,
|
|
979
|
+
idx_output: int = 0,
|
|
980
|
+
points: int = 100,
|
|
981
|
+
legend: bool = True,
|
|
982
|
+
**kwargs: float | str | None,
|
|
983
|
+
) -> pyplot.Figure:
|
|
984
|
+
"""Call method |InterpAlgorithm.plot| of all currently handled
|
|
985
|
+
|InterpAlgorithm| objects."""
|
|
986
|
+
for toy, seasonalinterpolator in self:
|
|
987
|
+
figure = seasonalinterpolator.plot(
|
|
988
|
+
xmin=xmin,
|
|
989
|
+
xmax=xmax,
|
|
990
|
+
idx_input=idx_input,
|
|
991
|
+
idx_output=idx_output,
|
|
992
|
+
points=points,
|
|
993
|
+
label=str(toy),
|
|
994
|
+
**kwargs,
|
|
995
|
+
)
|
|
996
|
+
if legend:
|
|
997
|
+
pyplot.legend()
|
|
998
|
+
self._update_labels()
|
|
999
|
+
return figure
|
|
1000
|
+
|
|
1001
|
+
def __getattr__(self, name: str) -> InterpAlgorithm:
|
|
1002
|
+
if name.startswith("toy_"):
|
|
1003
|
+
try:
|
|
1004
|
+
selected = timetools.TOY(name)
|
|
1005
|
+
for available, algorithm in self._toy2algorithm:
|
|
1006
|
+
if selected == available:
|
|
1007
|
+
return algorithm
|
|
1008
|
+
raise AttributeError(
|
|
1009
|
+
f"No interpolator is registered under a TOY object named "
|
|
1010
|
+
f"`{timetools.TOY(name)}`."
|
|
1011
|
+
)
|
|
1012
|
+
except BaseException:
|
|
1013
|
+
objecttools.augment_excmessage(
|
|
1014
|
+
f"While trying to look up for an interpolator handled by "
|
|
1015
|
+
f"parameter {objecttools.elementphrase(self)} based on the string "
|
|
1016
|
+
f"`{name}`"
|
|
1017
|
+
)
|
|
1018
|
+
else:
|
|
1019
|
+
raise AttributeError(
|
|
1020
|
+
f"'{type(self).__name__}' object has no attribute '{name}'"
|
|
1021
|
+
)
|
|
1022
|
+
|
|
1023
|
+
def __setattr__(self, name: str, value: object) -> None:
|
|
1024
|
+
if name.startswith("toy_"):
|
|
1025
|
+
try:
|
|
1026
|
+
if not isinstance(value, InterpAlgorithm):
|
|
1027
|
+
raise TypeError(
|
|
1028
|
+
f"{objecttools.value_of_type(value).capitalize()} has been "
|
|
1029
|
+
f"given, but an object of type `InterpAlgorithm` is required."
|
|
1030
|
+
)
|
|
1031
|
+
self._add_toyalgorithpair(name, value)
|
|
1032
|
+
self.refresh()
|
|
1033
|
+
except BaseException:
|
|
1034
|
+
objecttools.augment_excmessage(
|
|
1035
|
+
f"While trying to assign a new interpolator to parameter "
|
|
1036
|
+
f"{objecttools.elementphrase(self)} based on the string `{name}`"
|
|
1037
|
+
)
|
|
1038
|
+
else:
|
|
1039
|
+
object.__setattr__(self, name, value)
|
|
1040
|
+
|
|
1041
|
+
def __delattr__(self, name: str) -> None:
|
|
1042
|
+
if name.startswith("toy_"):
|
|
1043
|
+
try:
|
|
1044
|
+
selected = timetools.TOY(name)
|
|
1045
|
+
for idx, (available, _) in enumerate(self._toy2algorithm):
|
|
1046
|
+
if selected == available:
|
|
1047
|
+
break
|
|
1048
|
+
else:
|
|
1049
|
+
raise AttributeError(
|
|
1050
|
+
f"No interpolator is registered under a TOY object named "
|
|
1051
|
+
f"`{timetools.TOY(name)}`."
|
|
1052
|
+
) from None
|
|
1053
|
+
del self._toy2algorithm[idx]
|
|
1054
|
+
self.refresh()
|
|
1055
|
+
except BaseException:
|
|
1056
|
+
objecttools.augment_excmessage(
|
|
1057
|
+
f"While trying to remove an interpolator from parameter "
|
|
1058
|
+
f"{objecttools.elementphrase(self)} based on the string `{name}`"
|
|
1059
|
+
)
|
|
1060
|
+
else:
|
|
1061
|
+
object.__delattr__(self, name)
|
|
1062
|
+
|
|
1063
|
+
def __iter__(self) -> Iterator[tuple[timetools.TOY, InterpAlgorithm]]:
|
|
1064
|
+
return iter(self._toy2algorithm)
|
|
1065
|
+
|
|
1066
|
+
def __repr__(self) -> str:
|
|
1067
|
+
if not self:
|
|
1068
|
+
return f"{self.name}()"
|
|
1069
|
+
lines = [f"{self.name}("]
|
|
1070
|
+
if (len(self) == 1) and (self.toys[0] == timetools.TOY0):
|
|
1071
|
+
lines.append(self.algorithms[0].assignrepr(" ", 4))
|
|
1072
|
+
else:
|
|
1073
|
+
for toy, seasonalinterpolator in self:
|
|
1074
|
+
line = seasonalinterpolator.assignrepr(f" {toy}=", 4)
|
|
1075
|
+
lines.append(f"{line},")
|
|
1076
|
+
lines.append(")")
|
|
1077
|
+
return "\n".join(lines)
|
|
1078
|
+
|
|
1079
|
+
def __len__(self) -> int:
|
|
1080
|
+
return len(self._toy2algorithm)
|
|
1081
|
+
|
|
1082
|
+
def __dir__(self) -> list[str]:
|
|
1083
|
+
"""
|
|
1084
|
+
>>> from hydpy import ANN, pub, SeasonalInterpolator
|
|
1085
|
+
>>> pub.timegrids = "2000-01-01", "2000-01-02", "1d"
|
|
1086
|
+
>>> si = SeasonalInterpolator(None)
|
|
1087
|
+
>>> si(
|
|
1088
|
+
... ANN(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
|
|
1089
|
+
... weights_input=0.0, weights_output=0.0,
|
|
1090
|
+
... intercepts_hidden=0.0, intercepts_output=1.0))
|
|
1091
|
+
>>> sorted(set(dir(si)) - set(object.__dir__(si)))
|
|
1092
|
+
['toy_1_1_0_0_0']
|
|
1093
|
+
"""
|
|
1094
|
+
return cast(list[str], super().__dir__()) + [str(toy) for toy in self.toys]
|