コード例 #1
0
    def __init__(self, config, instrument):

        TabularRT.__init__(self, config, instrument)

        self.modtran_dir = self.find_basedir(config)
        self.filtpath = os.path.join(self.lut_dir, 'wavelengths.flt')
        self.template = deepcopy(json_load_ascii(
            config['modtran_template_file'])['MODTRAN'])

        # Insert aerosol templates, if specified
        if 'aerosol_template_file' in config:
            self.template[0]['MODTRANINPUT']['AEROSOLS'] = \
                deepcopy(json_load_ascii(config['aerosol_template_file']))

        # Insert aerosol data, if specified
        if 'aerosol_model_file' in config:
            aer_data = s.loadtxt(config['aerosol_model_file'])
            self.aer_wl = aer_data[:, 0]
            aer_data = aer_data[:, 1:].T
            self.naer = int(len(aer_data)/3)
            aer_absc, aer_extc, aer_asym = [], [], []
            for i in range(self.naer):
                aer_extc.append(aer_data[i*3])
                aer_absc.append(aer_data[i*3+1])
                aer_asym.append(aer_data[i*3+2])
            self.aer_absc = s.array(aer_absc)
            self.aer_extc = s.array(aer_extc)
            self.aer_asym = s.array(aer_asym)

        # Build the lookup table
        self.build_lut(instrument)
コード例 #2
0
    def __init__(self, config, instrument):

        TabularRT.__init__(self, config, instrument)
        self.wl = instrument.wl
        self.fwhm = instrument.fwhm
        self.libradtran_dir = self.find_basedir(config)
        self.libradtran_template_file = config['libradtran_template_file']
        self.build_lut(instrument)
コード例 #3
0
    def __init__(self, config, instrument):

        TabularRT.__init__(self, config, instrument)

        self.modtran_dir = self.find_basedir(config)
        self.modtran_template = config['modtran_template_file']
        self.filtpath = os.path.join(self.lut_dir, 'wavelengths.flt')

        if 'aerosol_model_file' in config:
            self.aerosol_model_file = config['aerosol_model_file']
            self.aerosol_template = config['aerosol_template_file']
            self.build_aerosol_model()

        # Build the lookup table
        self.build_lut(instrument)
コード例 #4
0
    def build_lut(self, instrument, rebuild=False):
        """ Each LUT is associated with a source directory.  We build a 
            lookup table by: 
              (1) defining the LUT dimensions, state vector names, and the grid 
                  of values; 
              (2) running modtran if needed, with each MODTRAN run defining a 
                  different point in the LUT; and 
              (3) loading the LUTs, one per key atmospheric coefficient vector,
                  into memory as VectorInterpolator objects."""

        # Regenerate MODTRAN input wavelength file
        if not os.path.exists(self.filtpath):
            self.wl2flt(instrument.wl, instrument.fwhm, self.filtpath)

        TabularRT.build_lut(self, instrument, rebuild)
コード例 #5
0
ファイル: rt_6s.py プロジェクト: monicavermillion/isofit
    def __init__(self, config):

        TabularRT.__init__(self, config)
        self.sixs_dir = self.find_basedir(config)
        self.wl, self.fwhm = load_wavelen(config['wavelength_file'])
        self.sixs_grid_init = s.arange(self.wl[0], self.wl[-1] + 2.5, 2.5)
        self.sixs_ngrid_init = len(self.sixs_grid_init)
        self.sixs_dir = self.find_basedir(config)
        self.params = {
            'aermodel': 1,
            'AOT550': 0.01,
            'H2OSTR': 0,
            'O3': 0.40,
            'day': config['day'],
            'month': config['month'],
            'elev': config['elev'],
            'alt': config['alt'],
            'atm_file': None,
            'abscf_data_directory': None,
            'wlinf': self.sixs_grid_init[0] / 1000.0,  # convert to nm
            'wlsup': self.sixs_grid_init[-1] / 1000.0
        }

        if 'obs_file' in config:
            # A special case where we load the observation geometry
            # from a custom-crafted text file
            g = Geometry(obs=config['obs_file'])
            self.params['solzen'] = g.solar_zenith
            self.params['solaz'] = g.solar_azimuth
            self.params['viewzen'] = g.observer_zenith
            self.params['viewaz'] = g.observer_azimuth
        else:
            # We have to get geometry from somewhere, so we presume it is
            # in the configuration file.
            for f in ['solzen', 'viewzen', 'solaz', 'viewaz']:
                self.params[f] = config[f]

        self.esd = s.loadtxt(config['earth_sun_distance_file'])
        dt = datetime(2000, self.params['month'], self.params['day'])
        self.day_of_year = dt.timetuple().tm_yday
        self.irr_factor = self.esd[self.day_of_year - 1, 1]

        irr = s.loadtxt(config['irradiance_file'], comments='#')
        self.iwl, self.irr = irr.T
        self.irr = self.irr / 10.0  # convert, uW/nm/cm2
        self.irr = self.irr / self.irr_factor**2  # consider solar distance

        self.build_lut()
コード例 #6
0
    def __init__(self, config):

        TabularRT.__init__(self, config)
        self.libradtran_dir = self.find_basedir(config)
        self.libradtran_template_file = config['libradtran_template_file']
        self.build_lut()