当前位置: 首页>>代码示例>>Python>>正文


Python OCO_Matrix.as_dict方法代码示例

本文整理汇总了Python中OCO_Matrix.OCO_Matrix.as_dict方法的典型用法代码示例。如果您正苦于以下问题:Python OCO_Matrix.as_dict方法的具体用法?Python OCO_Matrix.as_dict怎么用?Python OCO_Matrix.as_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCO_Matrix.OCO_Matrix的用法示例。


在下文中一共展示了OCO_Matrix.as_dict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_existing_data

# 需要导入模块: from OCO_Matrix import OCO_Matrix [as 别名]
# 或者: from OCO_Matrix.OCO_Matrix import as_dict [as 别名]
    def load_existing_data(self, data_file):
        existing_obj = OCO_Matrix(data_file, as_strings=True)

        dict_data = existing_obj.as_dict(RUN_COLUMN_NAME)

        return existing_obj.labels, dict_data
开发者ID:E-LLP,项目名称:RtRetrievalFramework,代码行数:8,代码来源:testset_summary.py

示例2: plot_gosat_summ

# 需要导入模块: from OCO_Matrix import OCO_Matrix [as 别名]
# 或者: from OCO_Matrix.OCO_Matrix import as_dict [as 别名]
def plot_gosat_summ(summary_files):

    if len(summary_files) > 1:
        summary_names, common_part = OCO_TextUtils.extract_run_names(summary_files, return_common=True)
    else:
        common_part = summary_files[0]
    
    plot_data = {}
    for curr_summ_file in summary_files:
        file_obj = OCO_Matrix(curr_summ_file, as_strings=True)

        plot_data = file_obj.as_dict(DICT_KEY_COLUMN, existing_dict=plot_data)

    figure_index = 0
    x_axis_index = []
    for curr_yaxis in PLOT_TYPES:
        for curr_filter in PLOT_FILTERS:
            legend_names = []
            plot_objs = []

            fig = None
            curr_axis = None

            for leg_idx, curr_legend in enumerate(LEGEND_VALUES):
                # Extract plot data
                x_data = []
                y_data = []
                for scene_name, scene_data in plot_data.items():
                    if not re.search(curr_filter[0], scene_name) or not re.search(curr_legend[0], scene_name):
                        continue

                    if not scene_data.has_key(X_AXIS[0]) or not scene_data.has_key(curr_yaxis[0]):
                        continue

                    print 'Using scene: ', scene_name, 'for', curr_filter[1], curr_legend[1]

                    x_value = scene_data[X_AXIS[0]]
                    y_value = scene_data[curr_yaxis[0]]

                    if len(X_AXIS) >= 3:
                        axis_match = re.search(X_AXIS[2], x_value)
                        x_value = axis_match.group()

                    if len(X_AXIS) >= 4:
                        if not x_value in x_axis_index:
                            x_axis_index.append(x_value)
                            
                        x_value = x_axis_index.index(x_value)                            
                        
                    try:
                        x_value = float(x_value)
                    except:
                        pass

                    y_value = float(y_value)

                    if abs(y_value - FILL_VALUE) > 1e-2:
                        y_value *= curr_yaxis[2]
                        insert_point = bisect.bisect(x_data, x_value)

                        x_data.insert(insert_point, x_value)
                        y_data.insert(insert_point, y_value)

                if len(x_data) > 0:
                    if fig == None:
                        fig = pyplot.figure(figure_index)
                        fig.clf()
                        curr_axis = pyplot.subplot(111)
                    
                    curr_plot_obj = pyplot.plot(x_data, y_data, 'x')
                    plot_objs.append( curr_plot_obj )
                    
                    legend_names.append( curr_legend[1] )

            if len(plot_objs) > 0:
                figure_index += 1
                
                curr_axis.set_xlabel(X_AXIS[1])
                curr_axis.set_ylabel(curr_yaxis[1])
                curr_axis.set_title('%s -- %s' % (curr_filter[1], common_part))

                leg = curr_axis.legend( plot_objs,
                                        legend_names,
                                        loc='lower right',
                                        borderpad = 0.1,
                                        labelspacing = 0.05,
                                        borderaxespad = 0.2,
                                        )


    pyplot.show()
开发者ID:E-LLP,项目名称:RtRetrievalFramework,代码行数:93,代码来源:plot_gosat_summ.py


注:本文中的OCO_Matrix.OCO_Matrix.as_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。