def requirement(self, timestep, scenario_index, default=None): """ Calculate a custom IFR other than the baseline IFR :param timestep: :param scenario_index: :return: """ scenario_name = None if self.ifrs_idx is not None: scenario_name = self.ifr_names[scenario_index.indices[ self.ifrs_idx]] flow_range = 1e9 if scenario_name == 'No IFRs': pass elif scenario_name == 'Functional Flows' and self.ifr_type == 'enhanced': flow_range = self.functional_flows_range(timestep, scenario_index) elif default: flow_range = default(timestep, scenario_index) flow_range_mcm = convert(flow_range, "m^3 s^-1", "m^3 day^-1", scale_in=1, scale_out=1000000.0) return flow_range_mcm
def value(self, timestep, scenario_index): val = self.requirement(timestep, scenario_index, default=self._value) return convert(val, "m^3 s^-1", "m^3 day^-1", scale_in=1, scale_out=1000000.0)
def value(self, *args, **kwargs): val = self._value(*args, **kwargs) return convert(val, "m^3 s^-1", "m^3 day^-1", scale_in=1, scale_out=1000000.0)
def value(self, timestep, scenario_index): val = self._value(timestep, scenario_index) return convert(val, "m^3 s^-1", "m^3 day^-1", scale_in=1, scale_out=1000000.0)
def value(self, timestep, scenario_index): try: return convert(self._value(timestep, scenario_index), "m^3 s^-1", "m^3 day^-1", scale_in=1, scale_out=1000000.0) except Exception as err: print('\nERROR for parameter {}'.format(self.name)) print('File where error occurred: {}'.format(__file__)) print(err)
def _value(self, timestep, scenario_index): management = 'BAU' path = "Management/{mgt}/IFRs/IFRblBearDiv.csv".format(mgt=management) data = self.read_csv(path, usecols=[0,1,2,3,4,5], index_col=0, header=None, names=['week','1','2','3','4','5'], parse_dates=False) WYT = self.model.parameters['WYT_SJValley'].value(timestep, scenario_index) week = min(timestep.datetime.weekofyear, 52) ifr = data[str(WYT)][week] return convert(ifr, 'ft^3 s^-1', 'hm^3 day^-1')
def value(self, *args, **kwargs): try: val = self._value(*args, **kwargs) return convert(val, "m^3 s^-1", "m^3 day^-1", scale_in=1, scale_out=1000000.0) except Exception as err: print('\nERROR for parameter {}'.format(self.name)) print('File where error occurred: {}'.format(__file__)) print(err) raise
def _value(self, timestep, scenario_index): return convert(0.3, 'ft^3 s^-1', 'hm^3 day^-1')
def _value(self, timestep, scenario_index): capacity = 160 # cfs return convert(capacity, "ft^3 s^-1", "m^3 day^-1", 1, 1e6)