def _append_initializer_array_types(self, array_types): # for each array_types, use the name to get the associated initializer for name in array_types: for spill in self.spills: if spill.has_initializer(name): self._append_array_types( spill.get_initializer(name).array_types)
def _append_initializer_array_types(self, array_types): # for each array_types, use the name to get the associated initializer for name in array_types: for spill in self.spills: if spill.has_initializer(name): self._append_array_types(spill.get_initializer(name). array_types)
def prepare_for_model_run(self, array_types={}): """ called when setting up the model prior to 1st time step This is considered 0th timestep by model Make current_time optional since SpillContainer doesn't require it especially for 0th step; however, the model needs to set it because it will write_output() after each step. The data_arrays along with the current_time_stamp must be set in order to write_output() :param model_start_time: model_start_time to initialize current_time_stamp. This is the time_stamp associated with 0-th step so initial conditions for data arrays :param array_types: a dict of additional array_types to append to standard array_types attribute. The data_arrays are initialized and appended based on the values of array_types attribute .. note:: The SpillContainer cycles through each of the keys in array_types and checks to see if there is an associated initializer in each Spill. If a corresponding initializer is found, it gets the array_types from initializer and appends them to its own list. For most initializers like """ # Question - should we purge any new arrays that were added in previous # call to prepare_for_model_run()? # No! If user made modifications to _array_types before running model, # let's keep those. A rewind will reset data_arrays. self._array_types.update(array_types) # for each array_types, use the key to get the associated initializer for key in array_types: for spill in self.spills: if spill.is_initializer(key): self._array_types.update( spill.get_initializer(key).array_types) self.initialize_data_arrays() # remake() spills ordered collection self.spills.remake()