INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Return a new |Selection| object with the given name and copies of the handles |Nodes| and |Elements| objects based on method |Devices. copy|.
def copy(self, name: str) -> 'Selection': """Return a new |Selection| object with the given name and copies of the handles |Nodes| and |Elements| objects based on method |Devices.copy|.""" return type(self)(name, copy.copy(self.nodes), copy.copy(self.elements))
Save the selection as a network file.
def save_networkfile(self, filepath: Union[str, None] = None, write_nodes: bool = True) -> None: """Save the selection as a network file. >>> from hydpy.core.examples import prepare_full_example_2 >>> _, pub, TestIO = prepare_full_example_2() In most cases, one...
Return a |repr| string with a prefixed assignment.
def assignrepr(self, prefix: str) -> str: """Return a |repr| string with a prefixed assignment.""" with objecttools.repr_.preserve_strings(True): with hydpy.pub.options.ellipsis(2, optional=True): with objecttools.assignrepr_tuple.always_bracketed(False): ...
Calculate the input discharge portions of the different response functions.
def calc_qpin_v1(self): """Calculate the input discharge portions of the different response functions. Required derived parameters: |Nmb| |MaxQ| |DiffQ| Required flux sequence: |QIn| Calculated flux sequences: |QPIn| Examples: Initialize an arma model w...
Refresh the input log sequence for the different MA processes.
def calc_login_v1(self): """Refresh the input log sequence for the different MA processes. Required derived parameters: |Nmb| |MA_Order| Required flux sequence: |QPIn| Updated log sequence: |LogIn| Example: Assume there are three response functions, involving one...
Calculate the discharge responses of the different MA processes.
def calc_qma_v1(self): """Calculate the discharge responses of the different MA processes. Required derived parameters: |Nmb| |MA_Order| |MA_Coefs| Required log sequence: |LogIn| Calculated flux sequence: |QMA| Examples: Assume there are three response func...
Calculate the discharge responses of the different AR processes.
def calc_qar_v1(self): """Calculate the discharge responses of the different AR processes. Required derived parameters: |Nmb| |AR_Order| |AR_Coefs| Required log sequence: |LogOut| Calculated flux sequence: |QAR| Examples: Assume there are four response func...
Calculate the ARMA results for the different response functions.
def calc_qpout_v1(self): """Calculate the ARMA results for the different response functions. Required derived parameter: |Nmb| Required flux sequences: |QMA| |QAR| Calculated flux sequence: |QPOut| Examples: Initialize an arma model with three different response ...
Refresh the log sequence for the different AR processes.
def calc_logout_v1(self): """Refresh the log sequence for the different AR processes. Required derived parameters: |Nmb| |AR_Order| Required flux sequence: |QPOut| Updated log sequence: |LogOut| Example: Assume there are four response functions, involving zero, o...
Sum up the results of the different response functions.
def calc_qout_v1(self): """Sum up the results of the different response functions. Required derived parameter: |Nmb| Required flux sequences: |QPOut| Calculated flux sequence: |QOut| Examples: Initialize an arma model with three different response functions: >...
Update inflow.
def pick_q_v1(self): """Update inflow.""" flu = self.sequences.fluxes.fastaccess inl = self.sequences.inlets.fastaccess flu.qin = 0. for idx in range(inl.len_q): flu.qin += inl.q[idx][0]
Determine the number of branches
def update(self): """Determine the number of branches""" con = self.subpars.pars.control self(con.ypoints.shape[0])
Update value based on: math: HV = BBV/ BNV.
def update(self): """Update value based on :math:`HV=BBV/BNV`. Required Parameters: |BBV| |BNV| Examples: >>> from hydpy.models.lstream import * >>> parameterstep('1d') >>> bbv(left=10., right=40.) >>> bnv(left=10., right=...
Update value based on the actual |calc_qg_v1| method.
def update(self): """Update value based on the actual |calc_qg_v1| method. Required derived parameter: |H| Note that the value of parameter |lstream_derived.QM| is directly related to the value of parameter |HM| and indirectly related to all parameters values releva...
Determines in how many segments the whole reach needs to be divided to approximate the desired lag time via integer rounding. Adjusts the shape of sequence |QJoints| additionally.
def update(self): """Determines in how many segments the whole reach needs to be divided to approximate the desired lag time via integer rounding. Adjusts the shape of sequence |QJoints| additionally. Required control parameters: |Lag| Calculated derived parameters: ...
Update |C1| based on: math: c_1 = \\ frac { Damp } { 1 + Damp }.
def update(self): """Update |C1| based on :math:`c_1 = \\frac{Damp}{1+Damp}`. Examples: The first examples show the calculated value of |C1| for the lowest possible value of |Lag|, the lowest possible value, and an intermediate value: >>> from hydpy.mod...
Update |C2| based on: math: c_2 = 1. - c_1 - c_3.
def update(self): """Update |C2| based on :math:`c_2 = 1.-c_1-c_3`. Examples: The following examples show the calculated value of |C2| are clipped when to low or to high: >>> from hydpy.models.hstream import * >>> parameterstep('1d') >>> der...
View the supplied data in an interactive graphical table widget.
def view(data, enc=None, start_pos=None, delimiter=None, hdr_rows=None, idx_cols=None, sheet_index=0, transpose=False, wait=None, recycle=None, detach=None, metavar=None, title=None): """View the supplied data in an interactive, graphical table widget. data: When a valid path or IO object, re...
Get and clear the current |Node| and |Element| registries.
def gather_registries() -> Tuple[Dict, Mapping, Mapping]: """Get and clear the current |Node| and |Element| registries. Function |gather_registries| is thought to be used by class |Tester| only. """ id2devices = copy.copy(_id2devices) registry = copy.copy(_registry) selection = copy.copy(_selec...
Reset the current |Node| and |Element| registries.
def reset_registries(dicts: Tuple[Dict, Mapping, Mapping]): """Reset the current |Node| and |Element| registries. Function |reset_registries| is thought to be used by class |Tester| only. """ dict_ = globals() dict_['_id2devices'] = dicts[0] dict_['_registry'] = dicts[1] dict_['_selection']...
>>> from hydpy import pub >>> pub. timegrids = 2004. 01. 01 2005. 01. 01 1d >>> from hydpy. core. devicetools import _get_pandasindex >>> _get_pandasindex () # doctest: + ELLIPSIS DatetimeIndex ( [ 2004 - 01 - 01 12: 00: 00 2004 - 01 - 02 12: 00: 00... 2004 - 12 - 30 12: 00: 00 2004 - 12 - 31 12: 00: 00 ] dtype = datet...
def _get_pandasindex(): """ >>> from hydpy import pub >>> pub.timegrids = '2004.01.01', '2005.01.01', '1d' >>> from hydpy.core.devicetools import _get_pandasindex >>> _get_pandasindex() # doctest: +ELLIPSIS DatetimeIndex(['2004-01-01 12:00:00', '2004-01-02 12:00:00', ... ...
Return a list of all keywords starting with the given string.
def startswith(self, name: str) -> List[str]: """Return a list of all keywords starting with the given string. >>> from hydpy.core.devicetools import Keywords >>> keywords = Keywords('first_keyword', 'second_keyword', ... 'keyword_3', 'keyword_4', ... ...
Return a list of all keywords ending with the given string.
def endswith(self, name: str) -> List[str]: """Return a list of all keywords ending with the given string. >>> from hydpy.core.devicetools import Keywords >>> keywords = Keywords('first_keyword', 'second_keyword', ... 'keyword_3', 'keyword_4', ... ...
Return a list of all keywords containing the given string.
def contains(self, name: str) -> List[str]: """Return a list of all keywords containing the given string. >>> from hydpy.core.devicetools import Keywords >>> keywords = Keywords('first_keyword', 'second_keyword', ... 'keyword_3', 'keyword_4', ... ...
Before updating the given names are checked to be valid variable identifiers.
def update(self, *names: Any) -> None: """Before updating, the given names are checked to be valid variable identifiers. >>> from hydpy.core.devicetools import Keywords >>> keywords = Keywords('first_keyword', 'second_keyword', ... 'keyword_3', 'keyword_4', ...
Before adding a new name it is checked to be valid variable identifiers.
def add(self, name: Any) -> None: """Before adding a new name, it is checked to be valid variable identifiers. >>> from hydpy.core.devicetools import Keywords >>> keywords = Keywords('first_keyword', 'second_keyword', ... 'keyword_3', 'keyword_4', ......
Add the given |Node| or |Element| object to the actual |Nodes| or |Elements| object.
def add_device(self, device: Union[DeviceType, str]) -> None: """Add the given |Node| or |Element| object to the actual |Nodes| or |Elements| object. You can pass either a string or a device: >>> from hydpy import Nodes >>> nodes = Nodes() >>> nodes.add_device('old_node...
Remove the given |Node| or |Element| object from the actual |Nodes| or |Elements| object.
def remove_device(self, device: Union[DeviceType, str]) -> None: """Remove the given |Node| or |Element| object from the actual |Nodes| or |Elements| object. You can pass either a string or a device: >>> from hydpy import Node, Nodes >>> nodes = Nodes('node_x', 'node_y') ...
A set of all keywords of all handled devices.
def keywords(self) -> Set[str]: """A set of all keywords of all handled devices. In addition to attribute access via device names, |Nodes| and |Elements| objects allow for attribute access via keywords, allowing for an efficient search of certain groups of devices. Let us use th...
Return a shallow copy of the actual |Nodes| or |Elements| object.
def copy(self: DevicesTypeBound) -> DevicesTypeBound: """Return a shallow copy of the actual |Nodes| or |Elements| object. Method |Devices.copy| returns a semi-flat copy of |Nodes| or |Elements| objects, due to their devices being not copyable: >>> from hydpy import Nodes >>> o...
Call methods |Node. prepare_simseries| and |Node. prepare_obsseries|.
def prepare_allseries(self, ramflag: bool = True) -> None: """Call methods |Node.prepare_simseries| and |Node.prepare_obsseries|.""" self.prepare_simseries(ramflag) self.prepare_obsseries(ramflag)
Call method |Node. prepare_simseries| of all handled |Node| objects.
def prepare_simseries(self, ramflag: bool = True) -> None: """Call method |Node.prepare_simseries| of all handled |Node| objects.""" for node in printtools.progressbar(self): node.prepare_simseries(ramflag)
Call method |Node. prepare_obsseries| of all handled |Node| objects.
def prepare_obsseries(self, ramflag: bool = True) -> None: """Call method |Node.prepare_obsseries| of all handled |Node| objects.""" for node in printtools.progressbar(self): node.prepare_obsseries(ramflag)
Call method |Element. init_model| of all handle |Element| objects.
def init_models(self) -> None: """Call method |Element.init_model| of all handle |Element| objects. We show, based the `LahnH` example project, that method |Element.init_model| prepares the |Model| objects of all elements, including building the required connections and updating the ...
Save the control parameters of the |Model| object handled by each |Element| object and eventually the ones handled by the given |Auxfiler| object.
def save_controls(self, parameterstep: 'timetools.PeriodConstrArg' = None, simulationstep: 'timetools.PeriodConstrArg' = None, auxfiler: 'Optional[auxfiletools.Auxfiler]' = None): """Save the control parameters of the |Model| object handled by each |Element| o...
Save the initial conditions of the |Model| object handled by each |Element| object.
def load_conditions(self) -> None: """Save the initial conditions of the |Model| object handled by each |Element| object.""" for element in printtools.progressbar(self): element.model.sequences.load_conditions()
Save the calculated conditions of the |Model| object handled by each |Element| object.
def save_conditions(self) -> None: """Save the calculated conditions of the |Model| object handled by each |Element| object.""" for element in printtools.progressbar(self): element.model.sequences.save_conditions()
A nested dictionary containing the values of all |ConditionSequence| objects of all currently handled models.
def conditions(self) -> \ Dict[str, Dict[str, Dict[str, Union[float, numpy.ndarray]]]]: """A nested dictionary containing the values of all |ConditionSequence| objects of all currently handled models. See the documentation on property |HydPy.conditions| for further informati...
Call method |Element. prepare_allseries| of all handled |Element| objects.
def prepare_allseries(self, ramflag: bool = True) -> None: """Call method |Element.prepare_allseries| of all handled |Element| objects.""" for element in printtools.progressbar(self): element.prepare_allseries(ramflag)
Call method |Element. prepare_inputseries| of all handled |Element| objects.
def prepare_inputseries(self, ramflag: bool = True) -> None: """Call method |Element.prepare_inputseries| of all handled |Element| objects.""" for element in printtools.progressbar(self): element.prepare_inputseries(ramflag)
Call method |Element. prepare_fluxseries| of all handled |Element| objects.
def prepare_fluxseries(self, ramflag: bool = True) -> None: """Call method |Element.prepare_fluxseries| of all handled |Element| objects.""" for element in printtools.progressbar(self): element.prepare_fluxseries(ramflag)
Call method |Element. prepare_stateseries| of all handled |Element| objects.
def prepare_stateseries(self, ramflag: bool = True) -> None: """Call method |Element.prepare_stateseries| of all handled |Element| objects.""" for element in printtools.progressbar(self): element.prepare_stateseries(ramflag)
Gather all new |Node| or |Element| objects.
def extract_new(cls) -> DevicesTypeUnbound: """Gather all "new" |Node| or |Element| objects. See the main documentation on module |devicetools| for further information. """ devices = cls.get_handlerclass()(*_selection[cls]) _selection[cls].clear() return devices
Return the |Double| object appropriate for the given |Element| input or output group and the actual |Node. deploymode|.
def get_double(self, group: str) -> pointerutils.Double: """Return the |Double| object appropriate for the given |Element| input or output group and the actual |Node.deploymode|. Method |Node.get_double| should be of interest for framework developers only (and eventually for model devel...
Plot the |IOSequence. series| of the |Sim| sequence object.
def plot_simseries(self, **kwargs: Any) -> None: """Plot the |IOSequence.series| of the |Sim| sequence object. See method |Node.plot_allseries| for further information. """ self.__plot_series([self.sequences.sim], kwargs)
Plot the |IOSequence. series| of the |Obs| sequence object.
def plot_obsseries(self, **kwargs: Any) -> None: """Plot the |IOSequence.series| of the |Obs| sequence object. See method |Node.plot_allseries| for further information. """ self.__plot_series([self.sequences.obs], kwargs)
Return a |repr| string with a prefixed assignment.
def assignrepr(self, prefix: str = '') -> str: """Return a |repr| string with a prefixed assignment.""" lines = ['%sNode("%s", variable="%s",' % (prefix, self.name, self.variable)] if self.keywords: subprefix = '%skeywords=' % (' '*(len(prefix)+5)) with o...
The |Model| object handled by the actual |Element| object.
def model(self) -> 'modeltools.Model': """The |Model| object handled by the actual |Element| object. Directly after their initialisation, elements do not know which model they require: >>> from hydpy import Element >>> hland = Element('hland', outlets='outlet') >>> hlan...
Load the control file of the actual |Element| object initialise its |Model| object build the required connections via ( an eventually overridden version of ) method |Model. connect| of class |Model| and update its derived parameter values via calling ( an eventually overridden version ) of method |Parameters. update| o...
def init_model(self, clear_registry: bool = True) -> None: """Load the control file of the actual |Element| object, initialise its |Model| object, build the required connections via (an eventually overridden version of) method |Model.connect| of class |Model|, and update its derived par...
A set of all different |Node. variable| values of the |Node| objects directly connected to the actual |Element| object.
def variables(self) -> Set[str]: """A set of all different |Node.variable| values of the |Node| objects directly connected to the actual |Element| object. Suppose there is an element connected to five nodes, which (partly) represent different variables: >>> from hydpy import El...
Prepare the |IOSequence. series| objects of all input flux and state sequences of the model handled by this element.
def prepare_allseries(self, ramflag: bool = True) -> None: """Prepare the |IOSequence.series| objects of all `input`, `flux` and `state` sequences of the model handled by this element. Call this method before a simulation run, if you need access to (nearly) all simulated series of the h...
Plot ( the selected ) |InputSequence| |IOSequence. series| values.
def plot_inputseries( self, names: Optional[Iterable[str]] = None, average: bool = False, **kwargs: Any) \ -> None: """Plot (the selected) |InputSequence| |IOSequence.series| values. We demonstrate the functionalities of method |Element.plot_inputseries| base...
Plot the flux series of the handled model.
def plot_fluxseries( self, names: Optional[Iterable[str]] = None, average: bool = False, **kwargs: Any) \ -> None: """Plot the `flux` series of the handled model. See the documentation on method |Element.plot_inputseries| for additional information. "...
Plot the state series of the handled model.
def plot_stateseries( self, names: Optional[Iterable[str]] = None, average: bool = False, **kwargs: Any) \ -> None: """Plot the `state` series of the handled model. See the documentation on method |Element.plot_inputseries| for additional information. ...
Return a |repr| string with a prefixed assignment.
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("%...
Convert all pure Python calculation functions of the model class to methods and assign them to the model instance.
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...
Name of the model type.
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...
Connect the link sequences of the actual model.
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...
Apply all methods stored in the hidden attribute PART_ODE_METHODS.
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...
Get the sum of the fluxes calculated so far.
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...
Perform a dot multiplication between the fluxes and the A coefficients associated with the different stages of the actual method.
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....
Set the sum of the fluxes calculated so far to zero.
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...
Add up the sum of the fluxes calculated so far.
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 ""...
Estimate the numerical error based on the fluxes calculated by the current and the last method.
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...
Estimate the numerical error to be expected when applying all methods available based on the results of the current and the last method.
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 ...
Perform a HydPy workflow in agreement with the given XML configuration file available in the directory of the given project. ToDo
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...
Raise an error if the actual XML does not agree with one of the available schema files.
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`: ...
Update the |Options| object available in module |pub| with the values defined in the options XML element.
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...
Update the |Timegrids| object available in module |pub| with the values defined in the timegrid XML element.
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...
Yield all |Element| objects returned by |XMLInterface. selections| and |XMLInterface. devices| without duplicates.
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...
A |Selection| object containing all |Element| and |Node| objects defined by |XMLInterface. selections| and |XMLInterface. devices|.
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() >>> ...
Load the condition files of the |Model| objects of all |Element| objects returned by |XMLInterface. elements|:
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...
Save the condition files of the |Model| objects of all |Element| objects returned by |XMLInterface. elements|:
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...
Call |XMLSubseries. prepare_series| of all |XMLSubseries| objects with the same memory |set| object.
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...
The |Selections| object defined for the respective reader or writer element of the actual XML file. ToDo
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...
The additional devices defined for the respective reader or writer element contained within a |Selection| object. ToDo
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...
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.
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 ...
A nested |collections. defaultdict| containing the model specific information provided by the XML sequences element.
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...
A |collections. defaultdict| containing the node - specific information provided by XML sequences element.
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...
Call |IOSequence. activate_ram| of all sequences selected by the given output element of the actual XML file.
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...
Load time series data as defined by the actual XML reader element.
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') ...
Save time series data as defined by the actual XML writer element.
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') ...
ToDo
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()...
Write the complete base schema file HydPyConfigBase. xsd based on the template file HydPyConfigBase. xsdt.
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...
Return a sorted |list| containing all application model names.
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',...] ""...
Return the complete string to be inserted into the string of the template file.
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...
Return the insertion string required for the given application model.
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...
Return the insertion string required for the given group of sequences.
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...
Return the complete string related to the definition of exchange items to be inserted into the string of the template file.
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 <...
Return a string defining a model specific XML type extending ItemType.
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...
Return a string defining the XML element for the given exchange item group.
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 ...
Return a string defining the required types for the given exchange item group.
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 ...
Return a string defining the required types for the given combination of an exchange item group and an application model.
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( ...
Return a string defining the required types for the given combination of an exchange item group and |Node| objects.
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( ......
Return a string defining the required types for the given combination of an exchange item group and an application model.
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...
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|.
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...
Create a new mask object based on the given |numpy. ndarray| and return it.
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)
Return a new |DefaultMask| object associated with the given |Variable| object.
def new(cls, variable, **kwargs): """Return a new |DefaultMask| object associated with the given |Variable| object.""" return cls.array2mask(numpy.full(variable.shape, True))
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 |IndexMask| class attribute tuple RELEVANT_VALUES.
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...
A |list| of all currently relevant indices calculated as an intercection of the ( constant ) class attribute RELEVANT_VALUES and the ( variable ) property |IndexMask. refindices|.
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) ...