diff --git a/Inst_eddies/Tests/test_mean_speed.f90 b/Inst_eddies/Tests/test_mean_speed.f90 index 18bac327618e8391f65cdfd8c6bcf3ccb3a42d4f..7f7dc18dc9d57f30f782678819e8c811cbc88975 100644 --- a/Inst_eddies/Tests/test_mean_speed.f90 +++ b/Inst_eddies/Tests/test_mean_speed.f90 @@ -20,12 +20,16 @@ program test_mean_speed real:: center(2) = [9.625, - 33.875] ! longitude and latitude, in degrees integer ncid, varid, dimid integer:: ishape = 0 - integer nlon, nlat + integer nlon, nlat, i real lon_max, lat_max ! longitude and latitude, in degrees real step(2) ! longitude and latitude steps, in degrees real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1 TYPE(shpfileobject) hshp type(polygon) p + + real, allocatable:: points_xy(:, :) ! (2, p%part(1)%n_points) + ! Points given by projection coordinates. + character(len = :), allocatable:: contour_filename real min_lon_p ! minimum longitude of p, in degrees @@ -93,7 +97,10 @@ program test_mean_speed end if p%part(1)%points = p%part(1)%points * deg_to_rad - print *, "mean azimuthal speed = ", mean_speed(u, v, p%part(1), & + allocate(points_xy(2, p%part(1)%n_points)) + forall (i = 1:p%part(1)%n_points) points_xy(:, i) = (p%part(1)%points(:, i) & + - corner) / step + 1. + print *, "mean azimuthal speed = ", mean_speed(u, v, p%part(1), points_xy, & center * deg_to_rad, corner * deg_to_rad, step * deg_to_rad), "m s-1" end program test_mean_speed diff --git a/Inst_eddies/mean_speed.f90 b/Inst_eddies/mean_speed.f90 index 6ece2631f793b131c44be5209b0f5b9dd1f2b828..f83861f5a5692d4746db47b1452faff4b6c880ef 100644 --- a/Inst_eddies/mean_speed.f90 +++ b/Inst_eddies/mean_speed.f90 @@ -4,7 +4,7 @@ module mean_speed_m contains - real function mean_speed(u, v, p, center, corner, step) + real function mean_speed(u, v, p, points_xy, center, corner, step) ! Interpolates the wind at each point of the input polyline and ! computes the mean azimuthal speed at interpolation points. We @@ -26,6 +26,9 @@ contains ! Contour, with points given by longitude and latitude, in ! radians. Should be closed. + real, intent(in):: points_xy(:, :) ! (2, p%n_points) + ! Points given by projection coordinates. + real, intent(in):: center(:) ! (2) ! Longitude and latitude, in rad. Azimuthal speed is computed with ! respect to this point. diff --git a/Inst_eddies/set_max_speed.f90 b/Inst_eddies/set_max_speed.f90 index e5b9615d7050b1160e0553b68a3007091153a7e7..c02fec2821d98a546cf35956fb6b1f1af2cbcd1c 100644 --- a/Inst_eddies/set_max_speed.f90 +++ b/Inst_eddies/set_max_speed.f90 @@ -103,8 +103,8 @@ contains do i = 1, n_cont if (cont_list(i)%closed) then - speed(i) = mean_speed(u, v, cont_list(i)%polyline, extr_coord, & - corner, step) + speed(i) = mean_speed(u, v, cont_list(i)%polyline, & + cont_list_proj(i)%points, extr_coord, corner, step) else ! It is possible that good_contour returned a null polyline ! if there is a missing value of SSH inside the outermost