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

Compute `ind_targ_extr` from input files

Instead of asking the user to define it. Motivation: make
`test_set_max_speed` easier to use.
parent b546f1f7
No related branches found
No related tags found
No related merge requests found
...@@ -205,7 +205,6 @@ ...@@ -205,7 +205,6 @@
"command": "$build_dir/Inst_eddies/test_mean_speed" "command": "$build_dir/Inst_eddies/test_mean_speed"
}, },
{ {
"input": "&main_nml /\n",
"required": "required":
[ [
[ [
...@@ -226,7 +225,6 @@ ...@@ -226,7 +225,6 @@
["$build_dir/Inst_eddies/test_set_max_speed", "$PWD/Get_1_outerm/SHPC"] ["$build_dir/Inst_eddies/test_set_max_speed", "$PWD/Get_1_outerm/SHPC"]
}, },
{ {
"input": "&MAIN_NML IND_TARG_EXTR=19,11 /\n",
"required": "required":
[ [
[ [
......
...@@ -27,11 +27,7 @@ program test_set_max_speed ...@@ -27,11 +27,7 @@ program test_set_max_speed
real, allocatable:: ssh(:, :) ! (nlon, nlat) sea-surface height, in m real, allocatable:: ssh(:, :) ! (nlon, nlat) sea-surface height, in m
real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1 real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1
type(eddy) e type(eddy) e
real corner(2), step(2) ! in rad
integer:: ind_targ_extr(2) = [5, 4]
! indices of the target extremum, relative to corner
real corner(2)
TYPE(shp_tr) hshp_in TYPE(shp_tr) hshp_in
TYPE(shpfileobject) hshp TYPE(shpfileobject) hshp
integer ifield, ishape integer ifield, ishape
...@@ -40,8 +36,6 @@ program test_set_max_speed ...@@ -40,8 +36,6 @@ program test_set_max_speed
real, allocatable:: outside_points(:, :) ! (2, :) longitude and real, allocatable:: outside_points(:, :) ! (2, :) longitude and
! latitude, in rad, of all the extrema except the target extremum ! latitude, in rad, of all the extrema except the target extremum
namelist /main_nml/ ind_targ_extr
!---------------------------------------------------------------- !----------------------------------------------------------------
call mpi_init call mpi_init
...@@ -55,14 +49,11 @@ program test_set_max_speed ...@@ -55,14 +49,11 @@ program test_set_max_speed
call get_command_arg_dyn(1, shp_tr_dir, & call get_command_arg_dyn(1, shp_tr_dir, &
"Required argument: SHP-triplet-directory") "Required argument: SHP-triplet-directory")
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)
print *, "Reading from h.nc..." print *, "Reading from h.nc..."
call nf95_open("h.nc", nf90_nowrite, ncid) call nf95_open("h.nc", nf90_nowrite, ncid)
! Read corner:
call find_coord(ncid, dimid = dimid, varid = varid, std_name = "longitude") call find_coord(ncid, dimid = dimid, varid = varid, std_name = "longitude")
call nf95_inquire_dimension(ncid, dimid, nclen = nlon) call nf95_inquire_dimension(ncid, dimid, nclen = nlon)
call nf95_get_var(ncid, varid, corner(1)) call nf95_get_var(ncid, varid, corner(1))
...@@ -71,6 +62,8 @@ program test_set_max_speed ...@@ -71,6 +62,8 @@ program test_set_max_speed
call nf95_inquire_dimension(ncid, dimid, nclen = nlat) call nf95_inquire_dimension(ncid, dimid, nclen = nlat)
call nf95_get_var(ncid, varid, corner(2)) call nf95_get_var(ncid, varid, corner(2))
corner = corner * deg_to_rad
allocate(ssh(nlon, nlat)) allocate(ssh(nlon, nlat))
call nf95_inq_varid(ncid, "adt", varid) call nf95_inq_varid(ncid, "adt", varid)
call nf95_get_var(ncid, varid, ssh) call nf95_get_var(ncid, varid, ssh)
...@@ -112,9 +105,10 @@ program test_set_max_speed ...@@ -112,9 +105,10 @@ program test_set_max_speed
outside_points = outside_points * deg_to_rad outside_points = outside_points * deg_to_rad
close(unit) close(unit)
step = 0.25 * deg_to_rad
call set_max_speed(e, ind_targ_extr, outside_points, ssh, u, v, & call set_max_speed(e, nint((e%coord_extr - corner) / step) + 1, &
corner * deg_to_rad, step = [0.25, 0.25] * deg_to_rad) outside_points, ssh, u, v, corner, step)
call shp_create_03("test_set_max_speed", shpt_polygon, hshp) call shp_create_03("test_set_max_speed", shpt_polygon, hshp)
call dbf_add_field_03(ifield, hshp, 'ssh', ftdouble, nwidth = 13, & call dbf_add_field_03(ifield, hshp, 'ssh', ftdouble, nwidth = 13, &
......
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