Skip to content
Snippets Groups Projects
Commit 67eeff1a authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Bug fix: check we find a max-speed contour

Check we find a max-speed contour when `e%radius4 >= 2` and
`e%speed_cont%ssh /= missing_ssh`. See test `Set_max_speed_degenerate`
for a case when we do not find one.
parent 7e1d864a
No related branches found
No related tags found
No related merge requests found
......@@ -91,23 +91,34 @@ contains
else
e%speed_cont%polyline = good_contour(corner, step, ssh, &
e%speed_cont%ssh, e%coord_extr, outside_points)
e%max_speed = mean_speed(u, v, e%speed_cont%polyline, e%coord_extr, &
corner, step)
if (IEEE_IS_NAN(speed_outerm)) then
! This may happen when the outermost contour is near land.
! Stick to the contour coming from max_speed_contour_ssh.
e%speed_cont%area = spher_polyline_area(e%speed_cont%polyline)
if (e%speed_cont%n_points == 0) then
! This may happen if there is the exact same value of ssh
! next to the extremum and this value is
! e%speed_cont%ssh.
e%speed_cont%ssh = missing_ssh
e%speed_cont%area = - 1e6
e%max_speed = speed_outerm
else
! Note the following test should raise an invalid exception
! if e%max_speed is NaN.
if (abs(speed_outerm) > abs(e%max_speed)) then
! Abandon the contour coming from max_speed_contour_ssh:
e%speed_cont = null_ssh_contour()
e%max_speed = speed_outerm
else
e%max_speed = mean_speed(u, v, e%speed_cont%polyline, &
e%coord_extr, corner, step)
if (IEEE_IS_NAN(speed_outerm)) then
! This may happen when the outermost contour is near land.
! Stick to the contour coming from max_speed_contour_ssh.
e%speed_cont%area = spher_polyline_area(e%speed_cont%polyline)
else
! Note the following test should raise an invalid exception
! if e%max_speed is NaN.
if (abs(speed_outerm) > abs(e%max_speed)) then
! Abandon the contour coming from max_speed_contour_ssh:
e%speed_cont = null_ssh_contour()
e%max_speed = speed_outerm
else
! Stick to the contour coming from max_speed_contour_ssh.
e%speed_cont%area &
= spher_polyline_area(e%speed_cont%polyline)
end if
end if
end if
end if
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment