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

Circumventing gfortran bug: gfortran makes no difference between quiet

and signalling NaN so we cannot use the -ffpe-trap=invalid option.

Accept that we might not be able to compute the mean speed on the
outermost contour: there might be undefined values of velocity
around. In that case just use the contour coming from
max_speed_contour_ssh.

Add quiver_key in plot_snapshot.py.

New test for region 5.
parent 0148e104
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,11 @@ execut = test_good_contour test_inside_4 test_get_1_outerm test_local_extrema te
mode = debug
include ${general_compiler_options_dir}/${FC}_${mode}.mk
comma=,
ifeq (${FC},gfortran)
# gfortran bug:
FFLAGS := $(subst invalid${comma},,${FFLAGS})
endif
# 4. Rules
......
......@@ -92,8 +92,11 @@ if args.velocity:
u_rotated, v_rotated = m.rotate_vector(f["u"][0], f["v"][0], longitude,
latitude)
m.quiver(lon_2d, lat_2d, u_rotated, v_rotated, latlon = True)
quiver_return = m.quiver(lon_2d, lat_2d, u_rotated, v_rotated,
latlon = True, scale = 5, scale_units = "width")
quiverkey(quiver_return, 0.75, 0.9, 0.1, r"0.1 m s$^{-1}$",
coordinates = "figure")
m.drawmeridians(np.linspace(llcrnrlon, urcrnrlon, 6), labels = [0, 0, 0, 1])
m.drawparallels(np.linspace(llcrnrlat, urcrnrlat, 6), labels = [1, 0, 0, 0])
m.drawcoastlines()
......
......@@ -118,14 +118,14 @@
},
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot",
"title": "Get_snapshot_region_1",
"required": [["$input_dir/2006_01/h_region_1.nc", "h.nc"],
["$input_dir/2006_01/uv_region_1.nc", "uv.nc"]],
"input": "0.\n"
},
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot_noise",
"title": "Get_snapshot_region_1_noise",
"required": [["$input_dir/2006_01/h_region_1.nc", "h.nc"],
["$input_dir/2006_01/uv_region_1.nc", "uv.nc"]],
"input": "1e-3\n"
......@@ -177,5 +177,13 @@
["$input_dir/2006_01/uv_region_4.nc", "uv.nc"]],
"input": "1e-3\n",
"description": "Part of the domain has missing values."
},
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot_region_5",
"required": [["$input_dir/2006_01/h_region_5.nc", "h.nc"],
["$input_dir/2006_01/uv_region_5.nc", "uv.nc"]],
"input": "1e-3\n",
"description": "Same as Get_snapshot_region_4 with larger domain."
}
]
......@@ -9,10 +9,7 @@ contains
! Interpolates the wind at each point of the input polygon and
! computes the mean azimuthal speed at interpolation points.
use, intrinsic:: IEEE_ARITHMETIC, only: IEEE_IS_NAN
use contour_531, only: polyline
use nr_util, only: assert
use numer_rec_95, only: bilinear_interp2_reg
real, intent(in):: u(:, :), v(:, :) ! velocity
......@@ -49,7 +46,6 @@ contains
end do
mean_speed = sum(v_azim) / ni
call assert(.not. IEEE_IS_NAN(mean_speed), "mean_speed: nan")
end function mean_speed
......
......@@ -8,6 +8,8 @@ contains
! Defines the components max_speed_contour and max_speed of argument e.
use, intrinsic:: IEEE_ARITHMETIC, only: IEEE_IS_NAN
use contour_531, only: convert_to_reg_coord, convert_to_ind, null_polyline
use derived_types, only: eddy
use geometry, only: polygon_point_dist_2d
......@@ -87,15 +89,20 @@ contains
e%max_speed_contour%ssh, e%coord_extr, nearby_extr)
e%max_speed = mean_speed(u, v, e%max_speed_contour%polyline, &
e%coord_extr, corner, step)
! Might the outermost contour be a better choice?
speed_outerm = mean_speed(u, v, e%outermost_contour%polyline, &
e%coord_extr, corner, step)
if (IEEE_IS_NAN(speed_outerm)) speed_outerm = 0.
! (This may happen when the outermost contour is near land.)
if (abs(speed_outerm) > abs(e%max_speed)) then
! Abandon the contour coming from max_speed_contour_ssh:
e%max_speed_contour = e%outermost_contour
e%max_speed = speed_outerm
else
! Stick to the contour coming from max_speed_contour_ssh.
e%max_speed_contour%area &
= spherical_polygon_area(e%max_speed_contour%polyline)
end if
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment