# -----------------------------------------------------------------------------
-def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef=90., regions_interp_method=None, m3d=True, xyzFile=False, verbose=False):
+def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef=-100., regions_interp_method=None, m3d=True, xyzFile=False, verbose=False):
"""
interpolZ takes a 2D (x,y) mesh and calls the active instance of module HYDRO
to interpolate the bathymetry/altimetry on the mesh nodes, to produce the Z value of each node.
Key: face group name
Value: region name in the HYDRO Case
zUndef: Z value to use for nodes outside the regions (there must be none if the case is correct).
- default value is 90.
+ default value is -100.
interpolMethod: integer value or dict
if integer :
0 = nearest point on bathymetry
# or the mesh is displayed, it makes huge gap. To prevent this artefact, a more
# convenient "undefined" value is set. This new undefined value is given by the user.
#
-# zUndefThreshold: the default value is -9000. It is tied with the value -9999. given
+# zUndefThreshold: the default value is zUndef +10. It is tied with the value -100. given
# by the interpolation when no value is defined.
#
- zUndefThreshold = -9000.
+ zUndefThreshold = zUndef +10.
if verbose:
ligne = "zUndefThreshold: %f" % zUndefThreshold
print (ligne)
if verbose:
ligne = ".. Number of nodes below the minimum: %d" % len(np_aux_z[0])
print (ligne)
- if len(np_aux_z[0]):
- for iaux in np_aux_z[0]:
- bathy[iaux] = zUndef
#
# 6. Option : xyz file
#
return statz
-def interpolZ_B(bathyName, fichierMaillage, gr_face_name, zUndef=90., interp_method=0, m3d=True, xyzFile=False, verbose=False):
+def interpolZ_B(bathyName, fichierMaillage, gr_face_name, zUndef=-100., interp_method=0, m3d=True, xyzFile=False, verbose=False):
"""
interpolZ_B takes a 2D (x,y) mesh and calls the active instance of module HYDRO
to interpolate the bathymetry/altimetry on the mesh nodes, to produce the Z value of each node.
fichierMaillage: med file name produced by SMESH, corresponding to the HYDRO case
gr_face_name: face group name
zUndef: Z value to use for nodes outside the regions (there must be none if the case is correct).
- default value is 90.
+ default value is -100.
interp_method: interpolation method
0 = nearest point on bathymetry
1 = linear interpolation
#
tb_aux = np.zeros(nbnodes, dtype=np.bool)
#
- #bathy = np.zeros(nbnodes, dtype=np.float)
- #bathy.fill(zUndef)
- bathy = coords[:,2].toNumPyArray()
+ bathy = np.zeros(nbnodes, dtype=np.float)
+ bathy.fill(zUndef)
+ if (coords.getNumberOfComponents() >2):
+ bathy = coords[:,2].toNumPyArray()
+ else:
+ print("=== WARNING! === Mesh has no altitude component z, z will be filled with zUndef = %s outside the group!"%zUndef)
#
# 4.1. Mesh of the group
# or the mesh is displayed, it makes huge gap. To prevent this artefact, a more
# convenient "undefined" value is set. This new undefined value is given by the user.
#
-# zUndefThreshold: the default value is -9000. It is tied with the value -9999. given
+# zUndefThreshold: the default value is zUndef +10. It is tied with the value -100. given
# by the interpolation when no value is defined.
#
- zUndefThreshold = -9000.
+ zUndefThreshold = zUndef + 10.
if verbose:
ligne = "zUndefThreshold: %f" % zUndefThreshold
print (ligne)
if verbose:
ligne = ".. Number of nodes below the minimum: %d" % len(np_aux_z[0])
print (ligne)
- if len(np_aux_z[0]):
- for iaux in np_aux_z[0]:
- bathy[iaux] = zUndef
#
# 6. Option : xyz file
#