def __init__(self): self.source_product = None self.product_meta = None self.datastrip_meta = None self.rut_algo = s2_rut_algo.S2RutAlgo() self.unc_band = None self.toa_band = None self.time_init = datetime.datetime( 2015, 6, 23, 10, 00) # S2A launch date 23-june-2015, time is indifferent self.sourceBandMap = None
def cal_unc(toa, sza, toa_band_id, alpha, beta, gains, u_diff_temp, quant, u_sun, solar_irradiance, bandid, spacecraft): rut_algo = s2_rut_algo.S2RutAlgo() rut_algo.a = gains[toa_band_id] rut_algo.beta = beta[toa_band_id] rut_algo.alpha = alpha[toa_band_id] rut_algo.tecta = sza rut_algo.e_sun = solar_irradiance[toa_band_id] rut_algo.u_sun = u_sun rut_algo.quant = quant rut_algo.u_diff_temp = u_diff_temp[toa_band_id] unc = rut_algo.unc_calculation(toa, toa_band_id, spacecraft) return unc
def test_simple_case_B8(self): rut_algo = s2_rut_algo.S2RutAlgo() rut_algo.a = 6.22865527455779 rut_algo.e_sun = 1036.39 rut_algo.u_sun = 1.03418574554466 rut_algo.tecta = 63.5552301619033 rut_algo.quant = 10000.0 rut_algo.alpha = 0.571 rut_algo.beta = 0.04447 rut_algo.u_ADC = 0.5 band_data = [100, 500, 1000, 2000, 5000, 10000, 15000.] rut_result = rut_algo.unc_calculation(np.array(band_data), 7) self.assertEqual([250, 85, 55, 39, 28, 24, 23], list(rut_result))
def __init__(self): self.s2_rut_info = None self.source_product = None self.mask_group = None self.product_meta = None self.datastrip_meta = None self.spacecraft = None # possible values are "Sentinel-2A" and "Sentinel-2B". Used as a dictionary key self.rut_algo = s2_rut_algo.S2RutAlgo() self.unc_band = None self.toa_band = None # S2A launch date 23-june-2015 and S2A launch date 7-march-2017, time is indifferent. self.time_init = {'Sentinel-2A': datetime.datetime(2015, 6, 23, 10, 00), 'Sentinel-2B': datetime.datetime(2017, 3, 7, 10, 00)} self.sourceBandMap = None self.targetBandList = [] self.inforoot = None self.rut_product_meta = None self.source_sza = None
import snappy import matplotlib matplotlib.use('Agg') # this does not show the plot on the screen import matplotlib.pyplot as pt import sys # we need to define the location of the main code to get some of its data sys.path.append(os.path.join(os.getcwd(), 'src', 'main', 'python')) import s2_l1_rad_conf as rad_conf import s2_rut s2rutop = s2_rut.S2RutOp() import s2_rut_algo s2rutalgo = s2_rut_algo.S2RutAlgo() # ====================================== CONSTANT VARIABLES ======================================= # contains the only valid names of the S2 RUT product bands. S2 L1C product bands use same naming excluding "_rut" S2RUT_BAND_NAMES = ['B1_rut', 'B2_rut', 'B3_rut', 'B4_rut', 'B5_rut', 'B6_rut', 'B7_rut', 'B8_rut', 'B8A_rut', 'B9_rut', 'B10_rut', 'B11_rut', 'B12_rut'] S2RUT_BAND_SAMPLING = {'B1_rut': 60, 'B2_rut': 10, 'B3_rut': 10, 'B4_rut': 10, 'B5_rut': 20, 'B6_rut': 20, 'B7_rut': 20, 'B8_rut': 10, 'B8A_rut': 20, 'B9_rut': 60, 'B10_rut': 60, 'B11_rut': 20, 'B12_rut': 20} ITERPOINTS = 2000 # Number of iteration points that MonteCarlo performs # append the two folder directories so that can import the classes inside. ROI_PATH = '/home/data/satellite/S2A_MSI/S2ROI/Gobabeb_examplesnap' # contains the uncertainty products for each site and stores the results S2_DATA = '/home/data/satellite/S2A_MSI/L1/RadCalNet/GONA' # here the specified S2 L1C products are read # It is only prepared to process the *.dim files.