From b4b2afdc1e0bae9b473b014040c240c9764ff012 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Fri, 14 Oct 2022 20:23:41 +0200 Subject: [PATCH] Use procedures `config_graph` and `read_grid` --- Overlap/Tests/test_overlap.f90 | 41 ++++++---------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/Overlap/Tests/test_overlap.f90 b/Overlap/Tests/test_overlap.f90 index 8bba9dc9..723ce336 100644 --- a/Overlap/Tests/test_overlap.f90 +++ b/Overlap/Tests/test_overlap.f90 @@ -3,12 +3,13 @@ program test_overlap use, intrinsic:: ISO_FORTRAN_ENV ! Libraries: - use jumble, only: get_command_arg_dyn, read_opcol, new_unit, ediff1d, & - deg_to_rad, assert + use jumble, only: get_command_arg_dyn, read_opcol, new_unit, ediff1d, assert use shapelib_03, only: dbf_read_attribute_03 + use config_graph_m, only: config_graph, copy, max_delta, cyclone use derived_types, only: snapshot, shpc_slice_handler, shpc_slice_meta use overlap_m, only: overlap + use read_grid_m, only: read_grid use read_snapshot_m, only: read_snapshot use shpc_close_m, only: shpc_close use shpc_open_m, only: shpc_open @@ -18,53 +19,25 @@ program test_overlap character(len = :), allocatable:: shpc_dir integer:: k_test_1 = 0, k_test_2 = 1 - integer unit, i, copy, n_dates + integer unit, i, n_dates type(snapshot), allocatable:: flow(:) ! (max_delta + 1) TYPE(shpc_slice_handler) hshp type(shpc_slice_meta) ssm - - real:: corner_deg(2) = [huge(0.), huge(0.)], corner(2) - ! longitude and latitude of the corner of the whole grid, in degrees - ! and in rad - - real:: step_deg(2) = [huge(0.), huge(0.)], step(2) - ! longitude and latitude steps, in degrees and in rad - - logical periodic ! grid is periodic in longitude - integer:: nlon = - 1, nlat = - 1, max_delta = 1 integer e_overestim ! over-estimation of the number of eddies at each date - logical:: cyclone = .true. - integer:: dist_lim = 12 - ! We look for an overlapping eddy at dist_lim (in grid points) of - ! the first extremum. - - namelist /grid_nml/ corner_deg, step_deg, nlon, nlat - namelist /main_nml/ dist_lim, max_delta, k_test_1, k_test_2, cyclone + namelist /main_nml/ k_test_1, k_test_2 !------------------------------------------------------------------------- call get_command_arg_dyn(1, shpc_dir, "Required argument: SHPC-directory") call new_unit(unit) - open(unit, file = shpc_dir // "/grid_nml.txt", status = "old", & - action = "read", position = "rewind") - read(unit, nml = grid_nml) - close(unit) + call read_grid(rank = 0, shpc_dir = shpc_dir) + call config_graph(rank = 0) write(unit = error_unit, nml = main_nml) write(unit = error_unit, fmt = *) "Enter namelist main_nml." read(unit = *, nml = main_nml) write(unit = *, nml = main_nml) - ! As we are requiring the grid spacing to be uniform, the value of - ! "periodic" may be deduced from the values of step_deg(1) and nlon: - periodic = nint(360. / step_deg(1)) == nlon - print *, "periodic = ", periodic - if (periodic) call assert(2 * dist_lim * step_deg(1) < 180., & - "test_overlap dist_lim") - copy = merge(dist_lim, 0, periodic) - - corner = corner_deg * deg_to_rad - step = step_deg * deg_to_rad allocate(flow(max_delta + 1)) call shpc_open(hshp, trim(shpc_dir), cyclone, slice = 0, pszaccess = "rb") call dbf_read_attribute_03(ssm%d0, hshp%extremum, hshp%extr_date, ishape = 0) -- GitLab