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


Python OCO_Matrix.find_labels方法代碼示例

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


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

示例1: Process_File

# 需要導入模塊: from OCO_Matrix import OCO_Matrix [as 別名]
# 或者: from OCO_Matrix.OCO_Matrix import find_labels [as 別名]
def Process_File(source, destination, fileKeywords, moduleSections, valuesDict, mapDict):
    logger = logging.getLogger(os.path.basename(__file__))

    for currSection in moduleSections:
        if str(source) == str(destination):
            raise IOError("source and destination must be different. will not overwrite source file")

    rows = Apply_Template(moduleSections[0].Get_Keyword_Value("rows"), valuesDict, mapDict=mapDict)
    columns = Apply_Template(moduleSections[0].Get_Keyword_Value("columns"), valuesDict, mapDict=mapDict)
    identifier = Apply_Template(moduleSections[0].Get_Keyword_Value("identifier"), valuesDict, mapDict=mapDict)
    initial_value = Apply_Template(moduleSections[0].Get_Keyword_Value("initial_value"), valuesDict, mapDict=mapDict)
    map_filename = Apply_Template(moduleSections[0].Get_Keyword_Value("map_filename"), valuesDict, mapDict=mapDict)
    modify = moduleSections[0].Get_Keyword_Value("modify")

    # Load ranges from RANGES section of module
    max_range_val = None
    range_values = {}
    for range_sect in moduleSections[0].Get_Section("->RANGES"):
        for range_spec in range_sect.Get_Matrix_Data():
            (range_name, range_str) = range_spec

            if range_str.find(",") > 0:
                curr_range = [float(val) for val in range_str.split(",")]
            else:
                curr_range = [float(val) for val in range_str.split()]

            if max_range_val == None:
                max_range_val = max(curr_range)
            else:
                max_range_val = max(max_range_val, max(curr_range))

            range_values[range_name] = curr_range

    if len(range_values) == 0:
        logger.error("No index range list supplied for operating on source: %s" % source)
        return

    # Load source for data to map agains
    data_obj = OCO_Matrix(source)

    # Set columns to all if argument not supplied,
    # Otherwise try parsing as an index range list failing that try
    # using the specified columns as label names
    if columns == None:
        columns = range(data_obj.dims[1])
    else:
        try:
            columns = index_range_list(columns)
        except ValueError, TypeError:
            columns = data_obj.find_labels(columns, match_case=False, indexes=True)
開發者ID:nasa,項目名稱:RtRetrievalFramework,代碼行數:52,代碼來源:range_map.py

示例2: adjust_file_for_trend

# 需要導入模塊: from OCO_Matrix import OCO_Matrix [as 別名]
# 或者: from OCO_Matrix.OCO_Matrix import find_labels [as 別名]
    def adjust_file_for_trend(self, src_apriori_file, time_struct, dst_apriori_file=None):

       if dst_apriori_file == None:
           dst_apriori_file = src_apriori_file

       if type(dst_apriori_file) is str and os.path.realpath(os.path.dirname(dst_apriori_file)) == os.path.realpath(self.apriori_db_path):
           raise IOError('Can not modify apriori file as located in database path, it must be copied first')

       apriori_obj = OCO_Matrix(src_apriori_file)
       co2_col_idx = apriori_obj.labels.index(apriori_obj.find_labels(CO2_APRIORI_CO2_COL)[0])

       co2_offset = self.get_apriori_offset(time_struct, debug_values=apriori_obj.header)
       apriori_obj.data[:, co2_col_idx] += co2_offset
      
       apriori_obj.header['co2_offset']  = co2_offset

       apriori_obj.write(dst_apriori_file)
開發者ID:E-LLP,項目名稱:RtRetrievalFramework,代碼行數:19,代碼來源:Apriori_DB.py


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