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

Remove dummy arguments of `read_snapshot`

Remove dummy arguments nlon, nlat, corner, step of procedure
`read_snapshot`, use module variables instead. Note that we keep copy
as a dummy argument instead of using the variable of module
`config_graph_m`, because we want the procedure `read_snapshot` to be
usable outside of the `eddy_graph` program.
parent 2b7c5b3d
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ module read_snapshot_m
contains
subroutine read_snapshot(s, hshpc, ssm, nlon, nlat, k, corner, step, copy)
subroutine read_snapshot(s, hshpc, ssm, k, copy)
! Libraries:
use contour_531, only: convert_to_ind
......@@ -13,22 +13,12 @@ contains
use derived_types, only: snapshot, eddy, shpc_slice_handler, shpc_slice_meta
use read_eddy_m, only: read_eddy
use read_grid_m, only: nlon, nlat, corner, step
type(snapshot), intent(out):: s ! completely defined
TYPE(shpc_slice_handler), intent(in):: hshpc(:) ! (n_slices)
type(shpc_slice_meta), intent(in):: ssm(:) ! (n_slices)
integer, intent(in):: nlon, nlat
! size of ssh array in input NetCDF, assuming no repeated point if
! the grid is global
integer, intent(in):: k ! date index
real, intent(in):: corner(:) ! (2) longitude and latitude of the
! corner of the whole grid in input NetCDF, in rad
real, intent(in):: step(:) ! (2) longitude and latitude steps, in rad
integer, intent(in):: copy
! Local:
......
program test_nearby_extr
! Libraries:
use jumble, only: get_command_arg_dyn, new_unit, read_opcol, deg_to_rad, &
rad_to_deg
use jumble, only: get_command_arg_dyn, read_opcol, rad_to_deg
use shapelib_03, only: dbf_read_attribute_03
use derived_types, only: snapshot, shpc_slice_handler, shpc_slice_meta
use nearby_extr_m, only: nearby_extr
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
......@@ -16,41 +16,21 @@ program test_nearby_extr
character(len = :), allocatable:: shpc_dir
type(snapshot) s
TYPE(shpc_slice_handler) hshp
integer unit, l
integer l
type(shpc_slice_meta) ssm
real corner_deg(2)
! longitude and latitude of the corner of the whole grid in input
! NetCDF, in degrees
real step_deg(2) ! longitude and latitude steps, in degrees
integer nlon, nlat
! size of ssh array in input NetCDF, assuming no repeated point if
! the grid is global
namelist /grid_nml/ corner_deg, step_deg, nlon, nlat
real, allocatable:: nearby(:, :) ! (2, :) longitude and
! latitude, in rad, of extrema near the target extremum
!-------------------------------------------------------------------------
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 shpc_open(hshp, trim(shpc_dir), cyclone = .true., slice = 0, &
pszaccess = "rb")
call dbf_read_attribute_03(ssm%d0, hshp%extremum, hshp%extr_date, ishape = 0)
call read_opcol(ssm%ishape_last, hshp%unit, my_lbound = ssm%d0)
call read_snapshot(s, [hshp], [ssm], nlon, nlat, k = ssm%d0, &
corner = corner_deg * deg_to_rad, step = step_deg * deg_to_rad, &
copy = 0)
call read_snapshot(s, [hshp], [ssm], k = ssm%d0, copy = 0)
CALL shpc_close(hshp)
nearby = nearby_extr(s%extr_map, s%list, i = 4)
......
......@@ -76,10 +76,8 @@ program test_overlap
open(unit, file = "e_overestim.txt", status = "replace", action = "write")
write(unit, fmt = *) e_overestim
close(unit)
call read_snapshot(flow(1), [hshp], [ssm], nlon, nlat, k_test_1, corner, &
step, copy)
call read_snapshot(flow(max_delta + 1), [hshp], [ssm], nlon, nlat, k_test_2, &
corner, step, copy)
call read_snapshot(flow(1), [hshp], [ssm], k_test_1, copy)
call read_snapshot(flow(max_delta + 1), [hshp], [ssm], k_test_2, copy)
CALL shpc_close(hshp)
print *, "Enter flow(1)%list%delta_out (array with ", &
flow(1)%number_extr, " values):"
......
......@@ -8,7 +8,6 @@ contains
use config_graph_m, only: copy, max_delta
use derived_types, only: snapshot, shpc_slice_handler, shpc_slice_meta
use read_grid_m, only: nlon, nlat, corner, step
use read_snapshot_m, only: read_snapshot
use recv_snapshot_m, only: recv_snapshot
......@@ -23,7 +22,7 @@ contains
!--------------------------------------------------------------
if (rank == n_proc - 1 .or. k <= k_end - max_delta) then
call read_snapshot(s, hshp, ssm, nlon, nlat, k, corner, step, copy)
call read_snapshot(s, hshp, ssm, k, copy)
else
call recv_snapshot(s, nlon, nlat, copy, source = rank + 1, tag = k)
end if
......
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