当前位置: 首页>>代码示例>>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;未经允许,请勿转载。