# -----------------------------------------------------------------------------
-def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef=90., interpolMethod=0, m3d=False, xyzFile=False, verbose=False):
+def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef=90., regions_interp_method=None, m3d=False, 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.
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.
- interpolMethod: integer value
- 0 = nearest point on bathymetry (default)
+ interpolMethod: integer value or dict
+ if integer :
+ 0 = nearest point on bathymetry
1 = linear interpolation
+ if dict : key is a region name, value is a type of interpolation (0 or 1)
+ if None : default type used (0)
m3d: True/False to produce a 3D mesh. Default is False.
xyzFile: True/False to write an ascii file with xyz for every node. Default is False.
Out:
if verbose:
ligne = "nomCas: %s" % nomCas
- ligne += "\ninterpolMethod: %d" % interpolMethod
+ ligne += "\ninterpolMethods: " % regions_interp_method
if (zUndef != None ):
ligne += "\nzUndef: %f" % zUndef
ligne += "\nm3d: %d" % m3d
#print ("vx:\n", vx)
#print ("vy:\n", vy)
#
+ interpolMethod = 0
+ if regions_interp_method is not None:
+ if isinstance(regions_interp_method, dict) and nomreg in regions_interp_method.keys():
+ interpolMethod = int(regions_interp_method[nomreg])
+ elif isinstance(regions_interp_method, int):
+ interpolMethod = regions_interp_method
+
+ #print ('interp', interpolMethod )
vz = cas.GetAltitudesForPoints(vx, vy, region, interpolMethod)
#
#print ("vz:\n", vz)