mirror of https://gitlab.com/pamhyr/pamhyr2
work on vater limits for top view visualization
parent
d79a0cc973
commit
21197ead23
|
|
@ -351,3 +351,7 @@ class Profile(object):
|
||||||
# Abstract method for width approximation
|
# Abstract method for width approximation
|
||||||
def width_approximation(self):
|
def width_approximation(self):
|
||||||
raise NotImplementedMethodeError(self, self.width_approximation)
|
raise NotImplementedMethodeError(self, self.width_approximation)
|
||||||
|
|
||||||
|
# Abstract method for width approximation
|
||||||
|
def get_water_limits(self, z):
|
||||||
|
raise NotImplementedMethodeError(self, self.get_water_limits)
|
||||||
|
|
|
||||||
|
|
@ -442,3 +442,44 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
rd = self.get_point_by_name("rd")
|
rd = self.get_point_by_name("rd")
|
||||||
|
|
||||||
return abs(rg.dist(rd))
|
return abs(rg.dist(rd))
|
||||||
|
|
||||||
|
def get_water_limits(self, z):
|
||||||
|
#==============================================================================
|
||||||
|
# détermination des points limites RG et RD pour un niveau d'eau donné
|
||||||
|
#
|
||||||
|
# irg et ird sont les premiers indices en partant des rives gauche et
|
||||||
|
# droite qui correspondent à des points sous la surface de l'eau
|
||||||
|
# ptX et ptY sont les points interpolés où le plan d'eau intersecte le profil
|
||||||
|
# known_level est le niveau d'eau pour lequel on a obtenu irg, ird, ptX et ptY
|
||||||
|
#==============================================================================
|
||||||
|
# initialisation
|
||||||
|
irg = -1 ; ird = -1
|
||||||
|
for i in range(self.number_points):
|
||||||
|
if self.point(i).z <= z:
|
||||||
|
irg = i
|
||||||
|
for i in reversed(range(self.number_points)):
|
||||||
|
if self.point(i).z <= z:
|
||||||
|
ird = i
|
||||||
|
# interpolation des points ptX et ptY
|
||||||
|
if (irg > 0):
|
||||||
|
x=np.interp(z,
|
||||||
|
[self.point(irg).z,self.point(irg+1).z],
|
||||||
|
[self.point(irg).x,self.point(irg+1).x])
|
||||||
|
y=np.interp(z,
|
||||||
|
[self.point(irg).z,self.point(irg+1).z],
|
||||||
|
[self.point(irg).y,self.point(irg+1).y])
|
||||||
|
ptX=PointXYZ(x,y,z)
|
||||||
|
else:
|
||||||
|
ptX = self.point(0)
|
||||||
|
if (ird < self.number_points-1):
|
||||||
|
x=np.interp(z,
|
||||||
|
[self.point(ird).z,self.point(ird+1).z],
|
||||||
|
[self.point(ird).x,self.point(ird+1).x])
|
||||||
|
y=np.interp(z,
|
||||||
|
[self.point(ird).z,self.point(ird+1).z],
|
||||||
|
[self.point(ird).y,self.point(ird+1).y])
|
||||||
|
ptY=PointXYZ(x,y,z)
|
||||||
|
else:
|
||||||
|
ptY = self.point(self.number_points-1)
|
||||||
|
|
||||||
|
return ptX,ptY
|
||||||
|
|
|
||||||
|
|
@ -813,6 +813,12 @@ class Mage8(Mage):
|
||||||
|
|
||||||
# Set data for profile RI
|
# Set data for profile RI
|
||||||
reach.set(ri, timestamp, key, d)
|
reach.set(ri, timestamp, key, d)
|
||||||
|
if key == "Z":
|
||||||
|
profile = study.river.current_reach().reach.profile(ri)
|
||||||
|
ptX,ptY = profile.get_water_limits(d)
|
||||||
|
reach.set(ri, timestamp, "ptX", ptX)
|
||||||
|
reach.set(ri, timestamp, "ptY", ptY)
|
||||||
|
|
||||||
|
|
||||||
endline()
|
endline()
|
||||||
end = newline().size <= 0
|
end = newline().size <= 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue