def combine_gome_band34(self, wavelens, response, sol_wavelens, sol_response): # 把gome的通道做成390-800波段间隔1纳米的响应 gome_wavelens = np.arange(390, 801, 1) gome_shape = (response.shape[0], len(gome_wavelens)) gome_response3 = np.full(gome_shape, 0) gome_response4 = np.full(gome_shape, 0) for i in xrange(response.shape[0]): gome_response3[i, :] = spec_interp(wavelens[0:1024], response[i, 0:1024], gome_wavelens) gome_response4[i, :] = spec_interp(wavelens[1024:], response[i, 1024:], gome_wavelens) gome_response = gome_response3 + gome_response4 solar_response3 = spec_interp(sol_wavelens[0:1024], sol_response[0:1024], gome_wavelens) solar_response4 = spec_interp(sol_wavelens[1024:], sol_response[1024:], gome_wavelens) solar_response = solar_response3 + solar_response4 return gome_wavelens, gome_response, solar_response
def get_rad_tbb(self, D1, bandLst): ''' D1是目标类的实例 ''' # iasi 的光谱波数范围 WaveNum2 = self.wavenumber for Band in bandLst: # gome 不需要用波数,使用波长即可 WaveNum1 = 10**7 / D1.waveNum[Band][::-1] WaveRad1 = D1.waveRad[Band][::-1] WaveRad2 = pb_sat.spec_interp(WaveNum1, WaveRad1, WaveNum2) newRad = pb_sat.spec_convolution(WaveNum2, WaveRad2, self.radiance) newRad = newRad.reshape(newRad.size, 1) # 把数据1光谱插值到gome的太阳光谱 WaveRad2_solar = pb_sat.spec_interp(WaveNum1, WaveRad1, WaveNum2) # WaveRad2_solar = D1.spec_interp(WaveNum1, WaveRad1, self.vec_Solar_WL) newRad_solar = pb_sat.spec_convolution(self.vec_Solar_WL, WaveRad2_solar, self.vec_Solar_L) # ref = newRad / newRad_solar * np.pi / np.cos(np.deg2rad(self.sunZenith)) ref = np.pi * newRad / newRad_solar self.Ref[Band] = ref.reshape(ref.size, 1)
def get_ref(self, wave_nums, wave_spec, band_list, central_wave_nums, a, b, lut): """ wave_nums: 波数cm-1(字典形式,key是通道信息,针对FY数据) wave_spec: 响应0-1(字典形式,key是通道信息,针对FY数据) band_list: CH_20-CH_25 center_wave_nums: 目前未用,只是为了和get_tbb统一 a: 目前未用,只是为了和get_tbb统一 b: 目前未用,只是为了和get_tbb统一 return channel rad """ data = dict() if self.resolution == 40000: satellite_type1 = ['METOP-A', 'METOP-B'] if self.satellite in satellite_type1: # gome 不需要用波数,使用波长即可 gome_wavelens, gome_response = self.get_spectral_response() for band in sorted(band_list): wave_nums1 = wave_nums[band] wave_spec1 = wave_spec[band] # 插值 把FY光谱插值到GOME光谱上 wave_spec2 = spec_interp(wave_nums1, wave_spec1, gome_wavelens) # 对应FY的响应值,大小一致就可以和FY比较了,响应是IASI的 rads = spec_convolution(gome_wavelens, wave_spec2, gome_response) print band, np.allclose(rads, np.nan, equal_nan=True) # 过滤<=0的结果 # 把数据1光谱插值到gome的太阳光谱 wave_spec2_sol = spec_interp(wave_nums1, wave_spec1, gome_wavelens) # WaveRad2_solar = D1.spec_interp(WaveNum1, WaveRad1, self.vec_Solar_WL) rads_sol = spec_convolution(gome_wavelens, wave_spec2_sol, self.solar_response) solar_zen = self.get_solar_zenith() data[band] = rads / rads_sol * \ np.pi # / np.cos(np.deg2rad(solar_zen)) wrh 建议注释掉 # print data else: raise ValueError('Cant read this satellite`s data.: {}'.format( self.satellite)) else: raise ValueError( 'Cant read this data, please check its resolution: {}'.format( self.in_file)) return data
def get_rad(self, wave_nums, wave_spec, band_list, central_wave_nums, a, b, lut): """ wave_nums: 波数cm-1(字典形式,key是通道信息,针对FY数据) wave_spec: 响应0-1(字典形式,key是通道信息,针对FY数据) band_list: CH_20-CH_25 center_wave_nums: 目前未用,只是为了和get_tbb统一 a: 目前未用,只是为了和get_tbb统一 b: 目前未用,只是为了和get_tbb统一 return channel rad """ data = dict() if self.resolution == 24000 or self.resolution == 24001: satellite_type1 = ['METOP-A', 'METOP-B'] if self.satellite in satellite_type1: # 获取iasi的光谱响应 wave_nums2, response = self.get_spectral_response() for band in sorted(band_list): wave_nums1 = wave_nums[band] wave_spec1 = wave_spec[band] # 插值 把FY光谱插值到IASI光谱上 wave_spec2 = spec_interp( wave_nums1, wave_spec1, wave_nums2) # 更换业务测试 # file3 = 'D:/data/VIRR/FY3C_VIRR_srf_b04_IASI.txt' # data_spec1 = np.loadtxt(file3) # wave_spec2 = data_spec1[:8462, 1] # 输出测试 # aa = np.stack((wave_nums2, wave_spec2), axis=1) # np.savetxt( # 'D:/data/VIRR/FY3C_VIRR_srf_b03_IASI_test.txt', aa, fmt='%0.2f %0.5f') # print aa.shape # 对应FY的响应值,大小一致就可以和FY比较了,响应是IASI的 rads = spec_convolution(wave_nums2, wave_spec2, response) # print band, np.allclose(rads, np.nan, equal_nan=True) # 过滤<=0的结果 idx = np.where(rads <= 0.) if len(idx[0] > 0): rads[idx] = np.nan data[band] = rads # .reshape(rads.size, 1) else: raise ValueError( 'Cant read this satellite`s data.: {}'.format(self.satellite)) else: raise ValueError( 'Cant read this data, please check its resolution: {}'.format(self.in_file)) return data
def get_rad_tbb_test(self, D1, bandLst): ''' D1是目标类的实例 ''' # iasi 的光谱波数范围 WaveNum2 = self.wavenumber for Band in bandLst: # 把gome的通道做成390-800波段间隔1纳米的响应 solar_x = np.arange(390, 801, 1) WaveNum1 = 10 ** 7 / D1.waveNum[Band][::-1] WaveRad1 = D1.waveRad[Band][::-1] y = pb_sat.spec_interp(WaveNum1, WaveRad1, solar_x) # newRad = D1.spec_convolution(WaveNum2, WaveRad2, self.radiance) # newRad = newRad.reshape(newRad.size, 1) # print newRad.shape # 太阳光谱插值 WaveRad2_solar = pb_sat.spec_interp( WaveNum1, WaveRad1, self.vec_Solar_WL) # 太阳光谱插值 # 把gome的通道做成390-800波段间隔1纳米的响应 solar_x = np.arange(390, 801, 1) solar_y1 = pb_sat.spec_interp( self.vec_Solar_WL[0:1024], self.vec_Solar_L[0:1024], solar_x) solar_y2 = pb_sat.spec_interp( self.vec_Solar_WL[1024:], self.vec_Solar_L[1024:], solar_x) solar_y = solar_y1 + solar_y2 solar_rad = pb_sat.spec_convolution(solar_x, y, solar_y) print solar_y print np.min(WaveRad2_solar) print np.max(WaveRad2_solar) # print WaveRad2_solar # np.savetxt('testall.txt', WaveRad2_solar) # np.savetxt('test.txt', WaveRad2_solar) # WaveRad2_solar = D1.spec_interp(WaveNum1, WaveRad1, self.vec_Solar_WL) # newRad_solar = D1.spec_convolution(self.vec_Solar_WL, WaveRad2_solar, self.vec_Solar_L) gome_rad1 = self.radiance[:, 0:1024] gome_rad2 = self.radiance[:, 1024:] print gome_rad1.shape print gome_rad2.shape gome_y1_lst = [] gome_y2_lst = [] for i in xrange(self.radiance.shape[0]): gome_y1 = pb_sat.spec_interp( self.wavenumber[0:1024], self.radiance[i, 0:1024], solar_x) gome_y2 = pb_sat.spec_interp( self.wavenumber[1024:], self.radiance[i, 1024:], solar_x) gome_y1_lst.append(gome_y1) gome_y2_lst.append(gome_y2) gome_y = np.array(gome_y1_lst) + np.array(gome_y2_lst) gome_rad = pb_sat.spec_convolution(solar_x, y, gome_y) gome_rad = gome_rad.reshape(gome_rad.size, 1) ref = gome_rad / solar_rad * np.pi / \ np.cos(np.deg2rad(self.sunZenith)) self.Ref[Band] = ref.reshape(ref.size, 1)
def get_rad_tbb(self, D1, BandLst): ''' D1是目标类的实例 ''' # iasi 的光谱波数范围 WaveNum2 = self.wavenumber for Band in BandLst: WaveNum1 = D1.waveNum[Band] WaveRad1 = D1.waveRad[Band] WaveRad2 = pb_sat.spec_interp(WaveNum1, WaveRad1, WaveNum2) newRad = pb_sat.spec_convolution(WaveNum2, WaveRad2, self.radiance) tbb = pb_sat.planck_r2t(newRad, D1.WN[Band]) tbb = tbb * D1.TeA[Band] + D1.TeB[Band] self.Tbb[Band] = tbb.reshape(tbb.size, 1) self.Rad[Band] = newRad.reshape(newRad.size, 1)
def get_rad(self, wave_nums, wave_spec, band_list, central_wave_nums, a, b, lut): """ wave_nums: 波数cm-1(字典形式,key是通道信息,针对FY数据) wave_spec: 响应0-1(字典形式,key是通道信息,针对FY数据) band_list: CH_20-CH_25 center_wave_nums: 目前未用,只是为了和get_tbb统一 a: 目前未用,只是为了和get_tbb统一 b: 目前未用,只是为了和get_tbb统一 return channel rad """ data = dict() if self.resolution == 13500: satellite_type1 = ['AQUA', 'TERRA'] if self.satellite in satellite_type1: # 获取iasi的光谱响应 wave_nums2, response = self.get_spectral_response() for band in sorted(band_list): wave_nums1 = wave_nums[band] wave_spec1 = wave_spec[band] # 插值 把FY插值到AIRS上 wave_spec2 = spec_interp(wave_nums1, wave_spec1, wave_nums2) # 对应FY的响应值,大小一致就可以和FY比较了,响应是IASI的 rads = spec_convolution(wave_nums2, wave_spec2, response) # print band, np.allclose(rads, np.nan, equal_nan=True) # 过滤<=0的结果 # print rads idx = np.where(rads <= 0.) if len(idx[0] > 0): rads[idx] = np.nan data[band] = rads # .reshape(rads.size, 1) else: raise ValueError('Cant read this satellite`s data.: {}'.format( self.satellite)) else: raise ValueError( 'Cant read this data, please check its resolution: {}'.format( self.in_file)) return data
def get_rad(self, wave_nums, wave_spec, band_list, center_wave_nums, a, b, lut): """ wave_nums: 波数cm-1(字典形式,key是通道信息,针对FY数据) wave_spec: 响应0-1(字典形式,key是通道信息,针对FY数据) band_list: CH_20-CH_25 center_wave_nums: 目前未用,只是为了和get_tbb统一 a: 目前未用,只是为了和get_tbb统一 b: 目前未用,只是为了和get_tbb统一 return channel rad """ data = dict() if self.resolution == 16000: satellite_type1 = ['NPP'] # print a, b # print lut if self.satellite in satellite_type1: # 获取iasi的光谱响应 服务器上这个日期开始下载全分辨率cris wave_nums2, response = self.get_spectral_response() for band in sorted(band_list): wave_nums1 = wave_nums[band] wave_spec1 = wave_spec[band] # 插值 把FY插值到IASI上 wave_spec2 = spec_interp(wave_nums1, wave_spec1, wave_nums2) # 对应FY的响应值,大小一致就可以和FY比较了,响应是IASI的 # print wave_spec2 rads = spec_convolution(wave_nums2, wave_spec2, response) # data[band] = rads # 过滤<=0的结果 # print rads idx = np.where(rads <= 0.) rads[idx] = np.nan # data[band] = rads.reshape(rads.size, 1) data[band] = rads # .reshape(rads.size, 1) else: raise ValueError('Cant read this satellite`s data.: {}'.format( self.satellite)) else: raise ValueError( 'Cant read this data, please check its resolution: {}'.format( self.in_file)) return data