Esempio n. 1
0
    def _apply_sens_correction(self, band_num, band_wns, band_data, gain):

        if self.sens_corr_data == None:
            return band_data

        band_index = SWIR_BANDS.index(band_num)

        corr_obj = self.sens_corr_data[band_index]

        unit_col_idx = corr_obj.labels.index(RAD_CNV_UNIT_COL)

        for pol_idx, pol_name in enumerate(POL_ORDER):
            corr_col_name = RAD_CNV_SENS_COL_TMPL % (band_num, pol_name, gain[pol_idx])

            try:
                corr_col_idx = corr_obj.labels.index(corr_col_name)
            except:
                raise IOError('Could not find column named: %s in sensitivity file: %s' % (corr_col_name, corr_obj.filename))


            # Retrieve correction data
            resampled_corr_data = numpy.zeros(band_data.shape[0], dtype=float)

            src_corr_data = corr_obj.data[:,corr_col_idx]
            resampled_corr_data = OCO_MathUtil.linear_interpol(src_corr_data, corr_obj.data[:, unit_col_idx], band_wns[:,pol_idx], extrapolate=False, extrap_err=False)
            
            valid_points = numpy.where(abs(resampled_corr_data) > 0.0)[0]
            band_data[valid_points, pol_idx] *= resampled_corr_data[valid_points]

        return band_data
Esempio n. 2
0
    def get_value(self, time_struct):
        year, month, doy = (time_struct.tm_year, time_struct.tm_mon, time_struct.tm_yday)
        year_frac = float(doy) / float(time.strftime('%j', datetime.datetime(year, 12, 31).utctimetuple()))
        curr_dec_date = year + year_frac

        trend_value = OCO_MathUtil.linear_interpol(self.values, self.dates, [curr_dec_date], extrapolate=True, extrap_err=False)

        # Resulting trend value should be in first element of matrix
        return trend_value[0]
Esempio n. 3
0
    def get_value(self, time_struct):
        year, month, doy = (time_struct.tm_year, time_struct.tm_mon,
                            time_struct.tm_yday)
        year_frac = float(doy) / float(
            time.strftime('%j',
                          datetime.datetime(year, 12, 31).utctimetuple()))
        curr_dec_date = year + year_frac

        trend_value = OCO_MathUtil.linear_interpol(self.values,
                                                   self.dates, [curr_dec_date],
                                                   extrapolate=True,
                                                   extrap_err=False)

        # Resulting trend value should be in first element of matrix
        return trend_value[0]