diff --git a/Overlap/Tests/test_overlap.f90 b/Overlap/Tests/test_overlap.f90 index 826c085b705cf72355b98ecc16c1b70edbbcd388..44a0a1e1a7d9c3de632eff168b55377e41f47e27 100644 --- a/Overlap/Tests/test_overlap.f90 +++ b/Overlap/Tests/test_overlap.f90 @@ -16,7 +16,6 @@ program test_overlap use shpc_create_m, only: shpc_create use shpc_open_m, only: shpc_open use unit_edge_m, only: open_edge_file, unit_edge - use write_overlap_m, only: init_interpolated_eddy implicit none @@ -101,14 +100,10 @@ program test_overlap // '"successor eddy subscript"' write(unit_edge, fmt = *) "k1 i1 k2 i2 weight" - call shpc_create(hshp, shpc_dir = "SHPC", cyclone = hshp%cyclone) - call init_interpolated_eddy - call overlap(flow, nlon, nlat, periodic, dist_lim, hshp, & - d = d_init + k_test_2, delta = max_delta, j = max_delta + 1) + call overlap(flow, nlon, nlat, periodic, dist_lim, d = d_init + k_test_2, & + delta = max_delta, j = max_delta + 1) close(unit_edge) print *, 'Created file "edgelist.csv".' - CALL shpc_close(hshp) - print *, 'Created shapefiles for interpolated eddies in SHPC.' print *, k_test_1, ":" print *, "Valid isolated eddies:" diff --git a/Overlap/Tests/test_write_overlap.f90 b/Overlap/Tests/test_write_overlap.f90 index e53957cb1a8382cdcb02411f30debd174c24ba67..34badabb192162555f6eb6c391181550eb99fd64 100644 --- a/Overlap/Tests/test_write_overlap.f90 +++ b/Overlap/Tests/test_write_overlap.f90 @@ -2,21 +2,14 @@ program test_write_overlap use, intrinsic:: ISO_FORTRAN_ENV - use derived_types, only: shpc - use shpc_close_m, only: shpc_close - use shpc_create_m, only: shpc_create use unit_edge_m, only: open_edge_file, unit_edge - use write_overlap_m, only: write_overlap, init_interpolated_eddy + use write_overlap_m, only: write_overlap implicit none integer j_interp - integer:: k = 2, delta = 1, m = 0 - real:: coord_extr_1(2) = [0., 0.], coord_extr_2(2) = [0., 0.] ! in rad - real:: ssh_extr_1 = 0., ssh_extr_2 = 0. - TYPE(shpc) hshp - namelist /main_nml/ k, delta, m, coord_extr_1, ssh_extr_1, coord_extr_2, & - ssh_extr_2 + integer:: k = 2, delta = 1 + namelist /main_nml/ k, delta !------------------------------------------------------------------------- @@ -33,15 +26,9 @@ program test_write_overlap // '"successor eddy subscript"' write(unit_edge, fmt = *) "k1 i1 k2 i2 weight" - call shpc_create(hshp, shpc_dir = "SHPC", cyclone = .true.) - call init_interpolated_eddy - call write_overlap(hshp, k, delta, i1 = 1, i2 = 2, m = m, & - i_interp = 10 + [(j_interp, j_interp = 1, delta - 1)], & - cyclone = .true., coord_extr_1 = coord_extr_1, ssh_extr_1 = ssh_extr_1, & - coord_extr_2 = coord_extr_2, ssh_extr_2 = ssh_extr_2, w = 0.) + call write_overlap(k, delta, i1 = 1, i2 = 2, & + i_interp = 10 + [(j_interp, j_interp = 1, delta - 1)], w = 0.) close(unit_edge) print *, 'Created file "edgelist.csv".' - CALL shpc_close(hshp) - print *, 'Created shapefiles in SHPC.' end program test_write_overlap diff --git a/Overlap/eddy_graph.f90 b/Overlap/eddy_graph.f90 index ae4938e61b00f98eae671b5502e4dbc6967e693e..1e667100c3ab33e20dfd7973b28fe5469383b406 100644 --- a/Overlap/eddy_graph.f90 +++ b/Overlap/eddy_graph.f90 @@ -17,8 +17,6 @@ program eddy_graph use unit_edge_m, only: open_edge_file, unit_edge use shpc_open_m, only: shpc_open use shpc_close_m, only: shpc_close - use shpc_create_m, only: shpc_create - use write_overlap_m, only: init_interpolated_eddy implicit none @@ -58,7 +56,6 @@ program eddy_graph integer unit_isolated, unit_number_eddies, unit TYPE(shpc) hshp - TYPE(shpc) hshp_interp ! for interpolated eddies type(snapshot), allocatable:: flow(:) character(len = 30) file @@ -135,10 +132,6 @@ program eddy_graph call open_edge_file(rank) ! We do not write the title line. That will be handled by eddy_graph.sh. - write(unit = file, fmt = '("SHPC_", i0)') rank - call shpc_create(hshp_interp, shpc_dir = trim(file), cyclone = hshp%cyclone) - call init_interpolated_eddy - k_begin = (rank * n_dates) / n_proc if (rank < n_proc - 1) then @@ -160,8 +153,8 @@ program eddy_graph do delta = 1, max_delta do k = k_begin + delta, k_begin + max_delta - call overlap(flow, nlon, nlat, periodic, dist_lim, hshp_interp, & - d = d_init + k, delta = delta, j = k - k_begin + 1) + call overlap(flow, nlon, nlat, periodic, dist_lim, d = d_init + k, & + delta = delta, j = k - k_begin + 1) end do end do @@ -176,8 +169,8 @@ program eddy_graph d = d_init + k do delta = 1, max_delta - call overlap(flow, nlon, nlat, periodic, dist_lim, hshp_interp, d, & - delta, j = max_delta + 1) + call overlap(flow, nlon, nlat, periodic, dist_lim, d, delta, & + j = max_delta + 1) end do end do @@ -197,8 +190,8 @@ program eddy_graph d = d_init + k do delta = k - k_end + max_delta, max_delta - call overlap(flow, nlon, nlat, periodic, dist_lim, hshp_interp, d, & - delta, j = max_delta + 1) + call overlap(flow, nlon, nlat, periodic, dist_lim, d, delta, & + j = max_delta + 1) end do end do @@ -209,7 +202,6 @@ program eddy_graph ! 5. Back matter - CALL shpc_close(hshp_interp) CALL shpc_close(hshp) close(unit_isolated) close(unit_number_eddies) diff --git a/Overlap/eddy_graph_in.sh b/Overlap/eddy_graph_in.sh index dcd7096f7e03a0baafaf9692e3bb00aeefbfe105..4b4de108303eadc7bc8ef6da856c1a5870ce10d9 100755 --- a/Overlap/eddy_graph_in.sh +++ b/Overlap/eddy_graph_in.sh @@ -1,7 +1,7 @@ #!/bin/bash -# This program creates the edge list and interpolated eddies, for a -# given orientation of eddies. +# This program creates the edge list for a given orientation of +# eddies. # Note: no need to sort number_eddies.csv, already sorted by construction. @@ -13,15 +13,6 @@ fi set -e ##set -x -rank=0 - -while ((rank < $1)) -do - rm -rf SHPC_$rank - mkdir SHPC_$rank - ((rank += 1)) -done - ${mpiexec:-mpiexec} -n $1 @CMAKE_CURRENT_BINARY_DIR@/eddy_graph $2 # Two titles lines, one with long names, one with short names: @@ -55,21 +46,3 @@ rm edgelist_no_header.csv echo "Created files \"number_eddies.csv\", \"edgelist.csv\", " \ "and \"isolated_nodes.txt\"." -rm -rf SHPC -mv SHPC_0 SHPC -rank=1 - -while ((rank < $1)) -do - for my_base in extremum outermost_contour max_speed_contour - do - shpcat SHPC_$rank/$my_base SHPC/$my_base - dbfcat SHPC_$rank/$my_base SHPC/$my_base - done - - rm -r SHPC_$rank - ((rank += 1)) -done - -cp $2/grid_nml.txt SHPC -echo "Created directory \"SHPC\"." diff --git a/Overlap/overlap.f90 b/Overlap/overlap.f90 index 267f10351cd64c2d469585755e367d13df98c096..852765d5f94a9dc41ee706fc6093907dc4a537e7 100644 --- a/Overlap/overlap.f90 +++ b/Overlap/overlap.f90 @@ -4,8 +4,7 @@ module overlap_m contains - subroutine overlap(flow, nlon, nlat, periodic, dist_lim, hshp_interp, d, & - delta, j) + subroutine overlap(flow, nlon, nlat, periodic, dist_lim, d, delta, j) ! This procedure finds edges between flow(j - delta) and flow(j), ! corresponding to dates d - delta and d. It calls write_overlap @@ -19,7 +18,7 @@ contains use nr_util, only: twopi use candidate_overlap_m, only: candidate_overlap - use derived_types, only: snapshot, shpc + use derived_types, only: snapshot use spher_polygon_area_m, only: spher_polygon_area use spher_polyline_area_m, only: spher_polyline_area use weight_m, only: weight @@ -33,9 +32,6 @@ contains ! We look for an overlapping eddy at dist_lim (in grid points) of ! the extremum of a given eddy. - ! Collection of shapefiles to which any interpolated eddy will be written: - TYPE(shpc), intent(in):: hshp_interp - integer, intent(in):: d ! date, in days since 1950-1-1 integer, intent(in):: delta ! between 1 and max_delta @@ -122,13 +118,8 @@ contains flow(j - delta + 1:j - 1)%number_eddies & = flow(j - delta + 1:j - 1)%number_eddies + 1 - call write_overlap(hshp_interp, d, delta, i1, i2, m, & + call write_overlap(d, delta, i1, i2, & flow(j - delta + 1:j - 1)%number_eddies, & - flow(j - delta)%list_vis(i1)%cyclone, & - flow(j - delta)%list_vis(i1)%coord_extr, & - flow(j - delta)%list_vis(i1)%ssh_extr, & - flow(j)%list_vis(i2)%coord_extr, & - flow(j)%list_vis(i2)%ssh_extr, & weight(flow(j - delta)%list_vis(i1), & flow(j)%list_vis(i2))) flow(j - delta)%list_vis(i1)%delta_out & diff --git a/Overlap/write_overlap.f90 b/Overlap/write_overlap.f90 index da9fada0e48b8114f5c45236daf07d6d32f93102..e613cb6c2a39dbc84145fdbc0be6df3789cf308e 100644 --- a/Overlap/write_overlap.f90 +++ b/Overlap/write_overlap.f90 @@ -1,70 +1,29 @@ module write_overlap_m - use derived_types, only: eddy - implicit none - private eddy - type(eddy), private, save:: e - contains - subroutine write_overlap(hshp_interp, d, delta, i1, i2, m, i_interp, & - cyclone, coord_extr_1, ssh_extr_1, coord_extr_2, ssh_extr_2, w) + subroutine write_overlap(d, delta, i1, i2, i_interp, w) - ! Writes edges to unit_edge and interpolated eddies to shapefiles, - ! between (d - delta, i1) and (d, i2). + ! Writes edges to unit_edge between (d - delta, i1) and (d, i2). - ! Libraries: - use nr_util, only: twopi - - use derived_types, only: shpc use unit_edge_m, only: unit_edge - use write_eddy_m, only: write_eddy - TYPE(shpc), intent(in):: hshp_interp integer, intent(in):: d ! date, in days since 1950-1-1 - integer, intent(in):: delta, i1, i2, m + integer, intent(in):: delta, i1, i2 integer, intent(in):: i_interp(:) ! (delta - 1) - logical, intent(in):: cyclone - real, intent(in):: coord_extr_1(:) ! (2) - real, intent(in):: ssh_extr_1 - - real, intent(in):: coord_extr_2(:) ! (2) - ! (Note: value attribute not allowed for an array.) - - real, intent(in):: ssh_extr_2 real, intent(in):: w ! Local: integer i_pred, j_interp, d_interp - real w_interp - real coord_extr_2_local(2) !------------------------------------------------------------------- - if (delta >= 2) then - ! Prepare interpolation: - - e%cyclone = cyclone - - ! Define coord_extr_2_local with the longitude of extremum i2 shifted - ! to a value close to the longitude of extremum i1: - coord_extr_2_local(1) = coord_extr_2(1) + m * twopi - coord_extr_2_local(2) = coord_extr_2(2) - end if - i_pred = i1 do j_interp = 1, delta - 1 - ! Interpolate extremum: - w_interp = j_interp / real(delta) - e%coord_extr = (1 - w_interp) * coord_extr_1 & - + w_interp * coord_extr_2_local - e%ssh_extr = (1 - w_interp) * ssh_extr_1 + w_interp * ssh_extr_2 - d_interp = d - delta + j_interp - call write_eddy(e, hshp_interp, d_interp, i_interp(j_interp)) write(unit_edge, fmt = *) d_interp - 1, i_pred, d_interp, & i_interp(j_interp), w i_pred = i_interp(j_interp) @@ -74,23 +33,4 @@ contains end subroutine write_overlap - !************************************************************************** - - subroutine init_interpolated_eddy - - ! Set some null components of the interpolated eddy: - - use derived_types, only: null_ssh_contour, missing_speed - - !----------------------------------------------------------------------- - - e%out_cont = null_ssh_contour() - e%speed_cont = null_ssh_contour() - e%max_speed = missing_speed - e%valid = .false. - e%interpolated = .true. - e%radius4 = 0 - - end subroutine init_interpolated_eddy - end module write_overlap_m