當前位置: 首頁>>代碼示例>>Python>>正文


Python OCO_Matrix.header[SOURCE_SOUNDING_HEADER_NAME]方法代碼示例

本文整理匯總了Python中OCO_Matrix.OCO_Matrix.header[SOURCE_SOUNDING_HEADER_NAME]方法的典型用法代碼示例。如果您正苦於以下問題:Python OCO_Matrix.header[SOURCE_SOUNDING_HEADER_NAME]方法的具體用法?Python OCO_Matrix.header[SOURCE_SOUNDING_HEADER_NAME]怎麽用?Python OCO_Matrix.header[SOURCE_SOUNDING_HEADER_NAME]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OCO_Matrix.OCO_Matrix的用法示例。


在下文中一共展示了OCO_Matrix.header[SOURCE_SOUNDING_HEADER_NAME]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: extract_sounding_noise

# 需要導入模塊: from OCO_Matrix import OCO_Matrix [as 別名]
# 或者: from OCO_Matrix.OCO_Matrix import header[SOURCE_SOUNDING_HEADER_NAME] [as 別名]
def extract_sounding_noise(l1b_obj, sounding_id, gain_code=None, modification_params=None):

    # Get the gain code used for current sounding id
    if gain_code == None:
        gain_code = l1b_obj.get_sounding_info('gain', sounding_id)
        
    out_obj = OCO_Matrix()

    if hasattr(gain_code, 'shape'):
        if numpy.all(gain_code == gain_code[0]):
            gain_code = gain_code[0]
        else:
            raise ValueError('Sounding %s does not have same gain code for both polarizations: %s' % (sounding_id, gain_code))
        
    noise_data = l1b_obj.get_error_data(sounding_id, calculate_noise=False, gain_code=gain_code)

    max_diodes = 0
    for band_cnv, band_noise_val in noise_data:
        num_diodes = band_cnv.shape[-1]
        max_diodes = max(max_diodes, num_diodes)

    if modification_params != None:
        radiances = l1b_obj.get_radiance_data(sounding_id)

    band_noise_values = []
    cnv_data = numpy.zeros((max_diodes, len(BAND_COLUMN_LABELS)), dtype=float)
    for band_idx, band_noise_tuple in enumerate(noise_data):
        band_cnv, band_noise_val = band_noise_tuple

        if len(band_cnv.shape) > 1:
            band_cnv = numpy.average( band_cnv, axis=0 )

        if hasattr(band_noise_val, 'shape') and band_noise_val.shape[0] > 1:
            band_noise_val = numpy.average( band_noise_val, axis=0 )
        
        num_diodes = band_cnv.shape[0]
        
        band_noise_values.append( band_noise_val)

        if modification_params != None:
            band_params = modification_params[band_idx]
            out_obj.header[BAND_PARAM_HEADER_TMPL % (band_idx+1)] = ' '.join([str(curr_val) for curr_val in band_params])

            # Derive signal from average of top N radiance values
            band_radiance = radiances[band_idx]

            if len(band_radiance.shape) > 1:
                band_radiance = numpy.average(band_radiance, axis=0)
            
            band_radiance.sort()
            signal = numpy.mean(band_radiance[-SIGNAL_AVG_COUNT:])

            # Calculated updated band_cnv
            param_a1, param_b1 = band_params
            band_cnv[:] = (param_a1 * signal) / band_noise_val + param_b1 * band_cnv[:]
            
        cnv_data[:num_diodes, band_idx*2]   = numpy.arange(1,num_diodes+1)
        cnv_data[:num_diodes, band_idx*2+1] = band_cnv[:]

    out_obj.header[NOISE_VALUES_HEADER_NAME] = ' '.join([ ('%e' % val) for val in band_noise_values ])
    out_obj.header[SOURCE_FILE_HEADER_NAME] = os.path.realpath(l1b_obj.filename)
    out_obj.header[SOURCE_SOUNDING_HEADER_NAME] = sounding_id
    out_obj.file_id = FILE_ID % (sounding_id, gain_code)
    out_obj.labels = BAND_COLUMN_LABELS
    out_obj.data = cnv_data
    
    return out_obj
開發者ID:E-LLP,項目名稱:RtRetrievalFramework,代碼行數:69,代碼來源:extract_gosat_noise_from_hdf.py


注:本文中的OCO_Matrix.OCO_Matrix.header[SOURCE_SOUNDING_HEADER_NAME]方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。