本文整理匯總了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)