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


Python OCO_Matrix.pixel_ranges方法代碼示例

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


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

示例1: Process_File

# 需要導入模塊: from OCO_Matrix import OCO_Matrix [as 別名]
# 或者: from OCO_Matrix.OCO_Matrix import pixel_ranges [as 別名]
def Process_File(source, destination, fileKeywords, moduleSections, valuesDict, mapDict):

    if len(moduleSections) > 1:
       raise Exception('Only one instance of %s allowed per FILE block' % os.path.basename(__file__))

    if source == destination:
       raise Exception('Will not write albedo into source spectra file. dest_filename must be defined')

    instrument_name = Apply_Template(moduleSections[0].Get_Keyword_Value('instrument_name'), valuesDict, mapDict=mapDict)

    if instrument_name == None or len(instrument_name) == 0:
        raise Exception('instrument_name keyword must be specified for module: %s' % os.path.basename(__file__))

    # Load spectra data source
    spec_file_obj = OCO_Matrix(source)

    radiances = []
    for pixel_range in spec_file_obj.pixel_ranges():
        radiances.append( spec_file_obj[ASCII_SPECTRA_RADIANCE_COLUMN][pixel_range[0]:pixel_range[1]] )

    # Get SZA value
    try:
       sza_r = math.radians( float(spec_file_obj.header[ASCII_SPECTRA_SZA_KEYWORD].split()[0]) )
    except KeyError:
       raise KeyError('Could not find header keyword %s in spectrum file: %s' % (ASCII_SPECTRA_SZA_KEYWORD, source))

    # Create apriori file from radiance data
    create_albedo_apriori_from_radiance(radiances, sza_r, instrument_name, destination)
開發者ID:E-LLP,項目名稱:RtRetrievalFramework,代碼行數:30,代碼來源:create_surface_apriori.py

示例2: create_dispersion_from_ascii

# 需要導入模塊: from OCO_Matrix import OCO_Matrix [as 別名]
# 或者: from OCO_Matrix.OCO_Matrix import pixel_ranges [as 別名]
def create_dispersion_from_ascii(l1b_file, out_disp_file, disp_in_file, sounding_id=None, index_scheme=None):

    asc_l1b_obj = OCO_Matrix(l1b_file)

    if sounding_id == None:
        sounding_id = asc_l1b_obj.header['sounding_id']

    if disp_in_file == None:
        raise IOError('No dispersion file specified')

    latitude = float(asc_l1b_obj.header['sounding_latitude'].split()[0])
    sza_r    = math.radians(float(asc_l1b_obj.header['sounding_solar_zenith'].split()[0]))
    saz_r    = math.radians(float(asc_l1b_obj.header['sounding_solar_azimuth'].split()[0]))

    time_stamp = asc_l1b_obj.header['frame_time_stamp']
    time_struct = OCO_TextUtils.convert_timestamp_to_struct(time_stamp)

    pixel_ranges = asc_l1b_obj.pixel_ranges()
    aband_data = asc_l1b_obj['Radiance'][slice(*pixel_ranges[0]), 0]

    disp_in_obj = OCO_Matrix(disp_in_file)
    dispersion_coefs = disp_in_obj[DISPERSION_ASCII_COLUMN_IDENT].transpose()
    
    create_scene_dispersion_file(sounding_id, latitude, sza_r, saz_r, time_struct, aband_data, dispersion_coefs, out_disp_file, index_scheme=index_scheme)
開發者ID:E-LLP,項目名稱:RtRetrievalFramework,代碼行數:26,代碼來源:load_disp_apriori.py


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