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

Transmit projection coordinates to `mean_speed`

Transmit projection coordinates of contour to `mean_speed`.
parent 9e08b7b9
No related branches found
No related tags found
No related merge requests found
...@@ -20,12 +20,16 @@ program test_mean_speed ...@@ -20,12 +20,16 @@ program test_mean_speed
real:: center(2) = [9.625, - 33.875] ! longitude and latitude, in degrees real:: center(2) = [9.625, - 33.875] ! longitude and latitude, in degrees
integer ncid, varid, dimid integer ncid, varid, dimid
integer:: ishape = 0 integer:: ishape = 0
integer nlon, nlat integer nlon, nlat, i
real lon_max, lat_max ! longitude and latitude, in degrees real lon_max, lat_max ! longitude and latitude, in degrees
real step(2) ! longitude and latitude steps, in degrees real step(2) ! longitude and latitude steps, in degrees
real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1 real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1
TYPE(shpfileobject) hshp TYPE(shpfileobject) hshp
type(polygon) p type(polygon) p
real, allocatable:: points_xy(:, :) ! (2, p%part(1)%n_points)
! Points given by projection coordinates.
character(len = :), allocatable:: contour_filename character(len = :), allocatable:: contour_filename
real min_lon_p ! minimum longitude of p, in degrees real min_lon_p ! minimum longitude of p, in degrees
...@@ -93,7 +97,10 @@ program test_mean_speed ...@@ -93,7 +97,10 @@ program test_mean_speed
end if end if
p%part(1)%points = p%part(1)%points * deg_to_rad 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" center * deg_to_rad, corner * deg_to_rad, step * deg_to_rad), "m s-1"
end program test_mean_speed end program test_mean_speed
...@@ -4,7 +4,7 @@ module mean_speed_m ...@@ -4,7 +4,7 @@ module mean_speed_m
contains 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 ! Interpolates the wind at each point of the input polyline and
! computes the mean azimuthal speed at interpolation points. We ! computes the mean azimuthal speed at interpolation points. We
...@@ -26,6 +26,9 @@ contains ...@@ -26,6 +26,9 @@ contains
! Contour, with points given by longitude and latitude, in ! Contour, with points given by longitude and latitude, in
! radians. Should be closed. ! radians. Should be closed.
real, intent(in):: points_xy(:, :) ! (2, p%n_points)
! Points given by projection coordinates.
real, intent(in):: center(:) ! (2) real, intent(in):: center(:) ! (2)
! Longitude and latitude, in rad. Azimuthal speed is computed with ! Longitude and latitude, in rad. Azimuthal speed is computed with
! respect to this point. ! respect to this point.
......
...@@ -103,8 +103,8 @@ contains ...@@ -103,8 +103,8 @@ contains
do i = 1, n_cont do i = 1, n_cont
if (cont_list(i)%closed) then if (cont_list(i)%closed) then
speed(i) = mean_speed(u, v, cont_list(i)%polyline, extr_coord, & speed(i) = mean_speed(u, v, cont_list(i)%polyline, &
corner, step) cont_list_proj(i)%points, extr_coord, corner, step)
else else
! It is possible that good_contour returned a null polyline ! It is possible that good_contour returned a null polyline
! if there is a missing value of SSH inside the outermost ! if there is a missing value of SSH inside the outermost
......
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