From 53a93fa86cfe7de1fe690829b07e27be2a9b86d0 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Thu, 1 Jul 2021 12:30:36 +0200 Subject: [PATCH] Do not create `number_eddies.csv` in `eddy_graph` Do not create file `number_eddies.csv` in program `eddy_graph`. Since there are no interpolated eddies any longer, the file `number_eddies.csv` just contained the same information that is in `ishape_last.txt` in the input SHPC. Remove argument `unit_number_eddies` of procedure `dispatch_snapshot`. --- Overlap/Tests/test_get_dispatch_snap.f90 | 10 +++------- Overlap/dispatch_snapshot.f90 | 9 ++------- Overlap/eddy_graph.f90 | 20 +++++++------------- Overlap/eddy_graph_in.sh | 14 ++------------ 4 files changed, 14 insertions(+), 39 deletions(-) diff --git a/Overlap/Tests/test_get_dispatch_snap.f90 b/Overlap/Tests/test_get_dispatch_snap.f90 index 57589cae..822f6f69 100644 --- a/Overlap/Tests/test_get_dispatch_snap.f90 +++ b/Overlap/Tests/test_get_dispatch_snap.f90 @@ -24,7 +24,7 @@ program test_get_dispatch_snap type(snapshot) s TYPE(shpc) hshp integer k_begin, d_init, copy, rank, n_proc, k_end, n_dates - integer unit_isolated, unit_number_eddies + integer unit_isolated real:: corner(2) = [0.125, - 59.875] ! longitude and latitude of the corner of the whole grid in input @@ -81,9 +81,6 @@ program test_get_dispatch_snap call new_unit(unit_isolated) open(unit_isolated, file = "isolated_nodes.txt", status = "replace", & action = "write") - call new_unit(unit_number_eddies) - open(unit_number_eddies, file = "number_eddies.csv", status = "replace", & - action = "write") end if call ezmpi_bcast(corner, root = 0) @@ -111,13 +108,12 @@ program test_get_dispatch_snap step * deg_to_rad, copy, hshp, d_init, k, k_end, rank, n_proc, & max_delta = 1) CALL shpc_close(hshp) - call dispatch_snapshot(s, unit_isolated, unit_number_eddies, rank, k_begin, & - max_delta = 1, d_init = d_init, k = k) + call dispatch_snapshot(s, unit_isolated, rank, k_begin, max_delta = 1, & + d_init = d_init, k = k) if (rank == 0) then call write_snapshot(s, corner, step, nlon, nlat, copy, d = d_init + k) close(unit_isolated) - close(unit_number_eddies) end if call mpi_finalize diff --git a/Overlap/dispatch_snapshot.f90 b/Overlap/dispatch_snapshot.f90 index e3be4425..ee1a8159 100644 --- a/Overlap/dispatch_snapshot.f90 +++ b/Overlap/dispatch_snapshot.f90 @@ -4,8 +4,8 @@ module dispatch_snapshot_m contains - subroutine dispatch_snapshot(s, unit_isolated, unit_number_eddies, rank, & - k_begin, max_delta, d_init, k) + subroutine dispatch_snapshot(s, unit_isolated, rank, k_begin, max_delta, & + d_init, k) use derived_types, only: snapshot use send_snapshot_m, only: send_snapshot @@ -15,9 +15,6 @@ contains integer, intent(in):: unit_isolated ! logical unit for file isolated_nodes_$rank.csv - integer, intent(in):: unit_number_eddies - ! logical unit for file number_eddies_$rank.csv - integer, intent(in):: rank, k_begin, max_delta, d_init integer, intent(in):: k ! date index (0-based) @@ -34,8 +31,6 @@ contains .and. s%list_vis(i)%delta_out == huge(0)) & write(unit_isolated, fmt = *) d, i end do - - write(unit_number_eddies, fmt = *) d, s%number_vis_extr else call send_snapshot(s, tag = k, dest = rank - 1) end if diff --git a/Overlap/eddy_graph.f90 b/Overlap/eddy_graph.f90 index 1e667100..96333dbe 100644 --- a/Overlap/eddy_graph.f90 +++ b/Overlap/eddy_graph.f90 @@ -54,7 +54,7 @@ program eddy_graph ! shape index (0-based) in the collection of shapefiles of the last ! shape at a given date index - integer unit_isolated, unit_number_eddies, unit + integer unit_isolated, unit TYPE(shpc) hshp type(snapshot), allocatable:: flow(:) character(len = 30) file @@ -124,11 +124,6 @@ program eddy_graph write(unit = file, fmt = '("isolated_nodes_", i0, ".txt")') rank open(unit_isolated, file = trim(file), status = "replace", action = "write") - call new_unit(unit_number_eddies) - write(unit = file, fmt = '("number_eddies_", i0, ".csv")') rank - open(unit_number_eddies, file = trim(file), status = "replace", & - action = "write") - call open_edge_file(rank) ! We do not write the title line. That will be handled by eddy_graph.sh. @@ -161,8 +156,8 @@ program eddy_graph ! 3. Main loop do k = k_begin + max_delta + 1, k_end_main_loop - call dispatch_snapshot(flow(1), unit_isolated, unit_number_eddies, rank, & - k_begin, max_delta, d_init, k = k - max_delta - 1) + call dispatch_snapshot(flow(1), unit_isolated, rank, k_begin, max_delta, & + d_init, k = k - max_delta - 1) flow(:max_delta) = flow(2:) call get_snapshot(flow(max_delta + 1), nlon, nlat, ishape_last, corner, & step, copy, hshp, d_init, k, k_end, rank, n_proc, max_delta) @@ -178,8 +173,8 @@ program eddy_graph do k = k_end_main_loop + 1, k_end ! {rank < n_proc - 1 and k >= k_end - max_delta + 2} - call dispatch_snapshot(flow(1), unit_isolated, unit_number_eddies, rank, & - k_begin, max_delta, d_init, k = k - max_delta - 1) + call dispatch_snapshot(flow(1), unit_isolated, rank, k_begin, max_delta, & + d_init, k = k - max_delta - 1) flow(:max_delta) = flow(2:) call get_snapshot(flow(max_delta + 1), nlon, nlat, ishape_last, corner, & step, copy, hshp, d_init, k, k_end, rank, n_proc, max_delta) @@ -196,15 +191,14 @@ program eddy_graph end do do j = 1, max_delta + 1 - call dispatch_snapshot(flow(j), unit_isolated, unit_number_eddies, rank, & - k_begin, max_delta, d_init, k = k_end - max_delta - 1 + j) + call dispatch_snapshot(flow(j), unit_isolated, rank, k_begin, max_delta, & + d_init, k = k_end - max_delta - 1 + j) end do ! 5. Back matter CALL shpc_close(hshp) close(unit_isolated) - close(unit_number_eddies) close(unit_edge) call mpi_finalize diff --git a/Overlap/eddy_graph_in.sh b/Overlap/eddy_graph_in.sh index 6a18e772..60cb1478 100755 --- a/Overlap/eddy_graph_in.sh +++ b/Overlap/eddy_graph_in.sh @@ -3,8 +3,6 @@ # This program creates the edge list for a given orientation of # eddies. -# Note: no need to sort number_eddies.csv, already sorted by construction. - if (($# != 2)) then echo "Usage: eddy_graph.sh N_PROC INPUT_SHPC" @@ -15,21 +13,14 @@ set -e ##set -x ${mpiexec:-mpiexec} -n $1 @CMAKE_CURRENT_BINARY_DIR@/eddy_graph $2 -# Two titles lines, one with long names, one with short names: -cat >number_eddies.csv <<EOF - "days since 1950-1-1" "number of visible extrema" - days_1950 number_vis_extr -EOF - rm -f isolated_nodes.txt rank=0 while ((rank < $1)) do - cat number_eddies_$rank.csv >>number_eddies.csv cat edgelist_$rank.csv >>edgelist_no_header.csv cat isolated_nodes_$rank.txt >>isolated_nodes.txt - rm number_eddies_$rank.csv edgelist_$rank.csv isolated_nodes_$rank.txt + rm edgelist_$rank.csv isolated_nodes_$rank.txt ((rank += 1)) done @@ -44,5 +35,4 @@ $(sort --key=1 --key=2 --numeric-sort edgelist_no_header.csv) EOF rm edgelist_no_header.csv -echo "Created files \"number_eddies.csv\", \"edgelist.csv\", " \ - "and \"isolated_nodes.txt\"." +echo "Created files \"edgelist.csv\" and \"isolated_nodes.txt\"." -- GitLab