Search is not available for this dataset
text stringlengths 75 104k |
|---|
def assignrepr(self, prefix: str) -> str:
"""Return a |repr| string with a prefixed assignment."""
with objecttools.repr_.preserve_strings(True):
with objecttools.assignrepr_tuple.always_bracketed(False):
blanks = ' ' * (len(prefix) + 8)
lines = ['%sElement("%... |
def _init_methods(self):
"""Convert all pure Python calculation functions of the model class to
methods and assign them to the model instance.
"""
for name_group in self._METHOD_GROUPS:
functions = getattr(self, name_group, ())
uniques = {}
for func in... |
def name(self):
"""Name of the model type.
For base models, |Model.name| corresponds to the package name:
>>> from hydpy import prepare_model
>>> hland = prepare_model('hland')
>>> hland.name
'hland'
For application models, |Model.name| corresponds the module n... |
def connect(self):
"""Connect the link sequences of the actual model."""
try:
for group in ('inlets', 'receivers', 'outlets', 'senders'):
self._connect_subgroup(group)
except BaseException:
objecttools.augment_excmessage(
'While trying to b... |
def calculate_single_terms(self):
"""Apply all methods stored in the hidden attribute
`PART_ODE_METHODS`.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> k(0.25)
>>> states.s = 1.0
>>> model.calculate_single_terms()
>>> fluxes.q
q(0... |
def get_sum_fluxes(self):
"""Get the sum of the fluxes calculated so far.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.q = 0.0
>>> fluxes.fastaccess._q_sum = 1.0
>>> model.get_sum_fluxes()
>>> fluxes.q
q(1.0)
"""
f... |
def integrate_fluxes(self):
"""Perform a dot multiplication between the fluxes and the
A coefficients associated with the different stages of the
actual method.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> model.numvars.idx_method = 2
>>> model.... |
def reset_sum_fluxes(self):
"""Set the sum of the fluxes calculated so far to zero.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.fastaccess._q_sum = 5.
>>> model.reset_sum_fluxes()
>>> fluxes.fastaccess._q_sum
0.0
"""
flux... |
def addup_fluxes(self):
"""Add up the sum of the fluxes calculated so far.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.fastaccess._q_sum = 1.0
>>> fluxes.q(2.0)
>>> model.addup_fluxes()
>>> fluxes.fastaccess._q_sum
3.0
""... |
def calculate_error(self):
"""Estimate the numerical error based on the fluxes calculated
by the current and the last method.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> model.numvars.idx_method = 2
>>> results = numpy.asarray(fluxes.fastaccess._q_resu... |
def extrapolate_error(self):
"""Estimate the numerical error to be expected when applying all
methods available based on the results of the current and the
last method.
Note that this expolation strategy cannot be applied on the first
method. If the current method is the first ... |
def run_simulation(projectname: str, xmlfile: str):
"""Perform a HydPy workflow in agreement with the given XML configuration
file available in the directory of the given project. ToDo
Function |run_simulation| is a "script function" and is normally used as
explained in the main documentation on module... |
def validate_xml(self) -> None:
"""Raise an error if the actual XML does not agree with one of the
available schema files.
# ToDo: should it be accompanied by a script function?
The first example relies on a distorted version of the configuration
file `single_run.xml`:
... |
def update_options(self) -> None:
"""Update the |Options| object available in module |pub| with the
values defined in the `options` XML element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data, pub
>>> interface = XMLInterface('single_run.xml', data.g... |
def update_timegrids(self) -> None:
"""Update the |Timegrids| object available in module |pub| with the
values defined in the `timegrid` XML element.
Usually, one would prefer to define `firstdate`, `lastdate`, and
`stepsize` elements as in the XML configuration file of the
`Lah... |
def elements(self) -> Iterator[devicetools.Element]:
"""Yield all |Element| objects returned by |XMLInterface.selections|
and |XMLInterface.devices| without duplicates.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import... |
def fullselection(self) -> selectiontools.Selection:
"""A |Selection| object containing all |Element| and |Node| objects
defined by |XMLInterface.selections| and |XMLInterface.devices|.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> ... |
def load_conditions(self) -> None:
"""Load the condition files of the |Model| objects of all |Element|
objects returned by |XMLInterface.elements|:
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLIn... |
def save_conditions(self) -> None:
"""Save the condition files of the |Model| objects of all |Element|
objects returned by |XMLInterface.elements|:
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> import os
>>> from hydpy impor... |
def prepare_series(self) -> None:
# noinspection PyUnresolvedReferences
"""Call |XMLSubseries.prepare_series| of all |XMLSubseries|
objects with the same memory |set| object.
>>> from hydpy.auxs.xmltools import XMLInterface, XMLSubseries
>>> from hydpy import data
>>> in... |
def selections(self) -> selectiontools.Selections:
"""The |Selections| object defined for the respective `reader`
or `writer` element of the actual XML file. ToDo
If the `reader` or `writer` element does not define a special
selections element, the general |XMLInterface.selections| elem... |
def devices(self) -> selectiontools.Selection:
"""The additional devices defined for the respective `reader`
or `writer` element contained within a |Selection| object. ToDo
If the `reader` or `writer` element does not define its own additional
devices, |XMLInterface.devices| of |XMLInte... |
def prepare_sequencemanager(self) -> None:
"""Configure the |SequenceManager| object available in module
|pub| following the definitions of the actual XML `reader` or
`writer` element when available; if not use those of the XML
`series_io` element.
Compare the following results ... |
def model2subs2seqs(self) -> Dict[str, Dict[str, List[str]]]:
"""A nested |collections.defaultdict| containing the model specific
information provided by the XML `sequences` element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data
>>> interface = XMLI... |
def subs2seqs(self) -> Dict[str, List[str]]:
"""A |collections.defaultdict| containing the node-specific
information provided by XML `sequences` element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data
>>> interface = XMLInterface('single_run.xml', da... |
def prepare_series(self, memory: set) -> None:
"""Call |IOSequence.activate_ram| of all sequences selected by
the given output element of the actual XML file.
Use the memory argument to pass in already prepared sequences;
newly prepared sequences will be added.
>>> from hydpy.c... |
def load_series(self) -> None:
"""Load time series data as defined by the actual XML `reader`
element.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = HydPy('LahnH')
... |
def save_series(self) -> None:
"""Save time series data as defined by the actual XML `writer`
element.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = HydPy('LahnH')
... |
def item(self):
""" ToDo
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface, pub
>>> hp = HydPy('LahnH')
>>> pub.timegrids = '1996-01-01', '1996-01-06', '1d'
>>> with TestIO()... |
def write_xsd(cls) -> None:
"""Write the complete base schema file `HydPyConfigBase.xsd` based
on the template file `HydPyConfigBase.xsdt`.
Method |XSDWriter.write_xsd| adds model specific information to the
general information of template file `HydPyConfigBase.xsdt` regarding
r... |
def get_modelnames() -> List[str]:
"""Return a sorted |list| containing all application model names.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_modelnames()) # doctest: +ELLIPSIS
[...'dam_v001', 'dam_v002', 'dam_v003', 'dam_v004', 'dam_v005',...]
""... |
def get_insertion(cls) -> str:
"""Return the complete string to be inserted into the string of the
template file.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_insertion()) # doctest: +ELLIPSIS
<element name="arma_v1"
substit... |
def get_modelinsertion(cls, model, indent) -> str:
"""Return the insertion string required for the given application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> from hydpy import prepare_model
>>> model = prepare_model('hland_v1')
>>> print(XSDWriter.get_modelinsert... |
def get_subsequencesinsertion(cls, subsequences, indent) -> str:
"""Return the insertion string required for the given group of
sequences.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> from hydpy import prepare_model
>>> model = prepare_model('hland_v1')
>>> print(XS... |
def get_exchangeinsertion(cls):
"""Return the complete string related to the definition of exchange
items to be inserted into the string of the template file.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_exchangeinsertion()) # doctest: +ELLIPSIS
<... |
def get_mathitemsinsertion(cls, indent) -> str:
"""Return a string defining a model specific XML type extending
`ItemType`.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_mathitemsinsertion(1)) # doctest: +ELLIPSIS
<complexType name="arma_v1_mathite... |
def get_itemsinsertion(cls, itemgroup, indent) -> str:
"""Return a string defining the XML element for the given
exchange item group.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemsinsertion(
... 'setitems', 1)) # doctest: +ELLIPSIS
... |
def get_itemtypesinsertion(cls, itemgroup, indent) -> str:
"""Return a string defining the required types for the given
exchange item group.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemtypesinsertion(
... 'setitems', 1)) # doctest: +ELLIPSIS
... |
def get_itemtypeinsertion(cls, itemgroup, modelname, indent) -> str:
"""Return a string defining the required types for the given
combination of an exchange item group and an application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemtypeinsertion(
... |
def get_nodesitemtypeinsertion(cls, itemgroup, indent) -> str:
"""Return a string defining the required types for the given
combination of an exchange item group and |Node| objects.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_nodesitemtypeinsertion(
...... |
def get_subgroupsiteminsertion(cls, itemgroup, modelname, indent) -> str:
"""Return a string defining the required types for the given
combination of an exchange item group and an application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_subgroupsiteminser... |
def get_subgroupiteminsertion(
cls, itemgroup, model, subgroup, indent) -> str:
"""Return a string defining the required types for the given
combination of an exchange item group and a specific variable
subgroup of an application model or class |Node|.
Note that for `setitem... |
def array2mask(cls, array=None, **kwargs):
"""Create a new mask object based on the given |numpy.ndarray|
and return it."""
kwargs['dtype'] = bool
if array is None:
return numpy.ndarray.__new__(cls, 0, **kwargs)
return numpy.asarray(array, **kwargs).view(cls) |
def new(cls, variable, **kwargs):
"""Return a new |DefaultMask| object associated with the
given |Variable| object."""
return cls.array2mask(numpy.full(variable.shape, True)) |
def new(cls, variable, **kwargs):
"""Return a new |IndexMask| object of the same shape as the
parameter referenced by |property| |IndexMask.refindices|.
Entries are only |True|, if the integer values of the
respective entries of the referenced parameter are contained
in the |Inde... |
def relevantindices(self) -> List[int]:
"""A |list| of all currently relevant indices, calculated as an
intercection of the (constant) class attribute `RELEVANT_VALUES`
and the (variable) property |IndexMask.refindices|."""
return [idx for idx in numpy.unique(self.refindices.values)
... |
def calc_qref_v1(self):
"""Determine the reference discharge within the given space-time interval.
Required state sequences:
|QZ|
|QA|
Calculated flux sequence:
|QRef|
Basic equation:
:math:`QRef = \\frac{QZ_{new}+QZ_{old}+QA_{old}}{3}`
Example:
>>> from hydpy.mo... |
def calc_rk_v1(self):
"""Determine the actual traveling time of the water (not of the wave!).
Required derived parameter:
|Sek|
Required flux sequences:
|AG|
|QRef|
Calculated flux sequence:
|RK|
Basic equation:
:math:`RK = \\frac{Laen \\cdot A}{QRef}`
Examples... |
def calc_am_um_v1(self):
"""Calculate the flown through area and the wetted perimeter
of the main channel.
Note that the main channel is assumed to have identical slopes on
both sides and that water flowing exactly above the main channel is
contributing to |AM|. Both theoretical surfaces seperatin... |
def calc_qm_v1(self):
"""Calculate the discharge of the main channel after Manning-Strickler.
Required control parameters:
|EKM|
|SKM|
|Gef|
Required flux sequence:
|AM|
|UM|
Calculated flux sequence:
|lstream_fluxes.QM|
Examples:
For appropriate stri... |
def calc_av_uv_v1(self):
"""Calculate the flown through area and the wetted perimeter of both
forelands.
Note that the each foreland lies between the main channel and one
outer embankment and that water flowing exactly above the a foreland
is contributing to |AV|. The theoretical surface seperatin... |
def calc_qv_v1(self):
"""Calculate the discharge of both forelands after Manning-Strickler.
Required control parameters:
|EKV|
|SKV|
|Gef|
Required flux sequence:
|AV|
|UV|
Calculated flux sequence:
|lstream_fluxes.QV|
Examples:
For appropriate strict... |
def calc_avr_uvr_v1(self):
"""Calculate the flown through area and the wetted perimeter of both
outer embankments.
Note that each outer embankment lies beyond its foreland and that all
water flowing exactly above the a embankment is added to |AVR|.
The theoretical surface seperating water above the... |
def calc_qvr_v1(self):
"""Calculate the discharge of both outer embankments after
Manning-Strickler.
Required control parameters:
|EKV|
|SKV|
|Gef|
Required flux sequence:
|AVR|
|UVR|
Calculated flux sequence:
|QVR|
Examples:
For appropriate stric... |
def calc_ag_v1(self):
"""Sum the through flown area of the total cross section.
Required flux sequences:
|AM|
|AV|
|AVR|
Calculated flux sequence:
|AG|
Example:
>>> from hydpy.models.lstream import *
>>> parameterstep()
>>> fluxes.am = 1.0
>>> ... |
def calc_qg_v1(self):
"""Calculate the discharge of the total cross section.
Method |calc_qg_v1| applies the actual versions of all methods for
calculating the flown through areas, wetted perimeters and discharges
of the different cross section compartments. Hence its requirements
might be differe... |
def calc_hmin_qmin_hmax_qmax_v1(self):
"""Determine an starting interval for iteration methods as the one
implemented in method |calc_h_v1|.
The resulting interval is determined in a manner, that on the
one hand :math:`Qmin \\leq QRef \\leq Qmax` is fulfilled and on the
other hand the results of me... |
def calc_h_v1(self):
"""Approximate the water stage resulting in a certain reference discarge
with the Pegasus iteration method.
Required control parameters:
|QTol|
|HTol|
Required flux sequence:
|QRef|
Modified aide sequences:
|HMin|
|HMax|
|QMin|
|QMax|... |
def calc_qa_v1(self):
"""Calculate outflow.
The working equation is the analytical solution of the linear storage
equation under the assumption of constant change in inflow during
the simulation time step.
Required flux sequence:
|RK|
Required state sequence:
|QZ|
Updated sta... |
def pick_q_v1(self):
"""Update inflow."""
sta = self.sequences.states.fastaccess
inl = self.sequences.inlets.fastaccess
sta.qz = 0.
for idx in range(inl.len_q):
sta.qz += inl.q[idx][0] |
def pass_q_v1(self):
"""Update outflow."""
sta = self.sequences.states.fastaccess
out = self.sequences.outlets.fastaccess
out.q[0] += sta.qa |
def calc_tc_v1(self):
"""Adjust the measured air temperature to the altitude of the
individual zones.
Required control parameters:
|NmbZones|
|TCAlt|
|ZoneZ|
|ZRelT|
Required input sequence:
|hland_inputs.T|
Calculated flux sequences:
|TC|
Basic equation:
... |
def calc_tmean_v1(self):
"""Calculate the areal mean temperature of the subbasin.
Required derived parameter:
|RelZoneArea|
Required flux sequence:
|TC|
Calculated flux sequences:
|TMean|
Examples:
Prepare two zones, the first one being twice as large
as the se... |
def calc_fracrain_v1(self):
"""Determine the temperature-dependent fraction of (liquid) rainfall
and (total) precipitation.
Required control parameters:
|NmbZones|
|TT|,
|TTInt|
Required flux sequence:
|TC|
Calculated flux sequences:
|FracRain|
Basic equation:
... |
def calc_rfc_sfc_v1(self):
"""Calculate the corrected fractions rainfall/snowfall and total
precipitation.
Required control parameters:
|NmbZones|
|RfCF|
|SfCF|
Calculated flux sequences:
|RfC|
|SfC|
Basic equations:
:math:`RfC = RfCF \\cdot FracRain` \n
... |
def calc_pc_v1(self):
"""Apply the precipitation correction factors and adjust precipitation
to the altitude of the individual zones.
Required control parameters:
|NmbZones|
|PCorr|
|PCAlt|
|ZoneZ|
|ZRelP|
Required input sequence:
|P|
Required flux sequences:
... |
def calc_ep_v1(self):
"""Adjust potential norm evaporation to the actual temperature.
Required control parameters:
|NmbZones|
|ETF|
Required input sequence:
|EPN|
|TN|
Required flux sequence:
|TMean|
Calculated flux sequences:
|EP|
Basic equation:
:... |
def calc_epc_v1(self):
"""Apply the evaporation correction factors and adjust evaporation
to the altitude of the individual zones.
Calculate the areal mean of (uncorrected) potential evaporation
for the subbasin, adjust it to the individual zones in accordance
with their heights and perform some co... |
def calc_tf_ic_v1(self):
"""Calculate throughfall and update the interception storage
accordingly.
Required control parameters:
|NmbZones|
|ZoneType|
|IcMax|
Required flux sequences:
|PC|
Calculated fluxes sequences:
|TF|
Updated state sequence:
|Ic|
... |
def calc_ei_ic_v1(self):
"""Calculate interception evaporation and update the interception
storage accordingly.
Required control parameters:
|NmbZones|
|ZoneType|
Required flux sequences:
|EPC|
Calculated fluxes sequences:
|EI|
Updated state sequence:
|Ic|
... |
def calc_sp_wc_v1(self):
"""Add throughfall to the snow layer.
Required control parameters:
|NmbZones|
|ZoneType|
Required flux sequences:
|TF|
|RfC|
|SfC|
Updated state sequences:
|WC|
|SP|
Basic equations:
:math:`\\frac{dSP}{dt} = TF \\cdot \\fra... |
def calc_refr_sp_wc_v1(self):
"""Calculate refreezing of the water content within the snow layer and
update both the snow layers ice and the water content.
Required control parameters:
|NmbZones|
|ZoneType|
|CFMax|
|CFR|
Required derived parameter:
|TTM|
Required flu... |
def calc_in_wc_v1(self):
"""Calculate the actual water release from the snow layer due to the
exceedance of the snow layers capacity for (liquid) water.
Required control parameters:
|NmbZones|
|ZoneType|
|WHC|
Required state sequence:
|SP|
Required flux sequence
|TF|... |
def calc_glmelt_in_v1(self):
"""Calculate melting from glaciers which are actually not covered by
a snow layer and add it to the water release of the snow module.
Required control parameters:
|NmbZones|
|ZoneType|
|GMelt|
Required state sequence:
|SP|
Required flux sequenc... |
def calc_r_sm_v1(self):
"""Calculate effective precipitation and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|Beta|
Required fluxes sequence:
|In_|
Calculated flux sequence:
|R|
Updated state sequence:
|SM|
Basic eq... |
def calc_cf_sm_v1(self):
"""Calculate capillary flow and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|CFlux|
Required fluxes sequence:
|R|
Required state sequence:
|UZ|
Calculated flux sequence:
|CF|
Updated state s... |
def calc_ea_sm_v1(self):
"""Calculate soil evaporation and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|LP|
|ERed|
Required fluxes sequences:
|EPC|
|EI|
Required state sequence:
|SP|
Calculated flux sequence:
... |
def calc_inuz_v1(self):
"""Accumulate the total inflow into the upper zone layer.
Required control parameters:
|NmbZones|
|ZoneType|
Required derived parameters:
|RelLandZoneArea|
Required fluxes sequences:
|R|
|CF|
Calculated flux sequence:
|InUZ|
Basic ... |
def calc_contriarea_v1(self):
"""Determine the relative size of the contributing area of the whole
subbasin.
Required control parameters:
|NmbZones|
|ZoneType|
|RespArea|
|FC|
|Beta|
Required derived parameter:
|RelSoilArea|
Required state sequence:
|SM|
... |
def calc_q0_perc_uz_v1(self):
"""Perform the upper zone layer routine which determines percolation
to the lower zone layer and the fast response of the hland model.
Note that the system behaviour of this method depends strongly on the
specifications of the options |RespArea| and |RecStep|.
Required... |
def calc_lz_v1(self):
"""Update the lower zone layer in accordance with percolation from
upper groundwater to lower groundwater and/or in accordance with
lake precipitation.
Required control parameters:
|NmbZones|
|ZoneType|
Required derived parameters:
|RelLandArea|
|RelZo... |
def calc_el_lz_v1(self):
"""Calculate lake evaporation.
Required control parameters:
|NmbZones|
|ZoneType|
|TTIce|
Required derived parameters:
|RelZoneArea|
Required fluxes sequences:
|TC|
|EPC|
Updated state sequence:
|LZ|
Basic equa... |
def calc_q1_lz_v1(self):
"""Calculate the slow response of the lower zone layer.
Required control parameters:
|K4|
|Gamma|
Calculated fluxes sequence:
|Q1|
Updated state sequence:
|LZ|
Basic equations:
:math:`\\frac{dLZ}{dt} = -Q1` \n
:math:`Q1 = \... |
def calc_inuh_v1(self):
"""Calculate the unit hydrograph input.
Required derived parameters:
|RelLandArea|
Required flux sequences:
|Q0|
|Q1|
Calculated flux sequence:
|InUH|
Basic equation:
:math:`InUH = Q0 + Q1`
Example:
The unit hydrographs receiv... |
def calc_outuh_quh_v1(self):
"""Calculate the unit hydrograph output (convolution).
Required derived parameters:
|UH|
Required flux sequences:
|Q0|
|Q1|
|InUH|
Updated log sequence:
|QUH|
Calculated flux sequence:
|OutUH|
Examples:
Pr... |
def calc_qt_v1(self):
"""Calculate the total discharge after possible abstractions.
Required control parameter:
|Abstr|
Required flux sequence:
|OutUH|
Calculated flux sequence:
|QT|
Basic equation:
:math:`QT = max(OutUH - Abstr, 0)`
Examples:
Trying to ab... |
def save(self, parameterstep=None, simulationstep=None):
"""Save all defined auxiliary control files.
The target path is taken from the |ControlManager| object stored
in module |pub|. Hence we initialize one and override its
|property| `currentpath` with a simple |str| object defining ... |
def remove(self, *values):
"""Remove the defined variables.
The variables to be removed can be selected in two ways. But the
first example shows that passing nothing or an empty iterable to
method |Variable2Auxfile.remove| does not remove any variable:
>>> from hydpy import du... |
def filenames(self):
"""A list of all handled auxiliary file names.
>>> from hydpy import dummies
>>> dummies.v2af.filenames
['file1', 'file2']
"""
fns = set()
for fn2var in self._type2filename2variable.values():
fns.update(fn2var.keys())
retu... |
def get_filename(self, variable):
"""Return the auxiliary file name the given variable is allocated
to or |None| if the given variable is not allocated to any
auxiliary file name.
>>> from hydpy import dummies
>>> eqb = dummies.v2af.eqb[0]
>>> dummies.v2af.get_filename(e... |
def update(self):
"""Calculate the smoothing parameter values.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy import pub
>>> pub.timegrids = '2000.01.01', '2000.01.03', '1d'
>>> from hydpy.models.dam import *
>>> parame... |
def update(self):
"""Calculate the smoothing parameter value.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy.models.dam import *
>>> parameterstep()
>>> waterlevelminimumremotetolerance(0.0)
>>> derived.waterlevelminimu... |
def update(self):
"""Calculate the smoothing parameter value.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy.models.dam import *
>>> parameterstep()
>>> highestremotedischarge(1.0)
>>> highestremotetolerance(0.0)
... |
def run_subprocess(command: str, verbose: bool = True, blocking: bool = True) \
-> Optional[subprocess.Popen]:
"""Execute the given command in a new process.
Only when both `verbose` and `blocking` are |True|, |run_subprocess|
prints all responses to the current value of |sys.stdout|:
>>> from... |
def exec_commands(commands: str, **parameters: Any) -> None:
"""Execute the given Python commands.
Function |exec_commands| is thought for testing purposes only (see
the main documentation on module |hyd|). Seperate individual commands
by semicolons and replaced whitespaces with underscores:
>>> ... |
def prepare_logfile(filename: str) -> str:
"""Prepare an empty log file eventually and return its absolute path.
When passing the "filename" `stdout`, |prepare_logfile| does not
prepare any file and just returns `stdout`:
>>> from hydpy.exe.commandtools import prepare_logfile
>>> prepare_logfile('... |
def execute_scriptfunction() -> None:
"""Execute a HydPy script function.
Function |execute_scriptfunction| is indirectly applied and
explained in the documentation on module |hyd|.
"""
try:
args_given = []
kwargs_given = {}
for arg in sys.argv[1:]:
if len(arg) <... |
def parse_argument(string: str) -> Union[str, Tuple[str, str]]:
"""Return a single value for a string understood as a positional
argument or a |tuple| containing a keyword and its value for a
string understood as a keyword argument.
|parse_argument| is intended to be used as a helper function for
f... |
def print_textandtime(text: str) -> None:
"""Print the given string and the current date and time with high
precision for logging purposes.
>>> from hydpy.exe.commandtools import print_textandtime
>>> from hydpy.core.testtools import mock_datetime_now
>>> from datetime import datetime
>>> with ... |
def write(self, string: str) -> None:
"""Write the given string as explained in the main documentation
on class |LogFileInterface|."""
self.logfile.write('\n'.join(
f'{self._string}{substring}' if substring else ''
for substring in string.split('\n'))) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.