def a_priori_shape(t): transformation = Atanh() transformation.z_max = 1.2 transformation.z_min = 0.0 x = np.maximum(np.minimum(0.7 - (270 - t) / 100.0, 0.7), 0.2) x = 0.5 * np.ones(t.shape) return transformation(x)
def __init__(self, covariance, mask=None, mask_value=1e-12): super().__init__("H2O", covariance) self.mask = mask self.mask_value = mask_value self.transformation = Atanh() self.transformation.z_max = 1.1 self.transformation.z_min = 0.0
def _setup_retrieval(self): """ Setup the parts simulation used to perform the retrieval. """ for q in self.hydrometeors: limit_low_1, limit_low_2 = q.limits_low if hasattr(q, "limits_high"): limit_high_1, limit_high_2 = q.limits_high else: limit_high_1, limit_high_2 = np.inf, np.inf md = q.moments[0] self.simulation.retrieval.add(md) md.transformation = q.transformations[0] md.retrieval.limit_low = q.limits_low[0] md.retrieval.limit_high = limit_high_1 n0 = q.moments[1] self.simulation.retrieval.add(n0) n0.transformation = q.transformations[1] n0.retrieval.limit_low = q.limits_low[1] n0.retrieval.limit_high = limit_high_2 h2o = self.simulation.atmosphere.absorbers[-1] h2o_a = [p for p in self.data_provider.subproviders \ if getattr(p, "name", "") == "H2O"] if len(h2o_a) > 0: h2o_a = h2o_a[0] self.simulation.retrieval.add(h2o) atanh = Atanh(0.0, 1.1) h2o.transformation = h2o_a.transformation h2o.retrieval.unit = RelativeHumidity() self.h2o = h2o else: self.h2o = None if self.include_cloud_water: cw_a = [p for p in self.data_provider.subproviders \ if getattr(p, "name", "") == "cloud_water"][0] cw = self.simulation.atmosphere.absorbers[-2] self.simulation.retrieval.add(cw) pl = PiecewiseLinear(cw_a) cw.transformation = Composition(Log10(), pl) cw.retrieval.limit_high = -3 self.cw = cw else: self.cw = None t_a = [p for p in self.data_provider.subproviders \ if getattr(p, "name", "") == "temperature"] if len(t_a) > 0: t = self.simulation.atmosphere.temperature self.temperature = t self.simulation.retrieval.add(self.temperature) else: self.temperature = None
def a_priori_shape(t): transformation = Atanh() transformation.z_max = upper_limit transformation.z_min = lower_limit x = np.maximum(np.minimum(0.8 - (270 - t) / 100.0, 0.7), 0.1) return transformation(x)
rh_mask = AltitudeMask(-1, 20e3) rh_covariance = Diagonal(1.0, mask=rh_mask) rh_covariance = SpatialCorrelation(rh_covariance, 2e3, mask=rh_mask) rh_a_priori = FunctionalAPriori("H2O", "temperature", a_priori_shape, rh_covariance, mask=rh_mask, mask_value=-100) rh_a_priori = MaskedRegularGrid(rh_a_priori, 21, rh_mask, quantity="altitude", provide_retrieval_grid=False) rh_a_priori.unit = "rh" rh_a_priori.transformation = Composition(Atanh(lower_limit, upper_limit), PiecewiseLinear(rh_a_priori)) ################################################################################ # Observation error ################################################################################ class ObservationError(DataProviderBase): """ Observation error covariance matrix provider for the LIRAS study. This class works in the same way as the :class:`SensorNoiseAPriori` class parts, which means that it takes the :code:`nedt` attributes of the given sensors and concatenates these vectors into a combined diagonal matrix.
rh_mask = AltitudeMask(-1, 20e3) rh_covariance = Diagonal(0.5, mask=rh_mask) rh_covariance = SpatialCorrelation(rh_covariance, 2e3) rh_a_priori = FunctionalAPriori("H2O", "temperature", a_priori_shape, rh_covariance, mask=rh_mask, mask_value=-100) rh_a_priori = MaskedRegularGrid(rh_a_priori, 21, rh_mask, quantity="altitude", provide_retrieval_grid=False) rh_a_priori.unit = "rh" rh_a_priori.transformation = Composition(Atanh(0.0, 1.1), PiecewiseLinear(rh_a_priori)) ################################################################################ # Observation error ################################################################################ class ObservationError(DataProviderBase): """ Observation error covariance matrix provider for the LIRAS study. This class works in the same way as the :class:`SensorNoiseAPriori` class parts, which means that it takes the :code:`nedt` attributes of the given sensors and concatenates these vectors into a combined diagonal matrix.
cloud_water_a_priori = FixedAPriori("cloud_water", -6, liquid_covariance, mask = liquid_mask, mask_value = -20) cloud_water_a_priori = ReferenceAPriori("cloud_water", liquid_covariance, mask = liquid_mask, mask_value = -20, a_priori = cloud_water_a_priori, transformation = Log10()) cloud_water_a_priori = MaskedRegularGrid(cloud_water_a_priori, 7, liquid_mask, "altitude", provide_retrieval_grid = False) ################################################################################ # Humidity ################################################################################ def a_priori_shape(t): transformation = Atanh() transformation.z_max = 1.2 transformation.z_min = 0.0 x = np.maximum(np.minimum(0.7 - (270 - t) / 100.0, 0.7), 0.2) x = 0.5 * np.ones(t.shape) return transformation(x) z_grid = np.linspace(0, 20e3, 21) rh_covariance = Diagonal(1.0) rh_covariance = SpatialCorrelation(rh_covariance, 2e3) rh_a_priori = FunctionalAPriori("H2O", "temperature", a_priori_shape, rh_covariance) rh_a_priori = ReferenceAPriori("H2O", rh_covariance, transformation = Atanh(0.0, 1.2), a_priori = rh_a_priori, variable = "relative_humidity") rh_a_priori = ReducedVerticalGrid(rh_a_priori, z_grid, "altitude", provide_retrieval_grid = False)
def a_priori_shape(t): transformation = Atanh() transformation.z_max = 1.1 transformation.z_min = 0.0 x = np.maximum(np.minimum(0.5 - (270 - t) / 100.0, 0.5), 0.1) return transformation(x)