nodes: 0, module; 1, function_definition; 2, function_name:prepare_io_example_1; 3, parameters; 4, type; 5, comment:# noinspection PyUnresolvedReferences; 6, block; 7, generic_type; 8, expression_statement; 9, import_from_statement; 10, expression_statement; 11, import_from_statement; 12, expression_statement; 13, with_statement; 14, expression_statement; 15, import_from_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, expression_statement; 20, expression_statement; 21, expression_statement; 22, expression_statement; 23, import_from_statement; 24, expression_statement; 25, expression_statement; 26, expression_statement; 27, import_from_statement; 28, for_statement; 29, with_statement; 30, function_definition; 31, import_statement; 32, expression_statement; 33, for_statement; 34, for_statement; 35, return_statement; 36, identifier:Tuple; 37, type_parameter; 38, comment:"""Prepare an IO example configuration.
  
      >>> from hydpy.core.examples import prepare_io_example_1
      >>> nodes, elements = prepare_io_example_1()
  
      (1) Prepares a short initialisation period of five days:
  
      >>> from hydpy import pub
      >>> pub.timegrids
      Timegrids(Timegrid('2000-01-01 00:00:00',
                         '2000-01-05 00:00:00',
                         '1d'))
  
      (2) Prepares a plain IO testing directory structure:
  
      >>> pub.sequencemanager.inputdirpath
      'inputpath'
      >>> pub.sequencemanager.fluxdirpath
      'outputpath'
      >>> pub.sequencemanager.statedirpath
      'outputpath'
      >>> pub.sequencemanager.nodedirpath
      'nodepath'
      >>> import os
      >>> from hydpy import TestIO
      >>> with TestIO():
      ...     print(sorted(filename for filename in os.listdir('.')
      ...                  if not filename.startswith('_')))
      ['inputpath', 'nodepath', 'outputpath']
  
      (3) Returns three |Element| objects handling either application model
      |lland_v1| or |lland_v2|, and two |Node| objects handling variables
      `Q` and `T`:
  
      >>> for element in elements:
      ...     print(element.name, element.model)
      element1 lland_v1
      element2 lland_v1
      element3 lland_v2
      >>> for node in nodes:
      ...     print(node.name, node.variable)
      node1 Q
      node2 T
  
      (4) Prepares the time series data of the input sequence
      |lland_inputs.Nied|, flux sequence |lland_fluxes.NKor|, and state
      sequence |lland_states.BoWa| for each model instance, and |Sim| for
      each node instance (all values are different), e.g.:
  
      >>> nied1 = elements.element1.model.sequences.inputs.nied
      >>> nied1.series
      InfoArray([ 0.,  1.,  2.,  3.])
      >>> nkor1 = elements.element1.model.sequences.fluxes.nkor
      >>> nkor1.series
      InfoArray([[ 12.],
                 [ 13.],
                 [ 14.],
                 [ 15.]])
      >>> bowa3 = elements.element3.model.sequences.states.bowa
      >>> bowa3.series
      InfoArray([[ 48.,  49.,  50.],
                 [ 51.,  52.,  53.],
                 [ 54.,  55.,  56.],
                 [ 57.,  58.,  59.]])
      >>> sim2 = nodes.node2.sequences.sim
      >>> sim2.series
      InfoArray([ 64.,  65.,  66.,  67.])
  
      (5) All sequences carry |numpy.ndarray| objects with (deep) copies
      of the time series data for testing:
  
      >>> import numpy
      >>> (numpy.all(nied1.series == nied1.testarray) and
      ...  numpy.all(nkor1.series == nkor1.testarray) and
      ...  numpy.all(bowa3.series == bowa3.testarray) and
      ...  numpy.all(sim2.series == sim2.testarray))
      InfoArray(True, dtype=bool)
      >>> bowa3.series[1, 2] = -999.0
      >>> numpy.all(bowa3.series == bowa3.testarray)
      InfoArray(False, dtype=bool)
      """; 39, dotted_name; 40, dotted_name; 41, call; 42, dotted_name; 43, dotted_name; 44, assignment; 45, with_clause; 46, block; 47, assignment; 48, dotted_name; 49, dotted_name; 50, dotted_name; 51, dotted_name; 52, dotted_name; 53, dotted_name; 54, assignment; 55, assignment; 56, assignment; 57, assignment; 58, assignment; 59, assignment; 60, assignment; 61, dotted_name; 62, dotted_name; 63, dotted_name; 64, assignment; 65, assignment; 66, assignment; 67, dotted_name; 68, dotted_name; 69, pattern_list; 70, call; 71, block; 72, with_clause; 73, block; 74, function_name:init_values; 75, parameters; 76, block; 77, dotted_name; 78, assignment; 79, pattern_list; 80, call; 81, block; 82, identifier:node; 83, identifier:nodes; 84, block; 85, expression_list; 86, type; 87, type; 88, identifier:hydpy; 89, identifier:TestIO; 90, attribute; 91, argument_list; 92, identifier:hydpy; 93, identifier:core; 94, identifier:filetools; 95, identifier:SequenceManager; 96, attribute; 97, call; 98, with_item; 99, expression_statement; 100, expression_statement; 101, expression_statement; 102, expression_statement; 103, attribute; 104, expression_list; 105, identifier:hydpy; 106, identifier:Node; 107, identifier:Nodes; 108, identifier:Element; 109, identifier:Elements; 110, identifier:prepare_model; 111, identifier:node1; 112, call; 113, identifier:node2; 114, call; 115, identifier:nodes; 116, call; 117, identifier:element1; 118, call; 119, identifier:element2; 120, call; 121, identifier:element3; 122, call; 123, identifier:elements; 124, call; 125, identifier:hydpy; 126, identifier:models; 127, identifier:lland_v1; 128, identifier:lland_v2; 129, attribute; 130, call; 131, attribute; 132, call; 133, attribute; 134, call; 135, identifier:hydpy; 136, identifier:models; 137, identifier:lland; 138, identifier:ACKER; 139, identifier:idx; 140, identifier:element; 141, identifier:enumerate; 142, argument_list; 143, expression_statement; 144, expression_statement; 145, expression_statement; 146, expression_statement; 147, with_item; 148, expression_statement; 149, expression_statement; 150, expression_statement; 151, expression_statement; 152, identifier:seq; 153, identifier:value1_; 154, expression_statement; 155, expression_statement; 156, expression_statement; 157, expression_statement; 158, return_statement; 159, identifier:numpy; 160, identifier:value1; 161, integer:0; 162, identifier:subname; 163, identifier:seqname; 164, identifier:zip; 165, argument_list; 166, for_statement; 167, expression_statement; 168, identifier:nodes; 169, identifier:elements; 170, attribute; 171, attribute; 172, identifier:TestIO; 173, identifier:clear; 174, attribute; 175, identifier:sequencemanager; 176, identifier:SequenceManager; 177, argument_list; 178, call; 179, assignment; 180, assignment; 181, assignment; 182, assignment; 183, attribute; 184, identifier:timegrids; 185, string; 186, string; 187, string; 188, identifier:Node; 189, argument_list; 190, identifier:Node; 191, argument_list; 192, identifier:Nodes; 193, argument_list; 194, identifier:Element; 195, argument_list; 196, identifier:Element; 197, argument_list; 198, identifier:Element; 199, argument_list; 200, identifier:Elements; 201, argument_list; 202, identifier:element1; 203, identifier:model; 204, identifier:prepare_model; 205, argument_list; 206, identifier:element2; 207, identifier:model; 208, identifier:prepare_model; 209, argument_list; 210, identifier:element3; 211, identifier:model; 212, identifier:prepare_model; 213, argument_list; 214, identifier:elements; 215, assignment; 216, call; 217, call; 218, call; 219, call; 220, call; 221, call; 222, call; 223, call; 224, assignment; 225, assignment; 226, assignment; 227, assignment; 228, identifier:value2_; 229, list; 230, list; 231, identifier:element; 232, identifier:elements; 233, block; 234, assignment; 235, identifier:devicetools; 236, identifier:Nodes; 237, identifier:devicetools; 238, identifier:Elements; 239, identifier:hydpy; 240, identifier:pub; 241, identifier:TestIO; 242, argument_list; 243, attribute; 244, string; 245, attribute; 246, string; 247, attribute; 248, string; 249, attribute; 250, string; 251, identifier:hydpy; 252, identifier:pub; 253, string_content:2000-01-01; 254, string_content:2000-01-05; 255, string_content:1d; 256, string; 257, string; 258, keyword_argument; 259, identifier:node1; 260, identifier:node2; 261, string; 262, keyword_argument; 263, string; 264, keyword_argument; 265, string; 266, keyword_argument; 267, identifier:element1; 268, identifier:element2; 269, identifier:element3; 270, identifier:lland_v1; 271, identifier:lland_v1; 272, identifier:lland_v2; 273, identifier:parameters; 274, attribute; 275, attribute; 276, argument_list; 277, attribute; 278, argument_list; 279, attribute; 280, argument_list; 281, attribute; 282, argument_list; 283, attribute; 284, argument_list; 285, attribute; 286, argument_list; 287, attribute; 288, argument_list; 289, attribute; 290, argument_list; 291, identifier:value2_; 292, binary_operator:value1_ + len(seq.series.flatten()); 293, identifier:values_; 294, call; 295, attribute; 296, call; 297, attribute; 298, call; 299, string; 300, string; 301, string; 302, string; 303, string; 304, string; 305, expression_statement; 306, expression_statement; 307, identifier:value1; 308, call; 309, attribute; 310, identifier:inputdirpath; 311, string_content:inputpath; 312, attribute; 313, identifier:fluxdirpath; 314, string_content:outputpath; 315, attribute; 316, identifier:statedirpath; 317, string_content:outputpath; 318, attribute; 319, identifier:nodedirpath; 320, string_content:nodepath; 321, string_content:node1; 322, string_content:node2; 323, identifier:variable; 324, string; 325, string_content:element1; 326, identifier:outlets; 327, identifier:node1; 328, string_content:element2; 329, identifier:outlets; 330, identifier:node1; 331, string_content:element3; 332, identifier:outlets; 333, identifier:node1; 334, attribute; 335, identifier:parameters; 336, attribute; 337, identifier:nhru; 338, binary_operator:idx+1; 339, attribute; 340, identifier:lnk; 341, identifier:ACKER; 342, attribute; 343, identifier:absfhru; 344, float:10.0; 345, attribute; 346, identifier:printprogress; 347, False; 348, identifier:nodes; 349, identifier:prepare_simseries; 350, identifier:elements; 351, identifier:prepare_inputseries; 352, identifier:elements; 353, identifier:prepare_fluxseries; 354, identifier:elements; 355, identifier:prepare_stateseries; 356, identifier:value1_; 357, call; 358, attribute; 359, argument_list; 360, identifier:seq; 361, identifier:testarray; 362, attribute; 363, argument_list; 364, identifier:seq; 365, identifier:series; 366, attribute; 367, argument_list; 368, string_content:inputs; 369, string_content:fluxes; 370, string_content:states; 371, string_content:nied; 372, string_content:nkor; 373, string_content:bowa; 374, assignment; 375, assignment; 376, identifier:init_values; 377, argument_list; 378, attribute; 379, identifier:sequencemanager; 380, attribute; 381, identifier:sequencemanager; 382, attribute; 383, identifier:sequencemanager; 384, attribute; 385, identifier:sequencemanager; 386, string_content:T; 387, identifier:element; 388, identifier:model; 389, identifier:parameters; 390, identifier:control; 391, identifier:idx; 392, integer:1; 393, identifier:parameters; 394, identifier:control; 395, identifier:parameters; 396, identifier:derived; 397, attribute; 398, identifier:options; 399, identifier:len; 400, argument_list; 401, identifier:numpy; 402, identifier:arange; 403, identifier:value1_; 404, identifier:value2_; 405, keyword_argument; 406, identifier:values_; 407, identifier:reshape; 408, attribute; 409, attribute; 410, identifier:copy; 411, identifier:subseqs; 412, call; 413, identifier:value1; 414, call; 415, attribute; 416, identifier:value1; 417, identifier:hydpy; 418, identifier:pub; 419, identifier:hydpy; 420, identifier:pub; 421, identifier:hydpy; 422, identifier:pub; 423, identifier:hydpy; 424, identifier:pub; 425, identifier:hydpy; 426, identifier:pub; 427, call; 428, identifier:dtype; 429, identifier:float; 430, identifier:seq; 431, identifier:seriesshape; 432, identifier:seq; 433, identifier:testarray; 434, identifier:getattr; 435, argument_list; 436, identifier:init_values; 437, argument_list; 438, attribute; 439, identifier:sim; 440, attribute; 441, argument_list; 442, attribute; 443, identifier:subname; 444, call; 445, identifier:value1; 446, identifier:node; 447, identifier:sequences; 448, attribute; 449, identifier:flatten; 450, attribute; 451, identifier:sequences; 452, identifier:getattr; 453, argument_list; 454, identifier:seq; 455, identifier:series; 456, identifier:element; 457, identifier:model; 458, identifier:subseqs; 459, identifier:seqname
code: def prepare_io_example_1() -> Tuple[devicetools.Nodes, devicetools.Elements]:
      # noinspection PyUnresolvedReferences
      """Prepare an IO example configuration.
  
      >>> from hydpy.core.examples import prepare_io_example_1
      >>> nodes, elements = prepare_io_example_1()
  
      (1) Prepares a short initialisation period of five days:
  
      >>> from hydpy import pub
      >>> pub.timegrids
      Timegrids(Timegrid('2000-01-01 00:00:00',
                         '2000-01-05 00:00:00',
                         '1d'))
  
      (2) Prepares a plain IO testing directory structure:
  
      >>> pub.sequencemanager.inputdirpath
      'inputpath'
      >>> pub.sequencemanager.fluxdirpath
      'outputpath'
      >>> pub.sequencemanager.statedirpath
      'outputpath'
      >>> pub.sequencemanager.nodedirpath
      'nodepath'
      >>> import os
      >>> from hydpy import TestIO
      >>> with TestIO():
      ...     print(sorted(filename for filename in os.listdir('.')
      ...                  if not filename.startswith('_')))
      ['inputpath', 'nodepath', 'outputpath']
  
      (3) Returns three |Element| objects handling either application model
      |lland_v1| or |lland_v2|, and two |Node| objects handling variables
      `Q` and `T`:
  
      >>> for element in elements:
      ...     print(element.name, element.model)
      element1 lland_v1
      element2 lland_v1
      element3 lland_v2
      >>> for node in nodes:
      ...     print(node.name, node.variable)
      node1 Q
      node2 T
  
      (4) Prepares the time series data of the input sequence
      |lland_inputs.Nied|, flux sequence |lland_fluxes.NKor|, and state
      sequence |lland_states.BoWa| for each model instance, and |Sim| for
      each node instance (all values are different), e.g.:
  
      >>> nied1 = elements.element1.model.sequences.inputs.nied
      >>> nied1.series
      InfoArray([ 0.,  1.,  2.,  3.])
      >>> nkor1 = elements.element1.model.sequences.fluxes.nkor
      >>> nkor1.series
      InfoArray([[ 12.],
                 [ 13.],
                 [ 14.],
                 [ 15.]])
      >>> bowa3 = elements.element3.model.sequences.states.bowa
      >>> bowa3.series
      InfoArray([[ 48.,  49.,  50.],
                 [ 51.,  52.,  53.],
                 [ 54.,  55.,  56.],
                 [ 57.,  58.,  59.]])
      >>> sim2 = nodes.node2.sequences.sim
      >>> sim2.series
      InfoArray([ 64.,  65.,  66.,  67.])
  
      (5) All sequences carry |numpy.ndarray| objects with (deep) copies
      of the time series data for testing:
  
      >>> import numpy
      >>> (numpy.all(nied1.series == nied1.testarray) and
      ...  numpy.all(nkor1.series == nkor1.testarray) and
      ...  numpy.all(bowa3.series == bowa3.testarray) and
      ...  numpy.all(sim2.series == sim2.testarray))
      InfoArray(True, dtype=bool)
      >>> bowa3.series[1, 2] = -999.0
      >>> numpy.all(bowa3.series == bowa3.testarray)
      InfoArray(False, dtype=bool)
      """
      from hydpy import TestIO
      TestIO.clear()
      from hydpy.core.filetools import SequenceManager
      hydpy.pub.sequencemanager = SequenceManager()
      with TestIO():
          hydpy.pub.sequencemanager.inputdirpath = 'inputpath'
          hydpy.pub.sequencemanager.fluxdirpath = 'outputpath'
          hydpy.pub.sequencemanager.statedirpath = 'outputpath'
          hydpy.pub.sequencemanager.nodedirpath = 'nodepath'
  
      hydpy.pub.timegrids = '2000-01-01', '2000-01-05', '1d'
  
      from hydpy import Node, Nodes, Element, Elements, prepare_model
      node1 = Node('node1')
      node2 = Node('node2', variable='T')
      nodes = Nodes(node1, node2)
      element1 = Element('element1', outlets=node1)
      element2 = Element('element2', outlets=node1)
      element3 = Element('element3', outlets=node1)
      elements = Elements(element1, element2, element3)
  
      from hydpy.models import lland_v1, lland_v2
      element1.model = prepare_model(lland_v1)
      element2.model = prepare_model(lland_v1)
      element3.model = prepare_model(lland_v2)
  
      from hydpy.models.lland import ACKER
      for idx, element in enumerate(elements):
          parameters = element.model.parameters
          parameters.control.nhru(idx+1)
          parameters.control.lnk(ACKER)
          parameters.derived.absfhru(10.0)
  
      with hydpy.pub.options.printprogress(False):
          nodes.prepare_simseries()
          elements.prepare_inputseries()
          elements.prepare_fluxseries()
          elements.prepare_stateseries()
  
      def init_values(seq, value1_):
          value2_ = value1_ + len(seq.series.flatten())
          values_ = numpy.arange(value1_, value2_, dtype=float)
          seq.testarray = values_.reshape(seq.seriesshape)
          seq.series = seq.testarray.copy()
          return value2_
  
      import numpy
      value1 = 0
      for subname, seqname in zip(['inputs', 'fluxes', 'states'],
                                  ['nied', 'nkor', 'bowa']):
          for element in elements:
              subseqs = getattr(element.model.sequences, subname)
              value1 = init_values(getattr(subseqs, seqname), value1)
      for node in nodes:
          value1 = init_values(node.sequences.sim, value1)
  
      return nodes, elements