mask=ice_mask, mask_value=4) ice_n0_a_priori = MaskedRegularGrid(ice_n0_a_priori, 20, ice_mask, "altitude", provide_retrieval_grid=False) # # Hydrometeor definition # ice = Hydrometeor("ice", D14NDmIce(), [ice_n0_a_priori, ice_dm_a_priori], ice_shape, ice_shape_meta) ice.transformations = [ Composition(Log10(), PiecewiseLinear(ice_n0_a_priori)), Identity() ] # Lower limits for N_0^* and m in transformed space. ice.limits_low = [2, 1e-8] ############################################################################### # Snow particles ############################################################################### snow_shape = os.path.join(scattering_data, "EvansSnowAggregate.xml") snow_shape_meta = os.path.join(scattering_data, "EvansSnowAggregate.meta.xml") snow_mask = And(AltitudeMask(0.0, 19e3), TemperatureMask(0.0, 276.0)) # # D_m
ice_covariance, mask=ice_mask, mask_value=1e-6) ice_dm_a_priori = ReducedVerticalGrid(ice_dm_a_priori, z_grid, "altitude", provide_retrieval_grid=False) # # Hydrometeor definition # ice = Hydrometeor("ice", D14NDmIce(), [ice_n0_a_priori, ice_dm_a_priori], ice_shape, ice_shape_meta) ice.transformations = [ Composition(Log10(), PiecewiseLinear(ice_n0_a_priori)), Composition(Identity(), PiecewiseLinear(ice_dm_a_priori)) ] ice.limits_low = [4, 1e-8] ice.radar_only = False ################################################################################ # Snow particles ################################################################################ # Default shape snow_shape = os.path.join(scattering_data, "EvansSnowAggregate.xml") snow_shape_meta = os.path.join(scattering_data, "EvansSnowAggregate.meta.xml") snow_mask = And(TropopauseMask(), TemperatureMask(0.0, 280.0)) snow_covariance = Diagonal(4 * np.ones(md_z_grid.size))
# ice_mask, # "altitude", # provide_retrieval_grid=False) #ice_dm_a_priori = ReducedVerticalGrid(ice_dm_a_priori, # z_grid, # "altitude", # provide_retrieval_grid=False) # # Hydrometeor definition. # ice = Hydrometeor("ice", D14NDmIce(), [ice_n0_a_priori, ice_dm_a_priori], ice_shape, ice_shape_meta) ice.transformations = [ Composition(Log10(), PiecewiseLinear(ice_n0_a_priori)), Identity() #Composition(Identity(), PiecewiseLinear(ice_dm_a_priori)) ] ice.limits_low = [4, 1e-10] ice.radar_only = False ################################################################################ # Rain particles ################################################################################ rain_shape = os.path.join(scattering_data, "LiquidSphere.xml") rain_shape_meta = os.path.join(scattering_data, "LiquidSphere.meta.xml") # # water content #
ice_n0_a_priori = ReferenceAPriori("ice_n0", ice_covariance, mask=ice_mask, mask_value=2, a_priori=ice_n0_a_priori, transformation=Log10()) ice_n0_a_priori = MaskedRegularGrid(ice_n0_a_priori, 10, ice_mask, "altitude", provide_retrieval_grid=False) ice = Hydrometeor("ice", D14NDmIce(), [ice_n0_a_priori, ice_dm_a_priori], ice_shape, ice_shape_meta) ice.transformations = [ Composition(Log10(), PiecewiseLinear(ice_n0_a_priori)), Identity() ] ice.limits_low = [4, 1e-8] ice.psd.cutoff_low = [1e2, 1e-8] ################################################################################ # Snow particles ################################################################################ snow_shape = os.path.join(scattering_data, "8-ColumnAggregate.xml") snow_shape_meta = os.path.join(scattering_data, "8-ColumnAggregate.meta.xml") snow_mask = And(AltitudeMask(0.0, 19e3), TemperatureMask(0.0, 276.0)) snow_covariance = Diagonal(100e-6**2, mask=snow_mask, mask_value=1e-12) snow_covariance = SpatialCorrelation(snow_covariance, 2e3, mask=snow_mask)
def _setup_retrieval(self): """ Setup the artssat 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) if h2o_a.transformation is not None: h2o.transformation = h2o_a.transformation h2o.retrieval.unit = RelativeHumidity() if hasattr(h2o_a, "limit_low"): h2o.retrieval.limit_low = h2o_a.limit_low if hasattr(h2o_a, "limit_high"): h2o.retrieval.limit_high = h2o_a.limit_high 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