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

Generalize `test_successive_overlap`

Rename `test_successive_overlap` to `test_overlap`: we will also use
it for non-successive overlap. Accordingly, add an input variable
`max_delta` and change the size of flow to `max_delta` + 1. We read
from snapshots `flow(1)` and `flow(max_delta + 1)`. For
`flow(2:max_delta)`, we only need to define the component
`number_eddies`.
parent ef7abf1b
No related branches found
No related tags found
No related merge requests found
......@@ -18,16 +18,16 @@ target_link_libraries(test_nearby_extr ${contour_531_LIBRARY}
${netcdf95_LIBRARY} ${netcdff_LIBRARY} ${NetCDF_LIBRARY}
${shapelib_03_LIBRARY})
# test_successive_overlap
# test_overlap
add_executable(test_successive_overlap derived_types.f90 overlap.f90
add_executable(test_overlap derived_types.f90 overlap.f90
read_snapshot.f90 spher_polygon_area.f90 spher_polyline_area.f90
weight.f90 read_eddy.f90 read_field_indices.f90
candidate_overlap.f90 write_eddy.f90 init_shapefiles.f90
write_overlap.f90
${CMAKE_CURRENT_LIST_DIR}/test_successive_overlap.f90)
${CMAKE_CURRENT_LIST_DIR}/test_overlap.f90)
target_link_libraries(test_successive_overlap ${contour_531_LIBRARY}
target_link_libraries(test_overlap ${contour_531_LIBRARY}
${fortrangis_LIBRARY} ${fortranc_LIBRARY} ${shapelib_LIBRARY}
${GPC_F_LIBRARY} ${GPC_LIBRARY} ${shapelib_03_LIBRARY}
${jumble_LIBRARY} ${nr_util_LIBRARY} ${geometry_LIBRARY})
......
......@@ -225,7 +225,7 @@
"input" : "f"
},
{
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_successive_overlap",
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_overlap",
"$src_dir/Tests/Input/Region_4_2006_01_01/SHP_triplet",
"$src_dir/Tests/Input/Region_4_2006_01_01/SHP_triplet"],
"title" : "Successive_overlap",
......@@ -242,7 +242,7 @@
]
},
{
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_successive_overlap",
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_overlap",
"$src_dir/Tests/Input/Extraction_eddies_region_5/SHP_triplet",
"$src_dir/Tests/Input/Extraction_eddies_region_5/SHP_triplet"],
"title" : "Successive_overlap_region_5_one_date",
......@@ -279,7 +279,7 @@
"description": "Periodic domain."
},
{
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_successive_overlap",
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_overlap",
"$src_dir/Tests/Input/Extraction_eddies_periodic/SHP_triplet",
"$src_dir/Tests/Input/Extraction_eddies_periodic/SHP_triplet"
],
......@@ -288,7 +288,7 @@
"stdin_filename": "$src_dir/Tests/Input/successive_overlap_periodic_nml.txt"
},
{
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_successive_overlap",
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_overlap",
"$src_dir/Tests/Input/Region_4_2006_01_01/SHP_triplet",
"$src_dir/Tests/Input/Region_4_2006_01_02/SHP_triplet"],
"title" : "Successive_overlap_different_snapshots",
......@@ -296,7 +296,7 @@
"stdin_filename": "$src_dir/Tests/Input/successive_overlap_nml.txt"
},
{
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_successive_overlap",
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_overlap",
"$src_dir/Tests/Input/Extraction_eddies_region_2_noise/SHP_triplet",
"$src_dir/Tests/Input/Region_2_2006_01_02/SHP_triplet"],
"title" : "Successive_overlap_region_2",
......@@ -304,7 +304,7 @@
"stdin_filename": "$src_dir/Tests/Input/successive_overlap_region_2_nml.txt"
},
{
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_successive_overlap",
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_overlap",
"$src_dir/Tests/Input/Extraction_eddies_region_5/SHP_triplet",
"$src_dir/Tests/Input/SHP_triplet_region_5_2006_01_02"],
"title" : "Successive_overlap_region_5",
......@@ -312,7 +312,7 @@
"stdin_filename": "$src_dir/Tests/Input/successive_overlap_region_5_nml.txt"
},
{
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_successive_overlap",
"args" : ["$src_dir/mkdir_run.sh", "$build_dir/test_overlap",
"$large_input_dir/SHP_triplet_2006_01_01",
"$large_input_dir/SHP_triplet_2006_01_02"],
"title" : "Successive_overlap_global",
......
program test_successive_overlap
program test_overlap
use, intrinsic:: ISO_FORTRAN_ENV
......@@ -18,7 +18,7 @@ program test_successive_overlap
character(len = :), allocatable:: snapshot_1, snapshot_2
integer unit_edgelist, i, k
type(snapshot) flow(2)
type(snapshot), allocatable:: flow(:) ! (max_delta + 1)
TYPE(shpfileobject) hshp_extremum ! shapefile extremum
TYPE(shpfileobject) hshp_outermost ! shapefile outermost_contour
TYPE(shpfileobject) hshp_max_speed ! shapefile max_speed_contour
......@@ -31,13 +31,13 @@ program test_successive_overlap
! longitude and latitude steps, in degrees and in rad
logical periodic ! grid is periodic in longitude
integer:: nlon = - 1, nlat = - 1
integer:: nlon = - 1, nlat = - 1, max_delta = 1
integer:: dist_lim = 12
! We look for an overlapping eddy at dist_lim (in grid points) of
! the first extremum.
namelist /main_nml/ corner_deg, step_deg, nlon, nlat, dist_lim
namelist /main_nml/ corner_deg, step_deg, nlon, nlat, dist_lim, max_delta
!-------------------------------------------------------------------------
......@@ -56,10 +56,11 @@ program test_successive_overlap
periodic = nint(360. / step_deg(1)) == nlon
print *, "periodic = ", periodic
if (periodic) call assert(2 * dist_lim * step_deg(1) < 180., &
"test_successive_overlap dist_lim")
"test_overlap dist_lim")
corner = corner_deg * deg_to_rad
step = step_deg * deg_to_rad
allocate(flow(max_delta + 1))
call shp_open_03(hshp_extremum, trim(snapshot_1) // "/extremum", &
pszaccess = "rb")
......@@ -82,13 +83,15 @@ program test_successive_overlap
call shp_open_03(hshp_max_speed, trim(snapshot_2) // "/max_speed_contour", &
pszaccess = "rb")
! We assume that the field indices are the same than in snapshot_1.
call read_snapshot(flow(2), k, hshp_extremum, hshp_outermost, &
call read_snapshot(flow(max_delta + 1), k, hshp_extremum, hshp_outermost, &
hshp_max_speed, corner, step, nlon, nlat, periodic, dist_lim)
CALL shpclose(hshp_extremum)
CALL shpclose(hshp_outermost)
CALL shpclose(hshp_max_speed)
print *, snapshot_2, ", k = ", k
flow(2:max_delta)%number_eddies = 0
call new_unit(unit_edgelist)
open(unit_edgelist, file = "edgelist.csv", status = "replace", &
action = "write")
......@@ -101,7 +104,8 @@ program test_successive_overlap
call init_shapefiles(hshp_extremum, hshp_outermost, hshp_max_speed)
call overlap(flow, unit_edgelist, nlon, nlat, periodic, dist_lim, &
hshp_extremum, hshp_outermost, hshp_max_speed, j = 2, k = k, delta = 1)
hshp_extremum, hshp_outermost, hshp_max_speed, j = max_delta + 1, &
k = k, delta = max_delta)
close(unit_edgelist)
print *, 'Created file "edgelist.csv".'
CALL shpclose(hshp_extremum)
......@@ -129,4 +133,4 @@ program test_successive_overlap
end do
print *
end program test_successive_overlap
end program test_overlap
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