Example #1
0
coord = [x_coords[0],y_coords[0],z_crd]

#stn_loc=mesh.createVtx([0,0,0]) # Geocoordinate stored in a field
stn_loc=mesh.createVtx(coord) # Geocoordinates stored in mesh
ntopo=1

# Create the Topology set
topo_set=mesh.createEntSet(False)
topo_set.add(stn_loc)

### Create Geocoordinate tag -- When Geocoordinates are stored in a field
#geo_tag=mesh.createTag('GEOCOORDINATES',3,numpy.float)
#geo_tag[stn_loc]=coord

## Create tags for each data_variable
utils.make_data_tags(mesh, ds, var_map['data'], ntopo)

## Add variable attribute tags
utils.make_var_attr_tags(mesh, ds)

## Add global attribute tags
utils.make_gbl_attr_tags(mesh, ds)

# Build the time information
tvarn=coords_map['t_var']
tvar=ds.variables[tvarn]
ntimes=tvar.size

tarr=tvar[:]
tcoords=[]
for t in range(ntimes):
Example #2
0
cubes,status=mesh.createEntArr(iMesh.Topology.hexahedron,vert_arr)
nquads=len(cubes)
slice_size=(x_cnt-1)*(y_cnt-1)
# Add a set for the 'top' (5th face) of each 'layer' in the mesh
for zi in range(z_cnt-1):
    set=mesh.createEntSet(ordered=False)
    # The 5th face (index 4) is always the top
    set.add([x[4] for x in mesh.getEntAdj(cubes[zi*slice_size:(zi+1)*slice_size], iBase.Type.face)])
    # Add a final set for the 'bottom' (6th face) of the last 'layer' in the mesh
set=mesh.createEntSet(ordered=False)
# The 6th face (index 5) is always the top
set.add([x[5] for x in mesh.getEntAdj(cubes[(z_cnt-1)*slice_size:z_cnt*slice_size], iBase.Type.face)])

## Create tags for each data_variable
utils.make_data_tags(mesh, ds, var_map['data'], nquads)

### Add variable attribute tags
#utils.make_var_attr_tags(mesh, ds)
#
### Add global attribute tags
#utils.make_gbl_attr_tags(mesh, ds)

tvarn=coords_map['t_var']
tvar=ds.variables[tvarn]
ntimes=tvar.size
time_tag=mesh.createTag('TIME_DATA',1,iMesh.EntitySet)
tarr=tvar[:]
tcoords=[]
for t in range(ntimes):
    tcoords+=[[tarr[t],0,0]]