def ref_atm_data(self): if self.reference_atm_file() is not None: if not os.path.exists(self.reference_atm_file()): raise param.ParamError("Could not find reference atmosphere file supplied through config: %s" % self.reference_atm_file()) ref_atm_data = rf.HdfFile(self.reference_atm_file()) else: if not os.path.exists(DEFAULT_REFERENCE_ATM_FILENAME): raise param.ParamError("Could not find default reference atmosphere file: %s" % DEFAULT_REFERENCE_ATM_FILENAME) ref_atm_data = rf.HdfFile(DEFAULT_REFERENCE_ATM_FILENAME) return ref_atm_data
def create(self, **kwargs): solar_file = rf.HdfFile(self.solar_data_file()) absorption = [] for chan_index in range(self.num_channels()): absorption.append( rf.SolarAbsorptionTable(solar_file, "/Solar/Absorption/Absorption_%d" % (chan_index + 1)) ) return absorption
def create(self, **kwargs): solar_file = rf.HdfFile(self.solar_data_file()) continuum = [] for chan_index in range(self.num_channels()): continuum.append( rf.SolarContinuumTable(solar_file, "/Solar/Continuum/Continuum_%d" % (chan_index + 1), self.convert_from_photon()) ) return continuum
def create(self, aerosol_name=None, **kwargs): aerosol_file = rf.HdfFile(self.filename()) if self.prop_name() is None: prop_name = aerosol_name else: prop_name = self.prop_name() return rf.AerosolPropertyHdf(aerosol_file, prop_name + "/Properties", self.pressure())
def create(self, **kwargs): # Just use LIDORT for multiple scattering, when we use LRadRt do_multiple_scattering_only = self.use_lrad() stokes_object = rf.StokesCoefficientConstant(self.stokes_coefficient()) # Minimum nmom allowed by LIDORT is 3 nmom_low = min(self.num_low_streams() * 2, 3) if (self.num_low_streams() == 1 and self.dedicated_twostream()): rt_low = rf.TwostreamRt( self.atmosphere(), stokes_object, self.solar_zenith().convert("deg").value, self.observation_zenith().convert("deg").value, self.observation_azimuth().convert("deg").value, self.full_quadrature()) else: rt_low = rf.LidortRt( self.atmosphere(), stokes_object, self.solar_zenith().convert("deg").value, self.observation_zenith().convert("deg").value, self.observation_azimuth().convert("deg").value, self.pure_nadir(), self.num_low_streams(), nmom_low, do_multiple_scattering_only) lidort_pars = rf.Lidort_Pars.instance() rt_high = rf.LidortRt(self.atmosphere(), stokes_object, self.solar_zenith().convert("deg").value, self.observation_zenith().convert("deg").value, self.observation_azimuth().convert("deg").value, self.pure_nadir(), self.num_high_streams(), lidort_pars.maxmoments_input, do_multiple_scattering_only) spectral_bound = self.spec_win().spectral_bound if self.use_lrad(): rt_low = rf.LRadRt(rt_low, spectral_bound, self.solar_zenith().convert("deg").value, self.observation_zenith().convert("deg").value, self.observation_azimuth().convert("deg").value, self.pure_nadir(), True, False) rt_high = rf.LRadRt( rt_high, spectral_bound, self.solar_zenith().convert("deg").value, self.observation_zenith().convert("deg").value, self.observation_azimuth().convert("deg").value, self.pure_nadir(), True, True) rt_high = rf.HresWrapper(rt_high) lsi_config = rf.HdfFile(self.lsi_config_file()) return rf.LsiRt(rt_low, rt_high, lsi_config, "LSI")
def retrieval_config_definition(l1b_file, met_file, sounding_id, **kwargs): l1b_obj = rf.HdfFile(l1b_file) observation_id = OcoSoundingId(l1b_obj, sounding_id) config_def = base_config_definition(**kwargs) config_def['input'] = { 'creator': creator.base.SaveToCommon, 'l1b': oco_level1b(l1b_obj, observation_id), 'met': oco_meteorology(met_file, observation_id), 'sounding_number': observation_id.sounding_number, } config_def['scenario'] = { 'creator': creator.scenario.ScenarioFromL1b, } config_def['spec_win']['bad_sample_mask'] = oco_bad_sample_mask( l1b_obj, observation_id) # Instrument values config_def['instrument']['ils_function'][ 'delta_lambda'] = ils_delta_lambda(l1b_obj, observation_id) config_def['instrument']['ils_function']['response'] = ils_response( l1b_obj, observation_id) # Reuse creator set up for determining albedo from the continuum level albedo_cont_level = { 'creator': creator.ground.AlbedoFromSignalLevel, 'signal_level': { 'creator': creator.l1b.ValueFromLevel1b, 'field': "signal", }, 'solar_strength': np.array([4.87e21, 2.096e21, 1.15e21]), 'solar_distance': { 'creator': creator.l1b.SolarDistanceFromL1b }, } # Lambertian value is directly the albedo level from the continuum config_def['atmosphere']['ground']['lambertian'][ 'value'] = albedo_cont_level # BRDF values is a modification of albedo level based on computed BRDF weight orig_brdf_params = config_def['atmosphere']['ground']['brdf']['value'] config_def['atmosphere']['ground']['brdf']['value'] = { 'creator': creator.ground.BrdfWeightFromContinuum, 'continuum_albedo': albedo_cont_level, 'brdf_parameters': orig_brdf_params, 'brdf_type': config_def['atmosphere']['ground']['brdf']['brdf_type'], } return config_def
def create(self, **kwargs): eof = [] for chan_idx in range(self.num_channels()): eof.append( rf.EmpiricalOrthogonalFunction(self.coeff()[chan_idx], self.used_flag()[chan_idx], self.dispersion()[chan_idx], rf.HdfFile(self.hdf_eof()), chan_idx, self.sounding_number(), self.order(), self.desc_band_name()[chan_idx], self.hdf_group())) return eof
def create(self, **kwargs): coeffs = self.value() flags = self.retrieval_flag() sounding_number = self.sounding_number() order = self.order() band_names = self.desc_band_name() hdf_group = self.hdf_group() scale_uncertainty = self.scale_uncertainty() scale_to_stddev = self.scale_to_stddev() l1b = self.l1b() if scale_uncertainty and scale_to_stddev is None: raise param.ParamError( "scale_to_stddev must be supplied when scale_uncertainty is True" ) if scale_uncertainty and l1b is None: raise param.ParamError( "l1b must be supplied when scale_uncertainty is True") eof_hdf = rf.HdfFile(self.eof_file()) eofs = [] for chan_idx in range(self.num_channels()): if (scale_uncertainty): chan_rad = l1b.radiance(chan_idx) uncert = rf.ArrayWithUnit_double_1(chan_rad.uncertainty, chan_rad.units) eof_obj = rf.EmpiricalOrthogonalFunction( coeffs[chan_idx], bool(flags[chan_idx]), eof_hdf, uncert, chan_idx, sounding_number, order, band_names[chan_idx], hdf_group, scale_to_stddev) else: eof_obj = rf.EmpiricalOrthogonalFunction( coeffs[chan_idx], bool(flags[chan_idx]), eof_hdf, chan_idx, sounding_number, order, band_names[chan_idx], hdf_group) eofs.append(eof_obj) return eofs