# N_0^* # rain_covariance = Diagonal(1, mask=rain_mask, mask_value=1e-12) rain_covariance = SpatialCorrelation(rain_covariance, 2e3, mask=ice_mask) rain_n0_a_priori = FixedAPriori("rain_n0", 7, rain_covariance, mask=rain_mask, mask_value=2) # # Hydrometeor definition # rain = Hydrometeor("rain", D14NDmLiquid(), [rain_n0_a_priori, rain_dm_a_priori], rain_shape, rain_shape_meta) rain.transformations = [ Log10(), Identity() ] rain.limits_low = [2, 1e-8] ############################################################################### # Liquid particles ############################################################################### liquid_mask = TemperatureMask(250.0, 300.0) liquid_covariance = Diagonal(0.5) liquid_covariance = SpatialCorrelation(liquid_covariance, 2e3)
rain_n0_a_priori = FixedAPriori("rain_n0", 7, rain_covariance, mask=rain_mask, mask_value=2) rain_n0_a_priori = MaskedRegularGrid(rain_n0_a_priori, 4, rain_mask, "altitude", provide_retrieval_grid=False) # # Hydrometeor definition # rain = Hydrometeor("rain", D14NDmLiquid(), [rain_n0_a_priori, rain_dm_a_priori], rain_shape, rain_shape_meta) rain.transformations = [ Composition(Log10(), PiecewiseLinear(rain_n0_a_priori)), Composition(Identity(), PiecewiseLinear(rain_dm_a_priori)) ] # Lower limits for N_0^* and m in transformed space. rain.limits_low = [2, 1e-8] rain.radar_only = True ############################################################################### # Liquid particles ############################################################################### liquid_mask = TemperatureMask(240.0, 300.0)
def get_reference_data(scene="a", i_start=3000, i_end=3800): """ Get reference data from cloud scene. Arguments: scene: From which scene to take the values ("a", "b") i_start: Start index of the scene i_end: End index of the scene """ n = i_end - i_start ice_psd = D14NDmIce() snow_psd = D14NDmSnow() liquid_psd = D14NDmLiquid() data_provider = ModelDataProvider(99, scene=scene.upper(), ice_psd=ice_psd, snow_psd=snow_psd, hail_psd=snow_psd, graupel_psd=snow_psd, liquid_psd=liquid_psd) z = data_provider.get_altitude(i_start) iwc, swc, gwc, hwc, lwc, rwc = np.zeros((6, n, z.size)) iwc_nd, swc_nd, gwc_nd, hwc_nd, lwc_nd, rwc_nd = np.zeros((6, n, z.size)) iwc_dm, swc_dm, gwc_dm, hwc_dm, lwc_dm, rwc_dm = np.zeros((6, n, z.size)) iwc_n0, swc_n0, gwc_n0, hwc_n0, lwc_n0, rwc_n0 = np.zeros((6, n, z.size)) lats, lons = np.zeros((2, n)) h2o = np.zeros((n, z.size)) temperature = np.zeros((n, z.size)) for i in range(i_start, i_end): j = i - i_start iwc[j, :] = data_provider.get_gem_ice_mass_density(i) swc[j, :] = data_provider.get_gem_snow_mass_density(i) hwc[j, :] = data_provider.get_gem_hail_mass_density(i) gwc[j, :] = data_provider.get_gem_graupel_mass_density(i) rwc[j, :] = data_provider.get_gem_rain_mass_density(i) lwc[j, :] = data_provider.get_gem_liquid_mass_density(i) iwc_nd[j, :] = data_provider.get_gem_ice_number_density(i) swc_nd[j, :] = data_provider.get_gem_snow_number_density(i) hwc_nd[j, :] = data_provider.get_gem_hail_number_density(i) gwc_nd[j, :] = data_provider.get_gem_graupel_number_density(i) rwc_nd[j, :] = data_provider.get_gem_rain_number_density(i) lwc_nd[j, :] = data_provider.get_gem_liquid_number_density(i) iwc_dm[j, :] = data_provider.get_ice_dm(i) swc_dm[j, :] = data_provider.get_snow_dm(i) hwc_dm[j, :] = data_provider.get_hail_dm(i) gwc_dm[j, :] = data_provider.get_graupel_dm(i) rwc_dm[j, :] = data_provider.get_rain_dm(i) lwc_dm[j, :] = data_provider.get_cloud_water_dm(i) iwc_n0[j, :] = data_provider.get_ice_n0(i) swc_n0[j, :] = data_provider.get_snow_n0(i) hwc_n0[j, :] = data_provider.get_hail_n0(i) gwc_n0[j, :] = data_provider.get_graupel_n0(i) rwc_n0[j, :] = data_provider.get_rain_n0(i) lwc_n0[j, :] = data_provider.get_cloud_water_n0(i) h2o[j, :] = data_provider.get_relative_humidity(i) lats[j] = data_provider.get_latitude(i) lons[j] = data_provider.get_longitude(i) temperature[j, :] = data_provider.get_temperature(i) return { "iwc": iwc, "iwc_nd": iwc_nd, "iwc_dm": iwc_dm, "iwc_n0": iwc_n0, "swc": swc, "swc_nd": swc_nd, "swc_dm": swc_dm, "swc_n0": swc_n0, "hwc": hwc, "hwc_nd": hwc_nd, "hwc_dm": hwc_dm, "hwc_n0": hwc_n0, "gwc": gwc, "gwc_nd": gwc_nd, "gwc_dm": gwc_dm, "gwc_n0": gwc_n0, "rwc": rwc, "rwc_nd": rwc_nd, "rwc_dm": rwc_dm, "rwc_n0": rwc_n0, "lwc": lwc, "lwc_nd": lwc_nd, "lwc_dm": lwc_dm, "lwc_n0": lwc_n0, "h2o": h2o, "lat": lats, "lon": lons, "z": z, "temperature": temperature }
rain_covariance = Diagonal(500e-6 ** 2, mask = rain_mask, mask_value = 1e-12) rain_dm_a_priori = FixedAPriori("rain_dm", 500e-6, rain_covariance, mask = rain_mask, mask_value = 1e-8) rain_dm_a_priori = ReferenceAPriori("rain_dm", rain_covariance, mask = rain_mask, mask_value = 1e-8, a_priori = rain_dm_a_priori, transformation = Identity()) rain_dm_a_priori = MaskedRegularGrid(rain_dm_a_priori, 10, rain_mask, "altitude", provide_retrieval_grid = False) z_grid = np.linspace(0, 12e3, 7) rain_covariance = Diagonal(1, mask = rain_mask, mask_value = 1e-12) rain_n0_a_priori = FixedAPriori("rain_n0", 7, rain_covariance, mask = rain_mask, mask_value = 2) rain_n0_a_priori = ReferenceAPriori("rain_n0", rain_covariance, mask = rain_mask, mask_value = 2, a_priori = rain_n0_a_priori, transformation = Log10()) rain_n0_a_priori = MaskedRegularGrid(rain_n0_a_priori, 4, rain_mask, "altitude", provide_retrieval_grid = False) rain = Hydrometeor("rain", D14NDmLiquid(), [rain_n0_a_priori, rain_dm_a_priori], rain_shape, rain_shape_meta) rain.transformations = [Composition(Log10(), PiecewiseLinear(rain_n0_a_priori)), Composition(Identity(), PiecewiseLinear(rain_dm_a_priori))] rain.limits_low = [4, 1e-8] rain.psd.cutoff_low = [1e2, 1e-8] ################################################################################ # Cloud liquid ################################################################################ liquid_mask = TemperatureMask(230, 273.0) liquid_covariance = Diagonal(1 ** 2) 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,