#NEWLINE# def initialize_time( self ) : #NEWLINE# #INDENT# '\n        Performs time resolution reduction, if set up in configuration\n\n        ' #NEWLINE# cr = self . config_run #NEWLINE# s = time_tools . TimeSummarizer ( ) #NEWLINE# time = cr . get_key ( 'time' , default = False ) #NEWLINE# if time : #NEWLINE# #INDENT# if ( ( ( 'masks' in time ) or ( 'resolution' in time ) ) and ( 'file' in time ) ) : #NEWLINE# #INDENT# e = exceptions . ModelError #NEWLINE# raise e ( '`time.masks` or `time.resolution` and `time.file` cannot be given at the same time.' ) #NEWLINE# #UNINDENT# if ( 'masks' in time ) : #NEWLINE# #INDENT# masks = [ ] #NEWLINE# for entry in time . masks : #NEWLINE# #INDENT# entry = utils . AttrDict ( entry ) #NEWLINE# mask_func = plugin_load ( entry . function , builtin_module = 'time_masks' ) #NEWLINE# mask_opts = entry . get_key ( 'options' , default = False ) #NEWLINE# if mask_opts : #NEWLINE# #INDENT# mask = mask_func ( self . data , ** mask_opts ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mask = mask_func ( self . data ) #NEWLINE# #UNINDENT# masks . append ( mask ) #NEWLINE# #UNINDENT# mask_res = time . get ( 'resolution' , None ) #NEWLINE# mask_drop_with_padding = time . get ( 'drop_with_padding' , None ) #NEWLINE# converter = time_tools . masks_to_resolution_series #NEWLINE# series = converter ( masks , how = 'or' , resolution = mask_res , drop_with_padding = mask_drop_with_padding ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'resolution' in time ) : #NEWLINE# #INDENT# if ( self . data . time_res_static == time . resolution ) : #NEWLINE# #INDENT# series = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# getter = time_tools . resolution_series_uniform #NEWLINE# series = getter ( self . data , time . resolution ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'file' in time ) : #NEWLINE# #INDENT# res_file = utils . relative_path ( cr . time . file , self . config_run_path ) #NEWLINE# series = pd . read_csv ( res_file , index_col = 0 , header = None ) [ 1 ] . astype ( int ) [ self . slice ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# series = None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( series is not None ) : #NEWLINE# #INDENT# s . dynamic_timestepper ( self . data , series ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return None