def prepare_for_model_run(self, model_time): if self.wind is None: msg = "wind object not defined for " + self.__class__.__name__ raise ReferencedObjectNotSet(msg) if self.water is None: msg = "water object not defined for " + self.__class__.__name__ raise ReferencedObjectNotSet(msg)
def prepare_for_model_run(self, _model_time): if self.wind is None: raise ReferencedObjectNotSet("wind object not defined for {}" .format(self.__class__.__name__)) if self.water is None: raise ReferencedObjectNotSet("water object not defined for {}" .format(self.__class__.__name__))
def prepare_for_model_run(self): ''' if wind attribute is not set, raise ReferencedObjectNotSet excpetion ''' super(WindMover, self).prepare_for_model_run() if self.on and self.wind is None: msg = "wind object not defined for WindMover" raise ReferencedObjectNotSet(msg)
def prepare_for_model_run(self, model_time): """ Make sure we are up to date with the referenced time series """ if self.wind is None: msg = "wind object not defined for WindMover" raise ReferencedObjectNotSet(msg) model_time = date_to_sec(model_time) self.create_running_average_timeseries(self._past_hours_to_average, model_time)
def prepare_for_model_run(self, sc): """ Override for weatherers so they can initialize correct 'mass_balance' key and set initial value to 0.0 """ if self.on: # almost all weatherers require wind, water, waves so raise # exception here if none is found for attr in ('wind', 'water', 'waves'): if hasattr(self, attr) and getattr(self, attr) is None: msg = (attr + " object not defined for " + self.__class__.__name__) raise ReferencedObjectNotSet(msg)