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

Add component radius4 to type eddy. Use this component radius4 instead

of local variable radius in procedure set_max_speed. Add corresponding
column in outermost_contour DBF file. This is just a diagnostic of the
workings of get_snapshot. Clearer to have this output than having
special meaning in components ssh and area of speed_cont.
parent fc1ef684
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ program test_get_snapshot ...@@ -27,7 +27,7 @@ program test_get_snapshot
TYPE(shpfileobject) hshp_outermost TYPE(shpfileobject) hshp_outermost
! shapefile outermost_contour_$m. The fields in the DBF file are, ! shapefile outermost_contour_$m. The fields in the DBF file are,
! in that order: area, ssh, date index, eddy index, twice. ! in that order: area, ssh, date index, eddy index, twice, radius4.
TYPE(shpfileobject) hshp_max_speed TYPE(shpfileobject) hshp_max_speed
! shapefile x_speed_contour_$m. The fields in the DBF file are, in ! shapefile x_speed_contour_$m. The fields in the DBF file are, in
...@@ -96,6 +96,8 @@ program test_get_snapshot ...@@ -96,6 +96,8 @@ program test_get_snapshot
nwidth = 5, ndecimals = 0) nwidth = 5, ndecimals = 0)
call dbf_add_field_03(ifield, hshp_outermost, 'twice', ftinteger, & call dbf_add_field_03(ifield, hshp_outermost, 'twice', ftinteger, &
nwidth = 1, ndecimals = 0) nwidth = 1, ndecimals = 0)
call dbf_add_field_03(ifield, hshp_outermost, 'radius4', ftinteger, &
nwidth = 2, ndecimals = 0)
call shp_create_03("max_speed_contour_1", shpt_polygon, hshp_max_speed) call shp_create_03("max_speed_contour_1", shpt_polygon, hshp_max_speed)
call dbf_add_field_03(ifield, hshp_max_speed, 'area', ftdouble, nwidth = 20, & call dbf_add_field_03(ifield, hshp_max_speed, 'area', ftdouble, nwidth = 20, &
......
...@@ -33,6 +33,10 @@ module derived_types ...@@ -33,6 +33,10 @@ module derived_types
integer:: delta_out = huge(0) integer:: delta_out = huge(0)
! Maximum difference in time index where there is a direct ! Maximum difference in time index where there is a direct
! successor. huge means there is no direct succcessor. ! successor. huge means there is no direct succcessor.
integer radius4
! ind_extr + radius4 - 1 in all four directions is inside outermost
! contour, ind_extr + radius4 is outside.
end type eddy end type eddy
type snapshot type snapshot
......
...@@ -22,7 +22,8 @@ contains ...@@ -22,7 +22,8 @@ contains
TYPE(shpfileobject), intent(inout):: hshp_outermost TYPE(shpfileobject), intent(inout):: hshp_outermost
! shapefile outermost_contour_$m. We assume that the fields in the ! shapefile outermost_contour_$m. We assume that the fields in the
! DBF file are, in that order: area, ssh, date index, eddy index, twice. ! DBF file are, in that order: area, ssh, date index, eddy index,
! twice, radius4.
TYPE(shpfileobject), intent(inout):: hshp_max_speed TYPE(shpfileobject), intent(inout):: hshp_max_speed
! shapefile x_speed_contour_$m. We assume that the fields in the ! shapefile x_speed_contour_$m. We assume that the fields in the
......
...@@ -106,6 +106,7 @@ contains ...@@ -106,6 +106,7 @@ contains
s%list_vis(i)%speed_cont%ssh = s%list_vis(i)%ssh_extr s%list_vis(i)%speed_cont%ssh = s%list_vis(i)%ssh_extr
s%list_vis(i)%speed_cont%area = 0. s%list_vis(i)%speed_cont%area = 0.
s%list_vis(i)%max_speed = 0. s%list_vis(i)%max_speed = 0.
s%list_vis(i)%radius4 = 0
end if end if
end do end do
......
...@@ -6,7 +6,7 @@ contains ...@@ -6,7 +6,7 @@ contains
subroutine set_max_speed(e, ind_targ_extr, extr_map, ssh, u, v, corner, step) subroutine set_max_speed(e, ind_targ_extr, extr_map, ssh, u, v, corner, step)
! Defines the components speed_cont and max_speed of argument e. ! Defines the components speed_cont, max_speed and radius4 of argument e.
use, intrinsic:: IEEE_ARITHMETIC, only: IEEE_IS_NAN use, intrinsic:: IEEE_ARITHMETIC, only: IEEE_IS_NAN
...@@ -40,11 +40,6 @@ contains ...@@ -40,11 +40,6 @@ contains
! Local: ! Local:
logical noise_around logical noise_around
integer radius
! ind_extr + radius - 1 in all four directions is inside outermost
! contour, ind_extr + radius is outside. radius should be >= 2.
integer i ! identifying number of the eddy integer i ! identifying number of the eddy
real, allocatable:: nearby_extr(:, :) ! (2, :) longitude and real, allocatable:: nearby_extr(:, :) ! (2, :) longitude and
...@@ -56,32 +51,32 @@ contains ...@@ -56,32 +51,32 @@ contains
noise_around = any(extr_map < 0) noise_around = any(extr_map < 0)
! Compute radius from distance in index space, as a lower bound: ! Compute e%radius4 from distance in index space, as a lower bound:
radius = floor(polygon_point_dist_2d(convert_to_ind(e%out_cont%points, & e%radius4 = floor(polygon_point_dist_2d(convert_to_ind(e%out_cont%points, &
corner, step), real(ind_targ_extr))) + 1 corner, step), real(ind_targ_extr))) + 1
do while (inside_4(radius * step, e%coord_extr, e%out_cont%points)) do while (inside_4(e%radius4 * step, e%coord_extr, e%out_cont%points))
radius = radius + 1 e%radius4 = e%radius4 + 1
end do end do
! Might the outermost contour be a better choice? ! Might the outermost contour be a better choice?
speed_outerm = mean_speed(u, v, e%out_cont%polyline, e%coord_extr, corner, & speed_outerm = mean_speed(u, v, e%out_cont%polyline, e%coord_extr, corner, &
step) step)
if (radius == 1) then if (e%radius4 == 1) then
! We cannot look for a maximum speed contour other than out_cont. ! We cannot look for a maximum speed contour other than out_cont.
e%speed_cont%ssh = e%ssh_extr ! flag for radius == 1 e%speed_cont%ssh = e%ssh_extr
e%speed_cont%polyline = null_polyline() e%speed_cont%polyline = null_polyline()
e%speed_cont%area = 0. ! flag for radius == 1 e%speed_cont%area = 0.
e%max_speed = speed_outerm e%max_speed = speed_outerm
! (We will maybe need this to compute the weight of edges in ! (We will maybe need this to compute the weight of edges in
! the tracking graph.) ! the tracking graph.)
else else
! {radius >= 2} ! {e%radius4 >= 2}
e%speed_cont%ssh = max_speed_contour_ssh(ssh, u, v, ind_targ_extr, & e%speed_cont%ssh = max_speed_contour_ssh(ssh, u, v, ind_targ_extr, &
radius) e%radius4)
i = extr_map(ind_targ_extr(1), ind_targ_extr(2)) i = extr_map(ind_targ_extr(1), ind_targ_extr(2))
if (noise_around) then if (noise_around) then
......
...@@ -25,7 +25,8 @@ contains ...@@ -25,7 +25,8 @@ contains
TYPE(shpfileobject), intent(inout):: hshp_outermost TYPE(shpfileobject), intent(inout):: hshp_outermost
! shapefile outermost_contour_$m. We assume that the fields in the ! shapefile outermost_contour_$m. We assume that the fields in the
! DBF file are, in that order: area, ssh, date index, eddy index, twice. ! DBF file are, in that order: area, ssh, date index, eddy index,
! twice, radius4.
TYPE(shpfileobject), intent(inout):: hshp_max_speed TYPE(shpfileobject), intent(inout):: hshp_max_speed
! shapefile x_speed_contour_$m. We assume that the fields in the ! shapefile x_speed_contour_$m. We assume that the fields in the
...@@ -75,6 +76,7 @@ contains ...@@ -75,6 +76,7 @@ contains
call dbf_write_attribute_03(hshp_outermost, ishape, 2, k) call dbf_write_attribute_03(hshp_outermost, ishape, 2, k)
call dbf_write_attribute_03(hshp_outermost, ishape, 3, i) call dbf_write_attribute_03(hshp_outermost, ishape, 3, i)
call dbf_write_attribute_03(hshp_outermost, ishape, 4, merge(1, 0, e%twice)) call dbf_write_attribute_03(hshp_outermost, ishape, 4, merge(1, 0, e%twice))
call dbf_write_attribute_03(hshp_outermost, ishape, 5, e%radius4)
call dbf_write_attribute_03(hshp_max_speed, ishape, 0, & call dbf_write_attribute_03(hshp_max_speed, ishape, 0, &
e%speed_cont%area) e%speed_cont%area)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment