本文整理汇总了Python中OCO_Matrix.OCO_Matrix.data[0,0]方法的典型用法代码示例。如果您正苦于以下问题:Python OCO_Matrix.data[0,0]方法的具体用法?Python OCO_Matrix.data[0,0]怎么用?Python OCO_Matrix.data[0,0]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCO_Matrix.OCO_Matrix
的用法示例。
在下文中一共展示了OCO_Matrix.data[0,0]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write_xco2_file
# 需要导入模块: from OCO_Matrix import OCO_Matrix [as 别名]
# 或者: from OCO_Matrix.OCO_Matrix import data[0,0] [as 别名]
def write_xco2_file(log_sounding_dict, xco2_filename):
xco2_fileobj = OCO_Matrix()
xco2_fileobj.file_id = 'True xco2 from orbit simulator'
xco2_fileobj.labels = [XCO2_LABEL_NAME]
xco2_fileobj.data = numpy.zeros((1,1), dtype=float)
xco2_fileobj.data[0,0] = log_sounding_dict[XCO2_COL_NAME]
xco2_fileobj.write(xco2_filename)
示例2: Process_File
# 需要导入模块: from OCO_Matrix import OCO_Matrix [as 别名]
# 或者: from OCO_Matrix.OCO_Matrix import data[0,0] [as 别名]
def Process_File(source, destination, fileKeywords, moduleSections, valuesDict, mapDict):
if len(moduleSections) > 1:
raise RuntimeError("Only one input file config set per file")
if str(source) == str(destination):
raise ValueError("source and dest filenames must be different. will not overwrite source file")
spectrum_file = Apply_Template(moduleSections[0].Get_Keyword_Value("spectrum_file"), valuesDict, mapDict=mapDict)
if type(source) is str and not os.path.exists(source):
raise IOError("Runlog file %s does not exist" % source)
base_spec_name = os.path.basename(spectrum_file)
# Use grep because its faster than doing it outself
matched_line = None
if type(source) == str:
grep_cmd = "grep -E " + base_spec_name + " " + source
matched_line = os.popen(grep_cmd).readline()
elif hasattr(source, "read"):
for curr_line in source.readlines():
if re.search(base_spec_name, curr_line):
matched_line = curr_line
break
else:
raise Exception("Unsupported object: %s" % source)
if matched_line == None or len(matched_line) == 0:
raise IOError("Could not find spectrum name: %s in run log file: %s" % (base_spec_name, source))
try:
matched_columns = matched_line.split()
psurf_val = float(matched_columns[pout_col_idx]) * convert_factor
except:
raise ValueError(
'Failed to parse psurf value from: "%s" from runlog line: %s'
% (matched_columns[pout_col_idx], matched_line)
)
out_obj = OCO_Matrix()
out_obj.data = numpy.zeros((1, 1), dtype=float)
out_obj.data[0, 0] = psurf_val
out_obj.file_id = "psurf value extracted for spectrum named: %s from runlog file: %s" % (base_spec_name, source)
out_obj.labels = ["PSURF"]
out_obj.write(destination)