本文整理匯總了Python中OCO_Matrix.OCO_Matrix.header[key_name]方法的典型用法代碼示例。如果您正苦於以下問題:Python OCO_Matrix.header[key_name]方法的具體用法?Python OCO_Matrix.header[key_name]怎麽用?Python OCO_Matrix.header[key_name]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OCO_Matrix.OCO_Matrix
的用法示例。
在下文中一共展示了OCO_Matrix.header[key_name]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: len
# 需要導入模塊: from OCO_Matrix import OCO_Matrix [as 別名]
# 或者: from OCO_Matrix.OCO_Matrix import header[key_name] [as 別名]
file_data = numpy.zeros((num_rows, len(band_names)*2 + 1), dtype=float)
for band_idx in range(len(band_names)):
input_data_filename = ('%s/' + inp_file_format) % (input_dir, band_names[band_idx], fp_idx+1)
print 'Reading from: %s' % input_data_filename
in_mat_obj = OCO_Matrix(input_data_filename)
if num_rows != in_mat_obj.dims[0]:
raise IOError('Num rows expected: %d does not match number read: %d from file: %s' (num_rows, in_mat_obj.dims[0], input_data_filename))
for row_idx in range(num_rows):
if band_idx == 0:
file_data[row_idx, 0] = in_mat_obj.data[row_idx, 0]
for col_num in range(1,3):
src_idx = col_num
dst_idx = col_num+(band_idx*2)
if row_idx == 0:
print 'Set value %d -> %d' % (src_idx, dst_idx)
file_data[row_idx, dst_idx] = in_mat_obj.data[row_idx, src_idx]
out_mat_obj.labels = file_labels
out_mat_obj.data = file_data
for (key_name, key_val) in header_additionals.iteritems():
out_mat_obj.header[key_name] = key_val
print 'Writing to: %s' % output_data_filename
out_mat_obj.write(output_data_filename)