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

Rename component `list_vis` of snapshot to list

Rename component `list_vis` of derived type snapshot to list. Since
there are no longer invisible (interpolated) eddies.
parent 5ea88d58
No related branches found
No related tags found
No related merge requests found
......@@ -39,10 +39,10 @@ module derived_types
end type eddy
type snapshot
type(eddy), allocatable:: list_vis(:) ! (number_extr)
type(eddy), allocatable:: list(:) ! (number_extr)
! Visible "eddies" at a given date. These include "eddies"
! without an outermost contour, that is only the extremum is
! visible. The subscript value in list_vis is the "identification
! visible. The subscript value in list is the "identification
! number" of the extremum.
integer number_extr ! number of visible extrema
......
......@@ -49,7 +49,7 @@ contains
end if
s%number_extr = ishape_last(k + 1) - ishape_first + 1
allocate(s%list_vis(s%number_extr))
allocate(s%list(s%number_extr))
do ishape = ishape_first, ishape_last(k + 1)
call read_eddy(e, d, i, hshp, ishape)
......@@ -57,12 +57,12 @@ contains
! Check that all the eddies have the same date index:
call assert(d - d_init == k, "read_snapshot: date index")
s%list_vis(i) = e
s%list(i) = e
end do
allocate(s%ind_extr(2, s%number_extr))
forall (i = 1:s%number_extr) s%ind_extr(:, i) &
= nint(convert_to_ind(s%list_vis(i)%coord_extr, corner, step))
= nint(convert_to_ind(s%list(i)%coord_extr, corner, step))
! Define s%extr_map from s%ind_extr:
......
......@@ -55,7 +55,7 @@ program test_nearby_extr
copy = 0, ishape_last = [ishape_last])
CALL shpc_close(hshp)
nearby = nearby_extr(s%extr_map, s%list_vis, i = 4)
nearby = nearby_extr(s%extr_map, s%list, i = 4)
print *, "nearby:"
do l = 1, size(nearby, 2)
......
......@@ -83,9 +83,9 @@ program test_set_all_outerm
min_area = pi * (min_radius * 1e3)**2)
do i = 1, s%number_extr
s%list_vis(i)%speed_cont = null_ssh_contour()
s%list_vis(i)%max_speed = missing_speed
s%list_vis(i)%radius4 = 0
s%list(i)%speed_cont = null_ssh_contour()
s%list(i)%max_speed = missing_speed
s%list(i)%radius4 = 0
end do
call shpc_create(hshp_cyclo, shpc_dir = "SHPC_cyclo", cyclone = .true.)
......@@ -94,12 +94,12 @@ program test_set_all_outerm
n_anti = 0
do i = 1, s%number_extr
if (s%list_vis(i)%cyclone) then
if (s%list(i)%cyclone) then
n_cyclo = n_cyclo + 1
call write_eddy(s%list_vis(i), hshp_cyclo, days_1950 = 1, i = n_cyclo)
call write_eddy(s%list(i), hshp_cyclo, days_1950 = 1, i = n_cyclo)
else
n_anti = n_anti + 1
call write_eddy(s%list_vis(i), hshp_anti, days_1950 = 1, i = n_anti)
call write_eddy(s%list(i), hshp_anti, days_1950 = 1, i = n_anti)
end if
end do
......@@ -109,6 +109,6 @@ program test_set_all_outerm
CALL shpc_close(hshp_anti)
print *, 'Created shapefile collections in SHPC_cyclo and SHPC_anti.'
print *, "Average number of points per outermost contour: ", &
sum(s%list_vis%out_cont%n_points) / real(s%number_extr)
sum(s%list%out_cont%n_points) / real(s%number_extr)
end program test_set_all_outerm
......@@ -143,14 +143,14 @@ program inst_eddies
! max-speed contours.
do i = 1, s%number_extr
if (s%list_vis(i)%valid) then
if (s%list(i)%valid) then
! Restrict the field to the outermost contour:
llc = floor(convert_to_ind(minval(s%list_vis(i)%out_cont%points, &
llc = floor(convert_to_ind(minval(s%list(i)%out_cont%points, &
dim = 2), corner, step))
urc = ceiling(convert_to_ind(maxval( &
s%list_vis(i)%out_cont%points, dim = 2), corner, step))
s%list(i)%out_cont%points, dim = 2), corner, step))
! Should have no effect except because of roundup error:
urc(2) = min(urc(2), nlat)
......@@ -159,7 +159,7 @@ program inst_eddies
corner_window = corner + (llc - 1) * step
outside_points = nearby_extr(s%extr_map(llc(1):urc(1), &
llc(2):urc(2)), s%list_vis, i)
llc(2):urc(2)), s%list, i)
if (periodic) outside_points(1, :) = outside_points(1, :) &
+ ceiling((corner_window(1) - outside_points(1, :)) / twopi) &
......@@ -167,14 +167,14 @@ program inst_eddies
! (Shift the longitude of each point to a value close to
! the longitude of the target extremum.)
call set_max_speed(s%list_vis(i), s%ind_extr(:, i) - llc + 1, &
call set_max_speed(s%list(i), s%ind_extr(:, i) - llc + 1, &
outside_points, ssh(llc(1):urc(1), llc(2):urc(2)), &
u(llc(1):urc(1), llc(2):urc(2)), &
v(llc(1):urc(1), llc(2):urc(2)), corner_window, step)
else
s%list_vis(i)%speed_cont = null_ssh_contour()
s%list_vis(i)%max_speed = missing_speed
s%list_vis(i)%radius4 = 0
s%list(i)%speed_cont = null_ssh_contour()
s%list(i)%max_speed = missing_speed
s%list(i)%radius4 = 0
end if
end do
......@@ -194,12 +194,12 @@ program inst_eddies
n_anti = 0
do i = 1, s%number_extr
if (s%list_vis(i)%cyclone) then
if (s%list(i)%cyclone) then
n_cyclo = n_cyclo + 1
call write_eddy(s%list_vis(i), hshpc_cyclo, days_1950, n_cyclo)
call write_eddy(s%list(i), hshpc_cyclo, days_1950, n_cyclo)
else
n_anti = n_anti + 1
call write_eddy(s%list_vis(i), hshpc_anti, days_1950, n_anti)
call write_eddy(s%list(i), hshpc_anti, days_1950, n_anti)
end if
end do
......
......@@ -24,7 +24,7 @@ contains
type(snapshot), intent(out):: s
! Specifically: define everything in s except
! s%list_vis%speed_cont, s%list_vis%max_speed and s%list_vis%radius4.
! s%list%speed_cont, s%list%max_speed and s%list%radius4.
integer, intent(in):: max_radius(:) ! (2) maximum radius of an
! eddy in longitude and latitude, in number of grid points
......@@ -100,17 +100,17 @@ contains
end if
s%number_extr = size(s%ind_extr, 2)
allocate(s%list_vis(s%number_extr), sorted_extr(s%number_extr))
allocate(s%list(s%number_extr), sorted_extr(s%number_extr))
forall (i = 1:s%number_extr)
s%list_vis(i)%coord_extr = corner + (s%ind_extr(:, i) - 1) * step
s%list(i)%coord_extr = corner + (s%ind_extr(:, i) - 1) * step
! (Even when periodic, this is within the original NetCDF grid,
! that is the grid without duplicated longitudes.)
s%list_vis(i)%ssh_extr = ssh(s%ind_extr(1, i), s%ind_extr(2, i))
s%list_vis(i)%cyclone = cyclone(i)
s%list(i)%ssh_extr = ssh(s%ind_extr(1, i), s%ind_extr(2, i))
s%list(i)%cyclone = cyclone(i)
s%list_vis(i)%valid = .true.
s%list(i)%valid = .true.
! must be intialized to true because it is used in nearby_extr
end forall
......@@ -118,11 +118,11 @@ contains
selection = argwhere(cyclone)
n_cycl = size(selection)
selection = selection(indexx(s%list_vis(selection)%ssh_extr))
selection = selection(indexx(s%list(selection)%ssh_extr))
sorted_extr(:n_cycl) = selection(n_cycl:1:- 1) ! descending order of ssh
selection = argwhere(.not. cyclone)
selection = selection(indexx(s%list_vis(selection)%ssh_extr))
selection = selection(indexx(s%list(selection)%ssh_extr))
sorted_extr(n_cycl + 1:) = selection
do l = 1, s%number_extr
......@@ -144,20 +144,20 @@ contains
corner_window = corner + (llc - 1) * step
! No need to consider contours with amplitudes < min_amp:
if (abs(s%list_vis(i)%ssh_extr - innermost_level(i)) < min_amp) &
innermost_level(i) = s%list_vis(i)%ssh_extr &
+ merge(min_amp, - min_amp, s%list_vis(i)%cyclone)
if (abs(s%list(i)%ssh_extr - innermost_level(i)) < min_amp) &
innermost_level(i) = s%list(i)%ssh_extr &
+ merge(min_amp, - min_amp, s%list(i)%cyclone)
outside_points = nearby_extr(s%extr_map(llc(1):urc(1), llc(2):urc(2)), &
s%list_vis, i)
s%list, i)
if (periodic) outside_points(1, :) = outside_points(1, :) &
+ ceiling((corner_window(1) - outside_points(1, :)) / twopi) * twopi
! (Shift the longitude of each point to a value close to the
! longitude of the target extremum.)
s%list_vis(i)%out_cont = get_1_outerm(s%list_vis(i)%cyclone, &
s%list_vis(i)%coord_extr, innermost_level(i), outside_points, &
s%list(i)%out_cont = get_1_outerm(s%list(i)%cyclone, &
s%list(i)%coord_extr, innermost_level(i), outside_points, &
ssh(llc(1):urc(1), llc(2):urc(2)), corner_window, step)
s%list_vis(i)%valid = s%list_vis(i)%out_cont%area >= min_area
s%list(i)%valid = s%list(i)%out_cont%area >= min_area
end do
end subroutine set_all_outerm
......
......@@ -83,12 +83,12 @@ program test_overlap
call read_snapshot(flow(max_delta + 1), hshp, nlon, nlat, d_init, k_test_2, &
corner, step, copy, ishape_last)
CALL shpc_close(hshp)
print *, "Enter flow(1)%list_vis%delta_out (array with ", &
print *, "Enter flow(1)%list%delta_out (array with ", &
flow(1)%number_extr, " values):"
read *, flow(1)%list_vis%delta_out
print *, "Enter flow(max_delta + 1)%list_vis%delta_in (array with ", &
read *, flow(1)%list%delta_out
print *, "Enter flow(max_delta + 1)%list%delta_in (array with ", &
flow(max_delta + 1)%number_extr, " values)):"
read *, flow(max_delta + 1)%list_vis%delta_in
read *, flow(max_delta + 1)%list%delta_in
call open_edge_file(rank = 0)
call overlap(flow, nlon, nlat, periodic, dist_lim, e_overestim, &
k = k_test_2, delta = max_delta, j = max_delta + 1)
......@@ -98,7 +98,7 @@ program test_overlap
print *, k_test_1, ":"
print *, "Valid isolated eddies:"
do i = 1, flow(1)%number_extr
if (flow(1)%list_vis(i)%valid .and. flow(1)%list_vis(i)%delta_out &
if (flow(1)%list(i)%valid .and. flow(1)%list(i)%delta_out &
== huge(0)) write(unit = *, fmt = "(i0, 1x)", advance = "no") i
end do
print *
......@@ -108,8 +108,8 @@ program test_overlap
print *, "Valid isolated eddies:"
do i = 1, flow(max_delta + 1)%number_extr
if (flow(max_delta + 1)%list_vis(i)%valid &
.and. flow(max_delta + 1)%list_vis(i)%delta_in == huge(0)) &
if (flow(max_delta + 1)%list(i)%valid &
.and. flow(max_delta + 1)%list(i)%delta_in == huge(0)) &
write(unit = *, fmt = "(i0, 1x)", advance = "no") i
end do
......
......@@ -35,11 +35,11 @@ contains
!-----------------------------------------------------------------
call shpc_create(hshp, shpc_dir = "SHPC", cyclone = s%list_vis(1)%cyclone)
call shpc_create(hshp, shpc_dir = "SHPC", cyclone = s%list(1)%cyclone)
! Write snapshot:
do i = 1, s%number_extr
call write_eddy(s%list_vis(i), hshp, d, i)
call write_eddy(s%list(i), hshp, d, i)
end do
CALL shpc_close(hshp)
......
......@@ -27,8 +27,8 @@ contains
d = k + d_init
do i = 1, s%number_extr
if (s%list_vis(i)%valid .and. s%list_vis(i)%delta_in == huge(0) &
.and. s%list_vis(i)%delta_out == huge(0)) &
if (s%list(i)%valid .and. s%list(i)%delta_in == huge(0) &
.and. s%list(i)%delta_out == huge(0)) &
write(unit_isolated, fmt = *) d, i
end do
else
......
......@@ -9,8 +9,8 @@ contains
! This procedure finds edges between flow(j - delta) and flow(j),
! corresponding to date indices k - delta and k. It writes these
! edges. It updates flow(j - delta)%list_vis%delta_out and
! flow(j)%list_vis%delta_in.
! edges. It updates flow(j - delta)%list%delta_out and
! flow(j)%list%delta_in.
! Libraries:
use contour_531, only: polyline
......@@ -59,7 +59,7 @@ contains
!-----------------------------------------------------------------------
loop_i1: do i1 = 1, flow(j - delta)%number_extr
test_valid: if (flow(j - delta)%list_vis(i1)%valid) then
test_valid: if (flow(j - delta)%list(i1)%valid) then
! Define the geographical window around each eddy extremum:
llc = flow(j - delta)%ind_extr(:, i1) - dist_lim
......@@ -75,35 +75,35 @@ contains
! Pre-select potential successors:
selection = candidate_overlap(flow(j)%extr_map(llc(1):urc(1), &
llc(2):urc(2)), flow(j)%list_vis, &
flow(j - delta)%list_vis(i1)%delta_out, delta)
llc(2):urc(2)), flow(j)%list, &
flow(j - delta)%list(i1)%delta_out, delta)
n_select = size(selection)
if (n_select /= 0) then
if (flow(j - delta)%list_vis(i1)%speed_cont%n_points /= 0) then
polyline_1 = flow(j - delta)%list_vis(i1)%speed_cont%polyline
if (flow(j - delta)%list(i1)%speed_cont%n_points /= 0) then
polyline_1 = flow(j - delta)%list(i1)%speed_cont%polyline
else
polyline_1 = flow(j - delta)%list_vis(i1)%out_cont%polyline
polyline_1 = flow(j - delta)%list(i1)%out_cont%polyline
end if
end if
DO l = 1, n_select
i2 = selection(l)
! Assertion: {flow(j - delta)%list_vis(i1)%delta_out >=
! delta .or. flow(j)%list_vis(i2)%delta_in >= delta}
! Assertion: {flow(j - delta)%list(i1)%delta_out >=
! delta .or. flow(j)%list(i2)%delta_in >= delta}
if (flow(j)%list_vis(i2)%speed_cont%n_points /= 0) then
polyline_2 = flow(j)%list_vis(i2)%speed_cont%polyline
if (flow(j)%list(i2)%speed_cont%n_points /= 0) then
polyline_2 = flow(j)%list(i2)%speed_cont%polyline
else
polyline_2 = flow(j)%list_vis(i2)%out_cont%polyline
polyline_2 = flow(j)%list(i2)%out_cont%polyline
end if
! Shift the longitudes of polyline_2 to values close to the
! longitude of extremum i1:
polyline_2%points(1, :) = polyline_2%points(1, :) &
+ floor((flow(j - delta)%list_vis(i1)%coord_extr(1) &
- flow(j)%list_vis(i2)%coord_extr(1)) / twopi + 0.5) * twopi
+ floor((flow(j - delta)%list(i1)%coord_extr(1) &
- flow(j)%list(i2)%coord_extr(1)) / twopi + 0.5) * twopi
call gpc_polygon_clip_f(GPC_INT, &
polygon(nparts = 1, part = [polyline_1], hole = [.false.]), &
......@@ -117,12 +117,12 @@ contains
spher_polyline_area(polyline_2))) then
write(unit_edge, fmt = *) (k - delta) * e_overestim + i1, &
k * e_overestim + i2, &
weight(flow(j - delta)%list_vis(i1), &
flow(j)%list_vis(i2))
flow(j - delta)%list_vis(i1)%delta_out &
= min(flow(j - delta)%list_vis(i1)%delta_out, delta)
flow(j)%list_vis(i2)%delta_in &
= min(flow(j)%list_vis(i2)%delta_in, delta)
weight(flow(j - delta)%list(i1), &
flow(j)%list(i2))
flow(j - delta)%list(i1)%delta_out &
= min(flow(j - delta)%list(i1)%delta_out, delta)
flow(j)%list(i2)%delta_in &
= min(flow(j)%list(i2)%delta_in, delta)
end if
end if
end DO
......
......@@ -27,19 +27,19 @@ contains
!-----------------------------------------------------------
call ezmpi_recv(s%number_extr, source, tag)
allocate(s%list_vis(s%number_extr))
allocate(s%list(s%number_extr))
do i = 1, s%number_extr
call ezmpi_recv(s%list_vis(i)%coord_extr, source, tag)
call ezmpi_recv(s%list_vis(i)%ssh_extr, source, tag)
call ezmpi_recv(s%list_vis(i)%cyclone, source, tag)
call recv_ssh_contour(s%list_vis(i)%out_cont, source, tag)
call recv_ssh_contour(s%list_vis(i)%speed_cont, source, tag)
call ezmpi_recv(s%list_vis(i)%max_speed, source, tag)
call ezmpi_recv(s%list_vis(i)%valid, source, tag)
call ezmpi_recv(s%list_vis(i)%delta_in, source, tag)
call ezmpi_recv(s%list_vis(i)%delta_out, source, tag)
call ezmpi_recv(s%list_vis(i)%radius4, source, tag)
call ezmpi_recv(s%list(i)%coord_extr, source, tag)
call ezmpi_recv(s%list(i)%ssh_extr, source, tag)
call ezmpi_recv(s%list(i)%cyclone, source, tag)
call recv_ssh_contour(s%list(i)%out_cont, source, tag)
call recv_ssh_contour(s%list(i)%speed_cont, source, tag)
call ezmpi_recv(s%list(i)%max_speed, source, tag)
call ezmpi_recv(s%list(i)%valid, source, tag)
call ezmpi_recv(s%list(i)%delta_in, source, tag)
call ezmpi_recv(s%list(i)%delta_out, source, tag)
call ezmpi_recv(s%list(i)%radius4, source, tag)
end do
allocate(s%extr_map(1 - copy:nlon + copy, nlat))
......
......@@ -25,16 +25,16 @@ contains
call ezmpi_send(s%number_extr, dest, tag)
do i = 1, s%number_extr
call ezmpi_send(s%list_vis(i)%coord_extr, dest, tag)
call ezmpi_send(s%list_vis(i)%ssh_extr, dest, tag)
call ezmpi_send(s%list_vis(i)%cyclone, dest, tag)
call send_ssh_contour(s%list_vis(i)%out_cont, dest, tag)
call send_ssh_contour(s%list_vis(i)%speed_cont, dest, tag)
call ezmpi_send(s%list_vis(i)%max_speed, dest, tag)
call ezmpi_send(s%list_vis(i)%valid, dest, tag)
call ezmpi_send(s%list_vis(i)%delta_in, dest, tag)
call ezmpi_send(s%list_vis(i)%delta_out, dest, tag)
call ezmpi_send(s%list_vis(i)%radius4, dest, tag)
call ezmpi_send(s%list(i)%coord_extr, dest, tag)
call ezmpi_send(s%list(i)%ssh_extr, dest, tag)
call ezmpi_send(s%list(i)%cyclone, dest, tag)
call send_ssh_contour(s%list(i)%out_cont, dest, tag)
call send_ssh_contour(s%list(i)%speed_cont, dest, tag)
call ezmpi_send(s%list(i)%max_speed, dest, tag)
call ezmpi_send(s%list(i)%valid, dest, tag)
call ezmpi_send(s%list(i)%delta_in, dest, tag)
call ezmpi_send(s%list(i)%delta_out, dest, tag)
call ezmpi_send(s%list(i)%radius4, dest, tag)
end do
call ezmpi_send(s%extr_map, dest, tag)
......
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