Example #1
0
    def dynamic(self,wd_date):
        """
        Dynamic part of the water demand module - domestic
        read monthly (or yearly) water demand from netcdf and transform (if necessary) to [m/day]

        """


        if self.var.domesticTime == 'monthly':
            new = 'newMonth'
        else:
            new = 'newYear'
        
        if globals.dateVar['newStart'] or globals.dateVar[new]:
            self.var.domesticDemand = readnetcdf2('domesticWaterDemandFile', wd_date, self.var.domesticTime, value=self.var.domWithdrawalVar)
            self.var.pot_domesticConsumption = readnetcdf2('domesticWaterDemandFile', wd_date, self.var.domesticTime, value=self.var.domConsumptionVar)
            # avoid small values (less than 1 m3):
            self.var.domesticDemand = np.where(self.var.domesticDemand > self.var.InvCellArea, self.var.domesticDemand, 0.0)
            self.var.pot_domesticConsumption = np.where(self.var.pot_domesticConsumption > self.var.InvCellArea, self.var.pot_domesticConsumption, 0.0)
            self.var.dom_efficiency = divideValues(self.var.pot_domesticConsumption, self.var.domesticDemand)


            # transform from mio m3 per year (or month) to m/day if necessary
            if not self.var.demand_unit:
                if self.var.domesticTime == 'monthly':
                    timediv= globals.dateVar['daysInMonth']
                else:
                    timediv = globals.dateVar['daysInYear']
                self.var.domesticDemand = self.var.domesticDemand * 1000000 * self.var.M3toM / timediv
                self.var.pot_domesticConsumption = self.var.pot_domesticConsumption * 1000000 * self.var.M3toM / timediv
Example #2
0
    def dynamic(self, wd_date):
        """
        Dynamic part of the water demand module - livestock
        read monthly (or yearly) water demand from netcdf and transform (if necessary) to [m/day]

        """
        if self.var.uselivestock:
            new = 'newYear'
            if self.var.livestockTime == 'monthly': new = 'newMonth'
            if globals.dateVar['newStart'] or globals.dateVar[new]:
                self.var.livestockDemand = readnetcdf2(
                    'livestockWaterDemandFile',
                    wd_date,
                    self.var.domesticTime,
                    value=self.var.livVar)
                # avoid small values (less than 1 m3):
                self.var.livestockDemand = np.where(
                    self.var.livestockDemand > self.var.InvCellArea,
                    self.var.livestockDemand, 0.0)
                self.var.pot_livestockConsumption = self.var.livestockDemand
                self.var.liv_efficiency = 1.

                # transform from mio m3 per year (or month) to m/day if necessary - if demand_unit = False -> transdform from mio m3 per month or year
                if not self.var.demand_unit:
                    if self.var.livestockTime == 'monthly':
                        timediv = globals.dateVar['daysInMonth']
                    else:
                        timediv = globals.dateVar['daysInYear']
                    self.var.livestockDemand = self.var.livestockDemand * 1000000 * self.var.M3toM / timediv
                    self.var.pot_livestockConsumption = self.var.livestockDemand

        else:
            self.var.livestockDemand = 0.
            self.var.pot_livestockConsumption = 0.
            self.var.liv_efficiency = 1.
Example #3
0
    def dynamic(self):
        """
        Dynamic part of the water demand module - environment
        read monthly (or yearly) water demand from netcdf and transform (if necessary) to [m/day]

        """
        if self.var.use_environflow:
            if globals.dateVar['newStart'] or globals.dateVar['newMonth']:
                # envflow in [m3/s] -> [m]
                self.var.envFlowm3s = readnetcdf2('EnvironmentalFlowFile', globals.dateVar['currDate'], "month", cut=self.var.cut_ef_map) # in [m3/s]
                self.var.envFlow = self.var.M3toM  * self.var.channelAlpha * self.var.chanLength * self.var.envFlowm3s ** 0.6 # in [m]
        else:
            self.var.envFlow = 0.00001  # 0.01mm