From: isn Date: Mon, 13 Aug 2018 15:56:27 +0000 (+0300) Subject: refs #1808 Lot 18 (see also hydrosolver) X-Git-Tag: HYDRO_V2_0_0~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=45934b3f995d2278b10a0f1012e4c275a86dfcac;p=modules%2Fhydro.git refs #1808 Lot 18 (see also hydrosolver) --- diff --git a/src/HYDROTools/interpolZ.py b/src/HYDROTools/interpolZ.py index 9f1c978f..7a3e69f3 100644 --- a/src/HYDROTools/interpolZ.py +++ b/src/HYDROTools/interpolZ.py @@ -63,7 +63,7 @@ Constructor # ----------------------------------------------------------------------------- -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. @@ -76,9 +76,12 @@ def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef=90., interpolMet 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: @@ -98,7 +101,7 @@ def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef=90., interpolMet 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 @@ -231,6 +234,14 @@ def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef=90., interpolMet #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)