Example #1
0
    def __init__(self, params: dict):
        """
        Constructor
        """
        # Record parameters
        self.params.update(params)

        logger.setLevel(self.params['verbose'])
        ch.setLevel(self.params['verbose'])
        logger.addHandler(ch)
        self._validate_setup()
        logger.info("read_domain")
        self.domain = io.read_domain(self.params)
        self._normalize_times()
        logger.info("read_met_data")
        self.met_data = io.read_met_data(self.params, self.domain)
        self._validate_force_times(force_times=self.met_data['time'])
        logger.info("read_state")
        self.state = io.read_state(self.params, self.domain)
        self.met_data['elev'] = self.domain['elev']
        self.met_data['lat'] = self.domain['lat']
        logger.info("_aggregate_state")
        self._aggregate_state()
        logger.info("load_inputs")
        self.load_inputs()
Example #2
0
 def met_data(self):
     if self._met_data is None:
         if self.domain is None:
             self._domain = io.read_domain(
                 self.params).isel(**self._domain_slice)
         self._met_data = io.read_met_data(self.params, self._domain)
         self._met_data['elev'] = self.domain['elev']
         self._met_data['lat'] = self.domain['lat']
         self._met_data['lon'] = self.domain['lon']
         self._validate_force_times(force_times=self._met_data['time'])
     return self._met_data
Example #3
0
    def met_data(self):
        if self._met_data is None:
            self._met_data = io.read_met_data(self.params, self.domain)
            self._met_data['elev'] = self.domain['elev']
            self._met_data['lat'] = self.domain['lat']
            self._met_data['lon'] = self.domain['lon']

            # process constant_vars
            constant_vars = self.params.get('constant_vars', None)
            if constant_vars:
                da_template = self._met_data[list(self._met_data)[0]]
                for var in constant_vars.keys():
                    self._met_data[var] = xr.full_like(
                        da_template, float(constant_vars[var]))

            self._validate_force_times(force_times=self._met_data['time'])
        return self._met_data