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

Change test_set_outermost_contour so it does not call local_extrema

but reads extr_map from a file.
parent c2518f4b
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ VPATH = ${makefile_dir}/Sources ${makefile_dir}/Sources/Tests
src_test_local_extrema = test_local_extrema.f local_extrema.f
src_test_set_outermost_contour = good_contour.f test_set_outermost_contour.f derived_types.f set_outermost_contour.f outermost_possible_level.f spherical_polygon_area.f local_extrema.f
src_test_set_outermost_contour = good_contour.f test_set_outermost_contour.f derived_types.f set_outermost_contour.f outermost_possible_level.f spherical_polygon_area.f
src_test_max_speed_contour_ssh = test_max_speed_contour_ssh.f max_speed_contour_ssh.f inside.f
......
......@@ -3,7 +3,6 @@ program test_set_outermost_contour
use, intrinsic:: ISO_FORTRAN_ENV
use derived_types, only: eddy
use local_extrema_m, only: local_extrema, construct_mask_center
use netcdf, only: nf90_nowrite
use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, nf95_get_var
use nr_util, only: pi, assert
......@@ -26,29 +25,24 @@ program test_set_outermost_contour
real, allocatable:: ssh(:, :) ! (n_lon, n_lat) sea-surface height, in m
integer, allocatable:: extr_map(:, :) ! (n_lon, n_lat) map of extrema
integer, allocatable:: ind_extr(:, :) ! (2, n_extr)
! indices in the two dimensions of extrema
real, allocatable:: innermost_level(:) ! (n_extr)
! level of innermost contour, for each extremum
logical, allocatable:: cyclone(:) ! (n_extr)
integer:: ind_targ_extr(2) = [19, 11]
! indices in the two dimensions of target extremum
real:: innermost_level = 0.2933! level of innermost contour, for each extremum
logical:: cyclone = .true.
type(eddy) e
real, parameter:: step = 0.25 / 180. * pi ! in rad
TYPE(shpfileobject) shphandle
integer field_number, shape_number
integer:: i = 6 ! identifying number of the target extremum
logical:: noise_around = .false.
namelist /main_nml/ ilon_llc, ilat_llc, ilon_urc, ilat_urc, i, noise_around
namelist /main_nml/ ilon_llc, ilat_llc, ilon_urc, ilat_urc, ind_targ_extr, &
innermost_level, cyclone, noise_around
!----------------------------------------------------------------
call get_command_argument(number = 1, length = length, status = status)
call assert(status == 0, "Required argument: ADT file")
allocate(character(len = length):: filename)
call get_command_argument(1, filename)
call assert(COMMAND_ARGUMENT_COUNT() == 2, &
"Required arguments: ADT-file extr_map-file")
write(unit = error_unit, nml = main_nml)
write(unit = error_unit, fmt = *) "Enter namelist main_nml."
......@@ -59,6 +53,10 @@ program test_set_outermost_contour
allocate(longitude(n_lon), latitude(n_lat))
allocate(ssh(n_lon, n_lat), extr_map(n_lon, n_lat))
call get_command_argument(number = 1, length = length, status = status)
allocate(character(len = length):: filename)
call get_command_argument(1, filename)
print *, "Reading from ", filename, "..."
call nf95_open(filename, nf90_nowrite, ncid)
......@@ -75,14 +73,22 @@ program test_set_outermost_contour
call nf95_close(ncid)
call construct_mask_center
call local_extrema(ssh, extr_map, ind_extr, innermost_level, cyclone)
!!$ extr_map(ind_extr(1, 8), ind_extr(2, 8)) &
!!$ = - extr_map(ind_extr(1, 8), ind_extr(2, 8))
call get_command_argument(number = 2, length = length, status = status)
deallocate(filename)
allocate(character(len = length):: filename)
call get_command_argument(2, filename)
print *, "Reading from ", filename, "..."
call nf95_open(filename, nf90_nowrite, ncid)
call nf95_inq_varid(ncid, "extr_map", varid)
call nf95_get_var(ncid, varid, extr_map)
call nf95_close(ncid)
e%coord_extr = [longitude(ind_extr(1, i)), latitude(ind_extr(2, i))]
e%cyclone = cyclone(i)
call set_outermost_contour(e, ind_extr(:, i), innermost_level(i), extr_map, &
e%coord_extr = [longitude(ind_targ_extr(1)), latitude(ind_targ_extr(2))]
e%cyclone = cyclone
call set_outermost_contour(e, ind_targ_extr, innermost_level, extr_map, &
ssh, corner = [longitude(1), latitude(1)], step = [step, step], &
noise_around = noise_around)
......
......@@ -8,5 +8,5 @@ test_inside.o : inside.o
test_local_extrema.o : local_extrema.o
test_max_speed_contour_ssh.o : max_speed_contour_ssh.o
test_mean_speed.o : mean_speed.o
test_set_outermost_contour.o : set_outermost_contour.o local_extrema.o derived_types.o
test_set_outermost_contour.o : set_outermost_contour.o derived_types.o
write_eddy.o : derived_types.o
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