idx
int64
0
63k
question
stringlengths
61
4.03k
target
stringlengths
6
1.23k
400
def get_submask ( self , * args , ** kwargs ) -> masktools . CustomMask : if args or kwargs : masks = self . availablemasks mask = masktools . CustomMask ( numpy . full ( self . shape , False ) ) for arg in args : mask = mask + self . _prepare_mask ( arg , masks ) for key , value in kwargs . items ( ) : mask = mask + self . _prepare_mask ( key , masks , ** value ) if mask not in self . mask : raise ValueError ( f'Based on the arguments `{args}` and `{kwargs}` ' f'the mask `{repr(mask)}` has been determined, ' f'which is not a submask of `{repr(self.mask)}`.' ) else : mask = self . mask return mask
Get a sub - mask of the mask handled by the actual |Variable| object based on the given arguments .
401
def commentrepr ( self ) -> List [ str ] : if hydpy . pub . options . reprcomments : return [ f'# {line}' for line in textwrap . wrap ( objecttools . description ( self ) , 72 ) ] return [ ]
A list with comments for making string representations more informative .
402
def get_controlfileheader ( model : Union [ str , 'modeltools.Model' ] , parameterstep : timetools . PeriodConstrArg = None , simulationstep : timetools . PeriodConstrArg = None ) -> str : with Parameter . parameterstep ( parameterstep ) : if simulationstep is None : simulationstep = Parameter . simulationstep else : simulationstep = timetools . Period ( simulationstep ) return ( f"# -*- coding: utf-8 -*-\n\n" f"from hydpy.models.{model} import *\n\n" f"simulationstep('{simulationstep}')\n" f"parameterstep('{Parameter.parameterstep}')\n\n" )
Return the header of a regular or auxiliary parameter control file .
403
def update ( self ) -> None : for subpars in self . secondary_subpars : for par in subpars : try : par . update ( ) except BaseException : objecttools . augment_excmessage ( f'While trying to update parameter ' f'`{objecttools.elementphrase(par)}`' )
Call method |Parameter . update| of all secondary parameters .
404
def save_controls ( self , filepath : Optional [ str ] = None , parameterstep : timetools . PeriodConstrArg = None , simulationstep : timetools . PeriodConstrArg = None , auxfiler : 'auxfiletools.Auxfiler' = None ) : if self . control : variable2auxfile = getattr ( auxfiler , str ( self . model ) , None ) lines = [ get_controlfileheader ( self . model , parameterstep , simulationstep ) ] with Parameter . parameterstep ( parameterstep ) : for par in self . control : if variable2auxfile : auxfilename = variable2auxfile . get_filename ( par ) if auxfilename : lines . append ( f"{par.name}(auxfile='{auxfilename}')\n" ) continue lines . append ( repr ( par ) + '\n' ) text = '' . join ( lines ) if filepath : with open ( filepath , mode = 'w' , encoding = 'utf-8' ) as controlfile : controlfile . write ( text ) else : filename = objecttools . devicename ( self ) if filename == '?' : raise RuntimeError ( 'To save the control parameters of a model to a file, ' 'its filename must be known. This can be done, by ' 'passing a filename to function `save_controls` ' 'directly. But in complete HydPy applications, it is ' 'usally assumed to be consistent with the name of the ' 'element handling the model.' ) hydpy . pub . controlmanager . save_file ( filename , text )
Write the control parameters to file .
405
def _get_values_from_auxiliaryfile ( self , auxfile ) : try : frame = inspect . currentframe ( ) . f_back . f_back while frame : namespace = frame . f_locals try : subnamespace = { 'model' : namespace [ 'model' ] , 'focus' : self } break except KeyError : frame = frame . f_back else : raise RuntimeError ( 'Cannot determine the corresponding model. Use the ' '`auxfile` keyword in usual parameter control files only.' ) filetools . ControlManager . read2dict ( auxfile , subnamespace ) try : subself = subnamespace [ self . name ] except KeyError : raise RuntimeError ( f'The selected file does not define value(s) for ' f'parameter {self.name}' ) return subself . values except BaseException : objecttools . augment_excmessage ( f'While trying to extract information for parameter ' f'`{self.name}` from file `{auxfile}`' )
Try to return the parameter values from the auxiliary control file with the given name .
406
def initinfo ( self ) -> Tuple [ Union [ float , int , bool ] , bool ] : init = self . INIT if ( init is not None ) and hydpy . pub . options . usedefaultvalues : with Parameter . parameterstep ( '1d' ) : return self . apply_timefactor ( init ) , True return variabletools . TYPE2MISSINGVALUE [ self . TYPE ] , False
The actual initial value of the given parameter .
407
def get_timefactor ( cls ) -> float : try : parfactor = hydpy . pub . timegrids . parfactor except RuntimeError : if not ( cls . parameterstep and cls . simulationstep ) : raise RuntimeError ( f'To calculate the conversion factor for adapting ' f'the values of the time-dependent parameters, ' f'you need to define both a parameter and a simulation ' f'time step size first.' ) else : date1 = timetools . Date ( '2000.01.01' ) date2 = date1 + cls . simulationstep parfactor = timetools . Timegrids ( timetools . Timegrid ( date1 , date2 , cls . simulationstep ) ) . parfactor return parfactor ( cls . parameterstep )
Factor to adjust a new value of a time - dependent parameter .
408
def revert_timefactor ( cls , values ) : if cls . TIME is True : return values / cls . get_timefactor ( ) if cls . TIME is False : return values * cls . get_timefactor ( ) return values
The inverse version of method |Parameter . apply_timefactor| .
409
def compress_repr ( self ) -> Optional [ str ] : if not hasattr ( self , 'value' ) : return '?' if not self : return f"{self.NDIM * '['}{self.NDIM * ']'}" unique = numpy . unique ( self [ self . mask ] ) if sum ( numpy . isnan ( unique ) ) == len ( unique . flatten ( ) ) : unique = numpy . array ( [ numpy . nan ] ) else : unique = self . revert_timefactor ( unique ) if len ( unique ) == 1 : return objecttools . repr_ ( unique [ 0 ] ) return None
Try to find a compressed parameter value representation and return it .
410
def refresh ( self ) -> None : if not self : self . values [ : ] = 0. elif len ( self ) == 1 : values = list ( self . _toy2values . values ( ) ) [ 0 ] self . values [ : ] = self . apply_timefactor ( values ) else : for idx , date in enumerate ( timetools . TOY . centred_timegrid ( self . simulationstep ) ) : values = self . interp ( date ) self . values [ idx ] = self . apply_timefactor ( values )
Update the actual simulation values based on the toy - value pairs .
411
def interp ( self , date : timetools . Date ) -> float : xnew = timetools . TOY ( date ) xys = list ( self ) for idx , ( x_1 , y_1 ) in enumerate ( xys ) : if x_1 > xnew : x_0 , y_0 = xys [ idx - 1 ] break else : x_0 , y_0 = xys [ - 1 ] x_1 , y_1 = xys [ 0 ] return y_0 + ( y_1 - y_0 ) / ( x_1 - x_0 ) * ( xnew - x_0 )
Perform a linear value interpolation for the given date and return the result .
412
def update ( self ) -> None : mask = self . mask weights = self . refweights [ mask ] self [ ~ mask ] = numpy . nan self [ mask ] = weights / numpy . sum ( weights )
Update subclass of |RelSubweightsMixin| based on refweights .
413
def alternative_initvalue ( self ) -> Union [ bool , int , float ] : if self . _alternative_initvalue is None : raise AttributeError ( f'No alternative initial value for solver parameter ' f'{objecttools.elementphrase(self)} has been defined so far.' ) else : return self . _alternative_initvalue
A user - defined value to be used instead of the value of class constant INIT .
414
def update ( self ) -> None : indexarray = hydpy . pub . indexer . timeofyear self . shape = indexarray . shape self . values = indexarray
Reference the actual |Indexer . timeofyear| array of the |Indexer| object available in module |pub| .
415
def get_premises_model ( ) : try : app_label , model_name = PREMISES_MODEL . split ( '.' ) except ValueError : raise ImproperlyConfigured ( "OPENINGHOURS_PREMISES_MODEL must be of the" " form 'app_label.model_name'" ) premises_model = get_model ( app_label = app_label , model_name = model_name ) if premises_model is None : raise ImproperlyConfigured ( "OPENINGHOURS_PREMISES_MODEL refers to" " model '%s' that has not been installed" % PREMISES_MODEL ) return premises_model
Support for custom company premises model with developer friendly validation .
416
def get_now ( ) : if not get_current_request : return datetime . datetime . now ( ) request = get_current_request ( ) if request : openinghours_now = request . GET . get ( 'openinghours-now' ) if openinghours_now : return datetime . datetime . strptime ( openinghours_now , '%Y%m%d%H%M%S' ) return datetime . datetime . now ( )
Allows to access global request and read a timestamp from query .
417
def get_closing_rule_for_now ( location ) : now = get_now ( ) if location : return ClosingRules . objects . filter ( company = location , start__lte = now , end__gte = now ) return Company . objects . first ( ) . closingrules_set . filter ( start__lte = now , end__gte = now )
Returns QuerySet of ClosingRules that are currently valid
418
def is_open ( location , now = None ) : if now is None : now = get_now ( ) if has_closing_rule_for_now ( location ) : return False now_time = datetime . time ( now . hour , now . minute , now . second ) if location : ohs = OpeningHours . objects . filter ( company = location ) else : ohs = Company . objects . first ( ) . openinghours_set . all ( ) for oh in ohs : is_open = False if ( oh . weekday == now . isoweekday ( ) and oh . from_hour <= now_time and now_time <= oh . to_hour ) : is_open = oh if ( oh . weekday == now . isoweekday ( ) and oh . from_hour <= now_time and ( ( oh . to_hour < oh . from_hour ) and ( now_time < datetime . time ( 23 , 59 , 59 ) ) ) ) : is_open = oh if ( oh . weekday == ( now . isoweekday ( ) - 1 ) % 7 and oh . from_hour >= now_time and oh . to_hour >= now_time and oh . to_hour < oh . from_hour ) : is_open = oh if is_open is not False : return oh return False
Is the company currently open? Pass now to test with a specific timestamp . Can be used stand - alone or as a helper .
419
def refweights ( self ) : return numpy . full ( self . shape , 1. / self . shape [ 0 ] , dtype = float )
A |numpy| |numpy . ndarray| with equal weights for all segment junctions ..
420
def add ( self , directory , path = None ) -> None : objecttools . valid_variable_identifier ( directory ) if path is None : path = directory setattr ( self , directory , path )
Add a directory and optionally its path .
421
def basepath ( self ) -> str : return os . path . abspath ( os . path . join ( self . projectdir , self . BASEDIR ) )
Absolute path pointing to the available working directories .
422
def availabledirs ( self ) -> Folder2Path : directories = Folder2Path ( ) for directory in os . listdir ( self . basepath ) : if not directory . startswith ( '_' ) : path = os . path . join ( self . basepath , directory ) if os . path . isdir ( path ) : directories . add ( directory , path ) elif directory . endswith ( '.zip' ) : directories . add ( directory [ : - 4 ] , path ) return directories
Names and paths of the available working directories .
423
def currentdir ( self ) -> str : if self . _currentdir is None : directories = self . availabledirs . folders if len ( directories ) == 1 : self . currentdir = directories [ 0 ] elif self . DEFAULTDIR in directories : self . currentdir = self . DEFAULTDIR else : prefix = ( f'The current working directory of the ' f'{objecttools.classname(self)} object ' f'has not been defined manually and cannot ' f'be determined automatically:' ) if not directories : raise RuntimeError ( f'{prefix} `{objecttools.repr_(self.basepath)}` ' f'does not contain any available directories.' ) if self . DEFAULTDIR is None : raise RuntimeError ( f'{prefix} `{objecttools.repr_(self.basepath)}` ' f'does contain multiple available directories ' f'({objecttools.enumeration(directories)}).' ) raise RuntimeError ( f'{prefix} The default directory ({self.DEFAULTDIR}) ' f'is not among the available directories ' f'({objecttools.enumeration(directories)}).' ) return self . _currentdir
Name of the current working directory containing the relevant files .
424
def currentpath ( self ) -> str : return os . path . join ( self . basepath , self . currentdir )
Absolute path of the current working directory .
425
def filenames ( self ) -> List [ str ] : return sorted ( fn for fn in os . listdir ( self . currentpath ) if not fn . startswith ( '_' ) )
Names of the files contained in the the current working directory .
426
def filepaths ( self ) -> List [ str ] : path = self . currentpath return [ os . path . join ( path , name ) for name in self . filenames ]
Absolute path names of the files contained in the current working directory .
427
def zip_currentdir ( self ) -> None : with zipfile . ZipFile ( f'{self.currentpath}.zip' , 'w' ) as zipfile_ : for filepath , filename in zip ( self . filepaths , self . filenames ) : zipfile_ . write ( filename = filepath , arcname = filename ) del self . currentdir
Pack the current working directory in a zip file .
428
def load_files ( self ) -> selectiontools . Selections : devicetools . Node . clear_all ( ) devicetools . Element . clear_all ( ) selections = selectiontools . Selections ( ) for ( filename , path ) in zip ( self . filenames , self . filepaths ) : devicetools . Node . extract_new ( ) devicetools . Element . extract_new ( ) try : info = runpy . run_path ( path ) except BaseException : objecttools . augment_excmessage ( f'While trying to load the network file `{path}`' ) try : node : devicetools . Node = info [ 'Node' ] element : devicetools . Element = info [ 'Element' ] selections += selectiontools . Selection ( filename . split ( '.' ) [ 0 ] , node . extract_new ( ) , element . extract_new ( ) ) except KeyError as exc : raise RuntimeError ( f'The class {exc.args[0]} cannot be loaded from the ' f'network file `{path}`.' ) selections += selectiontools . Selection ( 'complete' , info [ 'Node' ] . query_all ( ) , info [ 'Element' ] . query_all ( ) ) return selections
Read all network files of the current working directory structure their contents in a |selectiontools . Selections| object and return it .
429
def save_files ( self , selections ) -> None : try : currentpath = self . currentpath selections = selectiontools . Selections ( selections ) for selection in selections : if selection . name == 'complete' : continue path = os . path . join ( currentpath , selection . name + '.py' ) selection . save_networkfile ( filepath = path ) except BaseException : objecttools . augment_excmessage ( 'While trying to save selections `%s` into network files' % selections )
Save the |Selection| objects contained in the given |Selections| instance to separate network files .
430
def save_file ( self , filename , text ) : if not filename . endswith ( '.py' ) : filename += '.py' path = os . path . join ( self . currentpath , filename ) with open ( path , 'w' , encoding = "utf-8" ) as file_ : file_ . write ( text )
Save the given text under the given control filename and the current path .
431
def load_file ( self , filename ) : _defaultdir = self . DEFAULTDIR try : if not filename . endswith ( '.py' ) : filename += '.py' try : self . DEFAULTDIR = ( 'init_' + hydpy . pub . timegrids . sim . firstdate . to_string ( 'os' ) ) except KeyError : pass filepath = os . path . join ( self . currentpath , filename ) with open ( filepath ) as file_ : return file_ . read ( ) except BaseException : objecttools . augment_excmessage ( 'While trying to read the conditions file `%s`' % filename ) finally : self . DEFAULTDIR = _defaultdir
Read and return the content of the given file .
432
def save_file ( self , filename , text ) : _defaultdir = self . DEFAULTDIR try : if not filename . endswith ( '.py' ) : filename += '.py' try : self . DEFAULTDIR = ( 'init_' + hydpy . pub . timegrids . sim . lastdate . to_string ( 'os' ) ) except AttributeError : pass path = os . path . join ( self . currentpath , filename ) with open ( path , 'w' , encoding = "utf-8" ) as file_ : file_ . write ( text ) except BaseException : objecttools . augment_excmessage ( 'While trying to write the conditions file `%s`' % filename ) finally : self . DEFAULTDIR = _defaultdir
Save the given text under the given condition filename and the current path .
433
def load_file ( self , sequence ) : try : if sequence . filetype_ext == 'npy' : sequence . series = sequence . adjust_series ( * self . _load_npy ( sequence ) ) elif sequence . filetype_ext == 'asc' : sequence . series = sequence . adjust_series ( * self . _load_asc ( sequence ) ) elif sequence . filetype_ext == 'nc' : self . _load_nc ( sequence ) except BaseException : objecttools . augment_excmessage ( 'While trying to load the external data of sequence %s' % objecttools . devicephrase ( sequence ) )
Load data from an external data file an pass it to the given |IOSequence| .
434
def save_file ( self , sequence , array = None ) : if array is None : array = sequence . aggregate_series ( ) try : if sequence . filetype_ext == 'nc' : self . _save_nc ( sequence , array ) else : filepath = sequence . filepath_ext if ( ( array is not None ) and ( array . info [ 'type' ] != 'unmodified' ) ) : filepath = ( f'{filepath[:-4]}_{array.info["type"]}' f'{filepath[-4:]}' ) if not sequence . overwrite_ext and os . path . exists ( filepath ) : raise OSError ( f'Sequence {objecttools.devicephrase(sequence)} ' f'is not allowed to overwrite the existing file ' f'`{sequence.filepath_ext}`.' ) if sequence . filetype_ext == 'npy' : self . _save_npy ( array , filepath ) elif sequence . filetype_ext == 'asc' : self . _save_asc ( array , filepath ) except BaseException : objecttools . augment_excmessage ( 'While trying to save the external data of sequence %s' % objecttools . devicephrase ( sequence ) )
Write the date stored in |IOSequence . series| of the given |IOSequence| into an external data file .
435
def open_netcdf_reader ( self , flatten = False , isolate = False , timeaxis = 1 ) : self . _netcdf_reader = netcdftools . NetCDFInterface ( flatten = bool ( flatten ) , isolate = bool ( isolate ) , timeaxis = int ( timeaxis ) )
Prepare a new |NetCDFInterface| object for reading data .
436
def open_netcdf_writer ( self , flatten = False , isolate = False , timeaxis = 1 ) : self . _netcdf_writer = netcdftools . NetCDFInterface ( flatten = bool ( flatten ) , isolate = bool ( isolate ) , timeaxis = int ( timeaxis ) )
Prepare a new |NetCDFInterface| object for writing data .
437
def calc_nkor_v1 ( self ) : con = self . parameters . control . fastaccess inp = self . sequences . inputs . fastaccess flu = self . sequences . fluxes . fastaccess for k in range ( con . nhru ) : flu . nkor [ k ] = con . kg [ k ] * inp . nied
Adjust the given precipitation values .
438
def calc_tkor_v1 ( self ) : con = self . parameters . control . fastaccess inp = self . sequences . inputs . fastaccess flu = self . sequences . fluxes . fastaccess for k in range ( con . nhru ) : flu . tkor [ k ] = con . kt [ k ] + inp . teml
Adjust the given air temperature values .
439
def calc_et0_v1 ( self ) : con = self . parameters . control . fastaccess inp = self . sequences . inputs . fastaccess flu = self . sequences . fluxes . fastaccess for k in range ( con . nhru ) : flu . et0 [ k ] = ( con . ke [ k ] * ( ( ( 8.64 * inp . glob + 93. * con . kf [ k ] ) * ( flu . tkor [ k ] + 22. ) ) / ( 165. * ( flu . tkor [ k ] + 123. ) * ( 1. + 0.00019 * min ( con . hnn [ k ] , 600. ) ) ) ) )
Calculate reference evapotranspiration after Turc - Wendling .
440
def calc_et0_wet0_v1 ( self ) : con = self . parameters . control . fastaccess inp = self . sequences . inputs . fastaccess flu = self . sequences . fluxes . fastaccess log = self . sequences . logs . fastaccess for k in range ( con . nhru ) : flu . et0 [ k ] = ( con . wfet0 [ k ] * con . ke [ k ] * inp . pet + ( 1. - con . wfet0 [ k ] ) * log . wet0 [ 0 , k ] ) log . wet0 [ 0 , k ] = flu . et0 [ k ]
Correct the given reference evapotranspiration and update the corresponding log sequence .
441
def calc_evpo_v1 ( self ) : con = self . parameters . control . fastaccess der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess for k in range ( con . nhru ) : flu . evpo [ k ] = con . fln [ con . lnk [ k ] - 1 , der . moy [ self . idx_sim ] ] * flu . et0 [ k ]
Calculate land use and month specific values of potential evapotranspiration .
442
def calc_nbes_inzp_v1 ( self ) : con = self . parameters . control . fastaccess der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess for k in range ( con . nhru ) : if con . lnk [ k ] in ( WASSER , FLUSS , SEE ) : flu . nbes [ k ] = 0. sta . inzp [ k ] = 0. else : flu . nbes [ k ] = max ( flu . nkor [ k ] + sta . inzp [ k ] - der . kinz [ con . lnk [ k ] - 1 , der . moy [ self . idx_sim ] ] , 0. ) sta . inzp [ k ] += flu . nkor [ k ] - flu . nbes [ k ]
Calculate stand precipitation and update the interception storage accordingly .
443
def calc_sbes_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess for k in range ( con . nhru ) : if flu . nbes [ k ] <= 0. : flu . sbes [ k ] = 0. elif flu . tkor [ k ] >= ( con . tgr [ k ] + con . tsp [ k ] / 2. ) : flu . sbes [ k ] = 0. elif flu . tkor [ k ] <= ( con . tgr [ k ] - con . tsp [ k ] / 2. ) : flu . sbes [ k ] = flu . nbes [ k ] else : flu . sbes [ k ] = ( ( ( ( con . tgr [ k ] + con . tsp [ k ] / 2. ) - flu . tkor [ k ] ) / con . tsp [ k ] ) * flu . nbes [ k ] )
Calculate the frozen part of stand precipitation .
444
def calc_wgtf_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess for k in range ( con . nhru ) : if con . lnk [ k ] in ( WASSER , FLUSS , SEE ) : flu . wgtf [ k ] = 0. else : flu . wgtf [ k ] = ( max ( con . gtf [ k ] * ( flu . tkor [ k ] - con . treft [ k ] ) , 0 ) + max ( con . cpwasser / con . rschmelz * ( flu . tkor [ k ] - con . trefn [ k ] ) , 0. ) )
Calculate the potential snowmelt .
445
def calc_schm_wats_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess for k in range ( con . nhru ) : if con . lnk [ k ] in ( WASSER , FLUSS , SEE ) : sta . wats [ k ] = 0. flu . schm [ k ] = 0. else : sta . wats [ k ] += flu . sbes [ k ] flu . schm [ k ] = min ( flu . wgtf [ k ] , sta . wats [ k ] ) sta . wats [ k ] -= flu . schm [ k ]
Calculate the actual amount of water melting within the snow cover .
446
def calc_qbb_v1 ( self ) : con = self . parameters . control . fastaccess der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess for k in range ( con . nhru ) : if ( ( con . lnk [ k ] in ( VERS , WASSER , FLUSS , SEE ) ) or ( sta . bowa [ k ] <= der . wb [ k ] ) or ( con . nfk [ k ] <= 0. ) ) : flu . qbb [ k ] = 0. elif sta . bowa [ k ] <= der . wz [ k ] : flu . qbb [ k ] = con . beta [ k ] * ( sta . bowa [ k ] - der . wb [ k ] ) else : flu . qbb [ k ] = ( con . beta [ k ] * ( sta . bowa [ k ] - der . wb [ k ] ) * ( 1. + ( con . fbeta [ k ] - 1. ) * ( ( sta . bowa [ k ] - der . wz [ k ] ) / ( con . nfk [ k ] - der . wz [ k ] ) ) ) )
Calculate the amount of base flow released from the soil .
447
def calc_qdb_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess aid = self . sequences . aides . fastaccess for k in range ( con . nhru ) : if con . lnk [ k ] == WASSER : flu . qdb [ k ] = 0. elif ( ( con . lnk [ k ] in ( VERS , FLUSS , SEE ) ) or ( con . nfk [ k ] <= 0. ) ) : flu . qdb [ k ] = flu . wada [ k ] else : if sta . bowa [ k ] < con . nfk [ k ] : aid . sfa [ k ] = ( ( 1. - sta . bowa [ k ] / con . nfk [ k ] ) ** ( 1. / ( con . bsf [ k ] + 1. ) ) - ( flu . wada [ k ] / ( ( con . bsf [ k ] + 1. ) * con . nfk [ k ] ) ) ) else : aid . sfa [ k ] = 0. aid . exz [ k ] = sta . bowa [ k ] + flu . wada [ k ] - con . nfk [ k ] flu . qdb [ k ] = aid . exz [ k ] if aid . sfa [ k ] > 0. : flu . qdb [ k ] += aid . sfa [ k ] ** ( con . bsf [ k ] + 1. ) * con . nfk [ k ] flu . qdb [ k ] = max ( flu . qdb [ k ] , 0. )
Calculate direct runoff released from the soil .
448
def calc_bowa_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess aid = self . sequences . aides . fastaccess for k in range ( con . nhru ) : if con . lnk [ k ] in ( VERS , WASSER , FLUSS , SEE ) : sta . bowa [ k ] = 0. else : aid . bvl [ k ] = ( flu . evb [ k ] + flu . qbb [ k ] + flu . qib1 [ k ] + flu . qib2 [ k ] + flu . qdb [ k ] ) aid . mvl [ k ] = sta . bowa [ k ] + flu . wada [ k ] if aid . bvl [ k ] > aid . mvl [ k ] : aid . rvl [ k ] = aid . mvl [ k ] / aid . bvl [ k ] flu . evb [ k ] *= aid . rvl [ k ] flu . qbb [ k ] *= aid . rvl [ k ] flu . qib1 [ k ] *= aid . rvl [ k ] flu . qib2 [ k ] *= aid . rvl [ k ] flu . qdb [ k ] *= aid . rvl [ k ] sta . bowa [ k ] = 0. else : sta . bowa [ k ] = aid . mvl [ k ] - aid . bvl [ k ]
Update soil moisture and correct fluxes if necessary .
449
def calc_qbgz_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess sta . qbgz = 0. for k in range ( con . nhru ) : if con . lnk [ k ] == SEE : sta . qbgz += con . fhru [ k ] * ( flu . nkor [ k ] - flu . evi [ k ] ) elif con . lnk [ k ] not in ( WASSER , FLUSS , VERS ) : sta . qbgz += con . fhru [ k ] * flu . qbb [ k ]
Aggregate the amount of base flow released by all soil type HRUs and the net precipitation above water areas of type |SEE| .
450
def calc_qigz1_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess sta . qigz1 = 0. for k in range ( con . nhru ) : sta . qigz1 += con . fhru [ k ] * flu . qib1 [ k ]
Aggregate the amount of the first interflow component released by all HRUs .
451
def calc_qigz2_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess sta . qigz2 = 0. for k in range ( con . nhru ) : sta . qigz2 += con . fhru [ k ] * flu . qib2 [ k ]
Aggregate the amount of the second interflow component released by all HRUs .
452
def calc_qdgz_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess flu . qdgz = 0. for k in range ( con . nhru ) : if con . lnk [ k ] == FLUSS : flu . qdgz += con . fhru [ k ] * ( flu . nkor [ k ] - flu . evi [ k ] ) elif con . lnk [ k ] not in ( WASSER , SEE ) : flu . qdgz += con . fhru [ k ] * flu . qdb [ k ]
Aggregate the amount of total direct flow released by all HRUs .
453
def calc_qdgz1_qdgz2_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess if flu . qdgz > con . a2 : sta . qdgz2 = ( flu . qdgz - con . a2 ) ** 2 / ( flu . qdgz + con . a1 - con . a2 ) sta . qdgz1 = flu . qdgz - sta . qdgz2 else : sta . qdgz2 = 0. sta . qdgz1 = flu . qdgz
Seperate total direct flow into a small and a fast component .
454
def calc_qbga_v1 ( self ) : der = self . parameters . derived . fastaccess old = self . sequences . states . fastaccess_old new = self . sequences . states . fastaccess_new if der . kb <= 0. : new . qbga = new . qbgz elif der . kb > 1e200 : new . qbga = old . qbga + new . qbgz - old . qbgz else : d_temp = ( 1. - modelutils . exp ( - 1. / der . kb ) ) new . qbga = ( old . qbga + ( old . qbgz - old . qbga ) * d_temp + ( new . qbgz - old . qbgz ) * ( 1. - der . kb * d_temp ) )
Perform the runoff concentration calculation for base flow .
455
def calc_qiga1_v1 ( self ) : der = self . parameters . derived . fastaccess old = self . sequences . states . fastaccess_old new = self . sequences . states . fastaccess_new if der . ki1 <= 0. : new . qiga1 = new . qigz1 elif der . ki1 > 1e200 : new . qiga1 = old . qiga1 + new . qigz1 - old . qigz1 else : d_temp = ( 1. - modelutils . exp ( - 1. / der . ki1 ) ) new . qiga1 = ( old . qiga1 + ( old . qigz1 - old . qiga1 ) * d_temp + ( new . qigz1 - old . qigz1 ) * ( 1. - der . ki1 * d_temp ) )
Perform the runoff concentration calculation for the first interflow component .
456
def calc_qiga2_v1 ( self ) : der = self . parameters . derived . fastaccess old = self . sequences . states . fastaccess_old new = self . sequences . states . fastaccess_new if der . ki2 <= 0. : new . qiga2 = new . qigz2 elif der . ki2 > 1e200 : new . qiga2 = old . qiga2 + new . qigz2 - old . qigz2 else : d_temp = ( 1. - modelutils . exp ( - 1. / der . ki2 ) ) new . qiga2 = ( old . qiga2 + ( old . qigz2 - old . qiga2 ) * d_temp + ( new . qigz2 - old . qigz2 ) * ( 1. - der . ki2 * d_temp ) )
Perform the runoff concentration calculation for the second interflow component .
457
def calc_qdga1_v1 ( self ) : der = self . parameters . derived . fastaccess old = self . sequences . states . fastaccess_old new = self . sequences . states . fastaccess_new if der . kd1 <= 0. : new . qdga1 = new . qdgz1 elif der . kd1 > 1e200 : new . qdga1 = old . qdga1 + new . qdgz1 - old . qdgz1 else : d_temp = ( 1. - modelutils . exp ( - 1. / der . kd1 ) ) new . qdga1 = ( old . qdga1 + ( old . qdgz1 - old . qdga1 ) * d_temp + ( new . qdgz1 - old . qdgz1 ) * ( 1. - der . kd1 * d_temp ) )
Perform the runoff concentration calculation for slow direct runoff .
458
def calc_qdga2_v1 ( self ) : der = self . parameters . derived . fastaccess old = self . sequences . states . fastaccess_old new = self . sequences . states . fastaccess_new if der . kd2 <= 0. : new . qdga2 = new . qdgz2 elif der . kd2 > 1e200 : new . qdga2 = old . qdga2 + new . qdgz2 - old . qdgz2 else : d_temp = ( 1. - modelutils . exp ( - 1. / der . kd2 ) ) new . qdga2 = ( old . qdga2 + ( old . qdgz2 - old . qdga2 ) * d_temp + ( new . qdgz2 - old . qdgz2 ) * ( 1. - der . kd2 * d_temp ) )
Perform the runoff concentration calculation for fast direct runoff .
459
def calc_q_v1 ( self ) : con = self . parameters . control . fastaccess flu = self . sequences . fluxes . fastaccess sta = self . sequences . states . fastaccess aid = self . sequences . aides . fastaccess flu . q = sta . qbga + sta . qiga1 + sta . qiga2 + sta . qdga1 + sta . qdga2 if ( not con . negq ) and ( flu . q < 0. ) : d_area = 0. for k in range ( con . nhru ) : if con . lnk [ k ] in ( FLUSS , SEE ) : d_area += con . fhru [ k ] if d_area > 0. : for k in range ( con . nhru ) : if con . lnk [ k ] in ( FLUSS , SEE ) : flu . evi [ k ] += flu . q / d_area flu . q = 0. aid . epw = 0. for k in range ( con . nhru ) : if con . lnk [ k ] == WASSER : flu . q += con . fhru [ k ] * flu . nkor [ k ] aid . epw += con . fhru [ k ] * flu . evi [ k ] if ( flu . q > aid . epw ) or con . negq : flu . q -= aid . epw elif aid . epw > 0. : for k in range ( con . nhru ) : if con . lnk [ k ] == WASSER : flu . evi [ k ] *= flu . q / aid . epw flu . q = 0.
Calculate the final runoff .
460
def calc_outputs_v1 ( self ) : con = self . parameters . control . fastaccess der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess for pdx in range ( 1 , der . nmbpoints ) : if con . xpoints [ pdx ] > flu . input : break for bdx in range ( der . nmbbranches ) : flu . outputs [ bdx ] = ( ( flu . input - con . xpoints [ pdx - 1 ] ) * ( con . ypoints [ bdx , pdx ] - con . ypoints [ bdx , pdx - 1 ] ) / ( con . xpoints [ pdx ] - con . xpoints [ pdx - 1 ] ) + con . ypoints [ bdx , pdx - 1 ] )
Performs the actual interpolation or extrapolation .
461
def pick_input_v1 ( self ) : flu = self . sequences . fluxes . fastaccess inl = self . sequences . inlets . fastaccess flu . input = 0. for idx in range ( inl . len_total ) : flu . input += inl . total [ idx ] [ 0 ]
Updates |Input| based on |Total| .
462
def pass_outputs_v1 ( self ) : der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess out = self . sequences . outlets . fastaccess for bdx in range ( der . nmbbranches ) : out . branched [ bdx ] [ 0 ] += flu . outputs [ bdx ]
Updates |Branched| based on |Outputs| .
463
def connect ( self ) : nodes = self . element . inlets total = self . sequences . inlets . total if total . shape != ( len ( nodes ) , ) : total . shape = len ( nodes ) for idx , node in enumerate ( nodes ) : double = node . get_double ( 'inlets' ) total . set_pointer ( double , idx ) for ( idx , name ) in enumerate ( self . nodenames ) : try : outlet = getattr ( self . element . outlets , name ) double = outlet . get_double ( 'outlets' ) except AttributeError : raise RuntimeError ( f'Model {objecttools.elementphrase(self)} tried ' f'to connect to an outlet node named `{name}`, ' f'which is not an available outlet node of element ' f'`{self.element.name}`.' ) self . sequences . outlets . branched . set_pointer ( double , idx )
Connect the |LinkSequence| instances handled by the actual model to the |NodeSequence| instances handled by one inlet node and multiple oulet nodes .
464
def update ( self ) : pars = self . subpars . pars responses = pars . control . responses fluxes = pars . model . sequences . fluxes self ( len ( responses ) ) fluxes . qpin . shape = self . value fluxes . qpout . shape = self . value fluxes . qma . shape = self . value fluxes . qar . shape = self . value
Determine the number of response functions .
465
def update ( self ) : responses = self . subpars . pars . control . responses self . shape = len ( responses ) self ( responses . ar_orders )
Determine the total number of AR coefficients .
466
def update ( self ) : pars = self . subpars . pars coefs = pars . control . responses . ar_coefs self . shape = coefs . shape self ( coefs ) pars . model . sequences . logs . logout . shape = self . shape
Determine all AR coefficients .
467
def update ( self ) : pars = self . subpars . pars coefs = pars . control . responses . ma_coefs self . shape = coefs . shape self ( coefs ) pars . model . sequences . logs . login . shape = self . shape
Determine all MA coefficients .
468
def __getiterable ( value ) : if isinstance ( value , Selection ) : return [ value ] try : for selection in value : if not isinstance ( selection , Selection ) : raise TypeError return list ( value ) except TypeError : raise TypeError ( f'Binary operations on Selections objects are defined for ' f'other Selections objects, single Selection objects, or ' f'iterables containing `Selection` objects, but the type of ' f'the given argument is `{objecttools.classname(value)}`.' )
Try to convert the given argument to a |list| of |Selection| objects and return it .
469
def search_upstream ( self , device : devicetools . Device , name : str = 'upstream' ) -> 'Selection' : try : selection = Selection ( name ) if isinstance ( device , devicetools . Node ) : node = self . nodes [ device . name ] return self . __get_nextnode ( node , selection ) if isinstance ( device , devicetools . Element ) : element = self . elements [ device . name ] return self . __get_nextelement ( element , selection ) raise TypeError ( f'Either a `Node` or an `Element` object is required ' f'as the "outlet device", but the given `device` value ' f'is of type `{objecttools.classname(device)}`.' ) except BaseException : objecttools . augment_excmessage ( f'While trying to determine the upstream network of ' f'selection `{self.name}`' )
Return the network upstream of the given starting point including the starting point itself .
470
def select_upstream ( self , device : devicetools . Device ) -> 'Selection' : upstream = self . search_upstream ( device ) self . nodes = upstream . nodes self . elements = upstream . elements return self
Restrict the current selection to the network upstream of the given starting point including the starting point itself .
471
def search_modeltypes ( self , * models : ModelTypesArg , name : str = 'modeltypes' ) -> 'Selection' : try : typelist = [ ] for model in models : if not isinstance ( model , modeltools . Model ) : model = importtools . prepare_model ( model ) typelist . append ( type ( model ) ) typetuple = tuple ( typelist ) selection = Selection ( name ) for element in self . elements : if isinstance ( element . model , typetuple ) : selection . elements += element return selection except BaseException : values = objecttools . enumeration ( models ) classes = objecttools . enumeration ( objecttools . classname ( model ) for model in models ) objecttools . augment_excmessage ( f'While trying to determine the elements of selection ' f'`{self.name}` handling the model defined by the ' f'argument(s) `{values}` of type(s) `{classes}`' )
Return a |Selection| object containing only the elements currently handling models of the given types .
472
def search_nodenames ( self , * substrings : str , name : str = 'nodenames' ) -> 'Selection' : try : selection = Selection ( name ) for node in self . nodes : for substring in substrings : if substring in node . name : selection . nodes += node break return selection except BaseException : values = objecttools . enumeration ( substrings ) objecttools . augment_excmessage ( f'While trying to determine the nodes of selection ' f'`{self.name}` with names containing at least one ' f'of the given substrings `{values}`' )
Return a new selection containing all nodes of the current selection with a name containing at least one of the given substrings .
473
def search_elementnames ( self , * substrings : str , name : str = 'elementnames' ) -> 'Selection' : try : selection = Selection ( name ) for element in self . elements : for substring in substrings : if substring in element . name : selection . elements += element break return selection except BaseException : values = objecttools . enumeration ( substrings ) objecttools . augment_excmessage ( f'While trying to determine the elements of selection ' f'`{self.name}` with names containing at least one ' f'of the given substrings `{values}`' )
Return a new selection containing all elements of the current selection with a name containing at least one of the given substrings .
474
def copy ( self , name : str ) -> 'Selection' : return type ( self ) ( name , copy . copy ( self . nodes ) , copy . copy ( self . elements ) )
Return a new |Selection| object with the given name and copies of the handles |Nodes| and |Elements| objects based on method |Devices . copy| .
475
def save_networkfile ( self , filepath : Union [ str , None ] = None , write_nodes : bool = True ) -> None : if filepath is None : filepath = self . name + '.py' with open ( filepath , 'w' , encoding = "utf-8" ) as file_ : file_ . write ( '# -*- coding: utf-8 -*-\n' ) file_ . write ( '\nfrom hydpy import Node, Element\n\n' ) if write_nodes : for node in self . nodes : file_ . write ( '\n' + repr ( node ) + '\n' ) file_ . write ( '\n' ) for element in self . elements : file_ . write ( '\n' + repr ( element ) + '\n' )
Save the selection as a network file .
476
def calc_qpin_v1 ( self ) : der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess for idx in range ( der . nmb - 1 ) : if flu . qin < der . maxq [ idx ] : flu . qpin [ idx ] = 0. elif flu . qin < der . maxq [ idx + 1 ] : flu . qpin [ idx ] = flu . qin - der . maxq [ idx ] else : flu . qpin [ idx ] = der . diffq [ idx ] flu . qpin [ der . nmb - 1 ] = max ( flu . qin - der . maxq [ der . nmb - 1 ] , 0. )
Calculate the input discharge portions of the different response functions .
477
def calc_login_v1 ( self ) : der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess log = self . sequences . logs . fastaccess for idx in range ( der . nmb ) : for jdx in range ( der . ma_order [ idx ] - 2 , - 1 , - 1 ) : log . login [ idx , jdx + 1 ] = log . login [ idx , jdx ] for idx in range ( der . nmb ) : log . login [ idx , 0 ] = flu . qpin [ idx ]
Refresh the input log sequence for the different MA processes .
478
def calc_qma_v1 ( self ) : der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess log = self . sequences . logs . fastaccess for idx in range ( der . nmb ) : flu . qma [ idx ] = 0. for jdx in range ( der . ma_order [ idx ] ) : flu . qma [ idx ] += der . ma_coefs [ idx , jdx ] * log . login [ idx , jdx ]
Calculate the discharge responses of the different MA processes .
479
def calc_qar_v1 ( self ) : der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess log = self . sequences . logs . fastaccess for idx in range ( der . nmb ) : flu . qar [ idx ] = 0. for jdx in range ( der . ar_order [ idx ] ) : flu . qar [ idx ] += der . ar_coefs [ idx , jdx ] * log . logout [ idx , jdx ]
Calculate the discharge responses of the different AR processes .
480
def calc_qpout_v1 ( self ) : der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess for idx in range ( der . nmb ) : flu . qpout [ idx ] = flu . qma [ idx ] + flu . qar [ idx ]
Calculate the ARMA results for the different response functions .
481
def calc_logout_v1 ( self ) : der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess log = self . sequences . logs . fastaccess for idx in range ( der . nmb ) : for jdx in range ( der . ar_order [ idx ] - 2 , - 1 , - 1 ) : log . logout [ idx , jdx + 1 ] = log . logout [ idx , jdx ] for idx in range ( der . nmb ) : if der . ar_order [ idx ] > 0 : log . logout [ idx , 0 ] = flu . qpout [ idx ]
Refresh the log sequence for the different AR processes .
482
def calc_qout_v1 ( self ) : der = self . parameters . derived . fastaccess flu = self . sequences . fluxes . fastaccess flu . qout = 0. for idx in range ( der . nmb ) : flu . qout += flu . qpout [ idx ]
Sum up the results of the different response functions .
483
def update ( self ) : con = self . subpars . pars . control self ( con . ypoints . shape [ 0 ] )
Determine the number of branches
484
def update ( self ) : mod = self . subpars . pars . model con = mod . parameters . control flu = mod . sequences . fluxes flu . h = con . hm mod . calc_qg ( ) self ( flu . qg )
Update value based on the actual |calc_qg_v1| method .
485
def update ( self ) : pars = self . subpars . pars self ( int ( round ( pars . control . lag ) ) ) pars . model . sequences . states . qjoints . shape = self + 1
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 .
486
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 ) : global WAIT , RECYCLE , DETACH , VIEW model = read_model ( data , enc = enc , delimiter = delimiter , hdr_rows = hdr_rows , idx_cols = idx_cols , sheet_index = sheet_index , transpose = transpose ) if model is None : warnings . warn ( "cannot visualize the supplied data type: {}" . format ( type ( data ) ) , category = RuntimeWarning ) return None if wait is None : wait = WAIT if recycle is None : recycle = RECYCLE if detach is None : detach = DETACH if wait is None : if 'matplotlib' not in sys . modules : wait = not bool ( detach ) else : import matplotlib . pyplot as plt wait = not plt . isinteractive ( ) if metavar is None : if isinstance ( data , basestring ) : metavar = data else : metavar = _varname_in_stack ( data , 1 ) if VIEW is None : if not detach : VIEW = ViewController ( ) else : VIEW = DetachedViewController ( ) VIEW . setDaemon ( True ) VIEW . start ( ) if VIEW . is_detached ( ) : atexit . register ( VIEW . exit ) else : VIEW = None return None view_kwargs = { 'hdr_rows' : hdr_rows , 'idx_cols' : idx_cols , 'start_pos' : start_pos , 'metavar' : metavar , 'title' : title } VIEW . view ( model , view_kwargs , wait = wait , recycle = recycle ) return VIEW
View the supplied data in an interactive graphical table widget .
487
def gather_registries ( ) -> Tuple [ Dict , Mapping , Mapping ] : id2devices = copy . copy ( _id2devices ) registry = copy . copy ( _registry ) selection = copy . copy ( _selection ) dict_ = globals ( ) dict_ [ '_id2devices' ] = { } dict_ [ '_registry' ] = { Node : { } , Element : { } } dict_ [ '_selection' ] = { Node : { } , Element : { } } return id2devices , registry , selection
Get and clear the current |Node| and |Element| registries .
488
def reset_registries ( dicts : Tuple [ Dict , Mapping , Mapping ] ) : dict_ = globals ( ) dict_ [ '_id2devices' ] = dicts [ 0 ] dict_ [ '_registry' ] = dicts [ 1 ] dict_ [ '_selection' ] = dicts [ 2 ]
Reset the current |Node| and |Element| registries .
489
def startswith ( self , name : str ) -> List [ str ] : return sorted ( keyword for keyword in self if keyword . startswith ( name ) )
Return a list of all keywords starting with the given string .
490
def endswith ( self , name : str ) -> List [ str ] : return sorted ( keyword for keyword in self if keyword . endswith ( name ) )
Return a list of all keywords ending with the given string .
491
def contains ( self , name : str ) -> List [ str ] : return sorted ( keyword for keyword in self if name in keyword )
Return a list of all keywords containing the given string .
492
def update ( self , * names : Any ) -> None : _names = [ str ( name ) for name in names ] self . _check_keywords ( _names ) super ( ) . update ( _names )
Before updating the given names are checked to be valid variable identifiers .
493
def add ( self , name : Any ) -> None : self . _check_keywords ( [ str ( name ) ] ) super ( ) . add ( str ( name ) )
Before adding a new name it is checked to be valid variable identifiers .
494
def add_device ( self , device : Union [ DeviceType , str ] ) -> None : try : if self . mutable : _device = self . get_contentclass ( ) ( device ) self . _name2device [ _device . name ] = _device _id2devices [ _device ] [ id ( self ) ] = self else : raise RuntimeError ( f'Adding devices to immutable ' f'{objecttools.classname(self)} objects is not allowed.' ) except BaseException : objecttools . augment_excmessage ( f'While trying to add the device `{device}` to a ' f'{objecttools.classname(self)} object' )
Add the given |Node| or |Element| object to the actual |Nodes| or |Elements| object .
495
def remove_device ( self , device : Union [ DeviceType , str ] ) -> None : try : if self . mutable : _device = self . get_contentclass ( ) ( device ) try : del self . _name2device [ _device . name ] except KeyError : raise ValueError ( f'The actual {objecttools.classname(self)} ' f'object does not handle such a device.' ) del _id2devices [ _device ] [ id ( self ) ] else : raise RuntimeError ( f'Removing devices from immutable ' f'{objecttools.classname(self)} objects is not allowed.' ) except BaseException : objecttools . augment_excmessage ( f'While trying to remove the device `{device}` from a ' f'{objecttools.classname(self)} object' )
Remove the given |Node| or |Element| object from the actual |Nodes| or |Elements| object .
496
def keywords ( self ) -> Set [ str ] : return set ( keyword for device in self for keyword in device . keywords if keyword not in self . _shadowed_keywords )
A set of all keywords of all handled devices .
497
def copy ( self : DevicesTypeBound ) -> DevicesTypeBound : new = type ( self ) ( ) vars ( new ) . update ( vars ( self ) ) vars ( new ) [ '_name2device' ] = copy . copy ( self . _name2device ) vars ( new ) [ '_shadowed_keywords' ] . clear ( ) for device in self : _id2devices [ device ] [ id ( new ) ] = new return new
Return a shallow copy of the actual |Nodes| or |Elements| object .
498
def prepare_allseries ( self , ramflag : bool = True ) -> None : self . prepare_simseries ( ramflag ) self . prepare_obsseries ( ramflag )
Call methods |Node . prepare_simseries| and |Node . prepare_obsseries| .
499
def prepare_simseries ( self , ramflag : bool = True ) -> None : for node in printtools . progressbar ( self ) : node . prepare_simseries ( ramflag )
Call method |Node . prepare_simseries| of all handled |Node| objects .