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, 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)
Exemplo n.º 3
0
    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
Exemplo n.º 4
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)
Exemplo n.º 5
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)