本文整理汇总了Python中anuga.file.netcdf.NetCDFFile.variables['point_attributes'][:]方法的典型用法代码示例。如果您正苦于以下问题:Python NetCDFFile.variables['point_attributes'][:]方法的具体用法?Python NetCDFFile.variables['point_attributes'][:]怎么用?Python NetCDFFile.variables['point_attributes'][:]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类anuga.file.netcdf.NetCDFFile
的用法示例。
在下文中一共展示了NetCDFFile.variables['point_attributes'][:]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _write_msh_file
# 需要导入模块: from anuga.file.netcdf import NetCDFFile [as 别名]
# 或者: from anuga.file.netcdf.NetCDFFile import variables['point_attributes'][:] [as 别名]
#.........这里部分代码省略.........
'num_of_vertex_attribute_title_chars'))
outfile.variables['vertex_attributes'][:] = \
mesh['vertex_attributes']
outfile.variables['vertex_attribute_titles'][:] = \
mesh['vertex_attribute_titles']
# segments
if (mesh['segments'].shape[0] > 0):
outfile.createDimension('num_of_segments', mesh['segments'].shape[0])
outfile.createVariable('segments', netcdf_int,
('num_of_segments', 'num_of_segment_ends'))
outfile.variables['segments'][:] = mesh['segments']
if (mesh['segment_tags'].shape[1] > 0):
outfile.createDimension('num_of_segment_tag_chars',
mesh['segment_tags'].shape[1])
outfile.createVariable('segment_tags',
netcdf_char,
('num_of_segments',
'num_of_segment_tag_chars'))
outfile.variables['segment_tags'][:] = mesh['segment_tags']
# triangles
if (mesh['triangles'].shape[0] > 0):
outfile.createDimension('num_of_triangles', mesh['triangles'].shape[0])
outfile.createVariable('triangles', netcdf_int,
('num_of_triangles', 'num_of_triangle_vertices'))
outfile.createVariable('triangle_neighbors', netcdf_int,
('num_of_triangles', 'num_of_triangle_faces'))
outfile.variables['triangles'][:] = mesh['triangles']
outfile.variables['triangle_neighbors'][:] = mesh['triangle_neighbors']
if (mesh['triangle_tags'] is not None and
(mesh['triangle_tags'].shape[1] > 0)):
outfile.createDimension('num_of_triangle_tag_chars',
mesh['triangle_tags'].shape[1])
outfile.createVariable('triangle_tags', netcdf_char,
('num_of_triangles',
'num_of_triangle_tag_chars'))
outfile.variables['triangle_tags'][:] = mesh['triangle_tags']
# outline
# points
if (mesh['points'].shape[0] > 0):
outfile.createDimension('num_of_points', mesh['points'].shape[0])
outfile.createVariable('points', netcdf_float,
('num_of_points', 'num_of_dimensions'))
outfile.variables['points'][:] = mesh['points']
if mesh['point_attributes'].shape[0] > 0 \
and mesh['point_attributes'].shape[1] > 0:
outfile.createDimension('num_of_point_attributes',
mesh['point_attributes'].shape[1])
outfile.createVariable('point_attributes', netcdf_float,
('num_of_points', 'num_of_point_attributes'))
outfile.variables['point_attributes'][:] = mesh['point_attributes']
# outline_segments
if mesh['outline_segments'].shape[0] > 0:
outfile.createDimension('num_of_outline_segments',
mesh['outline_segments'].shape[0])
outfile.createVariable('outline_segments', netcdf_int,
('num_of_outline_segments',
'num_of_segment_ends'))
outfile.variables['outline_segments'][:] = mesh['outline_segments']
if mesh['outline_segment_tags'].shape[1] > 0:
outfile.createDimension('num_of_outline_segment_tag_chars',
mesh['outline_segment_tags'].shape[1])
outfile.createVariable('outline_segment_tags', netcdf_char,
('num_of_outline_segments',
'num_of_outline_segment_tag_chars'))
outfile.variables['outline_segment_tags'][:] = \
mesh['outline_segment_tags']
# holes
if (mesh['holes'].shape[0] > 0):
outfile.createDimension('num_of_holes', mesh['holes'].shape[0])
outfile.createVariable('holes', netcdf_float,
('num_of_holes', 'num_of_dimensions'))
outfile.variables['holes'][:] = mesh['holes']
# regions
if (mesh['regions'].shape[0] > 0):
outfile.createDimension('num_of_regions', mesh['regions'].shape[0])
outfile.createVariable('regions', netcdf_float,
('num_of_regions', 'num_of_dimensions'))
outfile.createVariable('region_max_areas', netcdf_float,
('num_of_regions',))
outfile.variables['regions'][:] = mesh['regions']
outfile.variables['region_max_areas'][:] = mesh['region_max_areas']
if (mesh['region_tags'].shape[1] > 0):
outfile.createDimension('num_of_region_tag_chars',
mesh['region_tags'].shape[1])
outfile.createVariable('region_tags', netcdf_char,
('num_of_regions',
'num_of_region_tag_chars'))
outfile.variables['region_tags'][:] = mesh['region_tags']
# geo_reference info
if mesh.has_key('geo_reference') and not mesh['geo_reference'] == None:
mesh['geo_reference'].write_NetCDF(outfile)
outfile.close()