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

In test_mean_speed, do not read the names of files on the command line

because the order is not obvious.

In test_mean_speed and test_set_max_speed, do not read primary
variables with nf95_gw_var so the primary variables are allowed to
have or not a degenerate dimension.
parent 33b80385
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,6 @@ contains
! innermost_level < extremum for a maximum, > extremum for a
! minimum.
logical, intent(out), allocatable:: local_min(:) ! (n_extr)
! Local:
......
......@@ -5,9 +5,9 @@ program test_mean_speed
use contour_531, only: polyline
use mean_speed_m, only: mean_speed
use netcdf, only: nf90_nowrite
use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, nf95_gw_var, &
nf95_get_var
use nr_util, only: pi, assert
use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, nf95_get_var, &
find_coord, nf95_inquire_dimension
use nr_util, only: pi
use shapelib, only: shpclose, shpfileobject, shpobject
use shapelib_03, only: shp_open_03, shp_read_object_03
......@@ -15,9 +15,9 @@ program test_mean_speed
real m, corner(2)
real:: center(2) = [9.625, - 33.875]
integer ncid, varid, length, status
character(len = :), allocatable:: velocity_file, shapefile
real, allocatable:: u(:, :), v(:, :) ! wind, in m s-1
integer ncid, varid, dimid
integer nlon, nlat
real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1
TYPE(shpfileobject) hshp
TYPE(shpobject) psobject
type(polyline) p
......@@ -27,41 +27,32 @@ program test_mean_speed
!---------------------------------------------------------------------
call assert(COMMAND_ARGUMENT_COUNT() == 2, &
"Required arguments: velocity-file shapefile")
call get_command_argument(number = 1, length = length, status = status)
allocate(character(len = length):: velocity_file)
call get_command_argument(1, velocity_file)
call get_command_argument(number = 2, length = length, status = status)
allocate(character(len = length):: shapefile)
call get_command_argument(2, shapefile)
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 ", velocity_file, "..."
call nf95_open(velocity_file, nf90_nowrite, ncid)
call nf95_open("uv.nc", nf90_nowrite, ncid)
call nf95_inq_varid(ncid, "u", varid)
call nf95_gw_var(ncid, varid, u)
call nf95_inq_varid(ncid, "v", varid)
call nf95_gw_var(ncid, varid, v)
call nf95_inq_varid(ncid, "lon", varid)
call find_coord(ncid, dimid = dimid, varid = varid, std_name = "longitude")
call nf95_inquire_dimension(ncid, dimid, nclen = nlon)
call nf95_get_var(ncid, varid, corner(1))
call nf95_inq_varid(ncid, "lat", varid)
call find_coord(ncid, dimid = dimid, varid = varid, std_name = "latitude")
call nf95_inquire_dimension(ncid, dimid, nclen = nlat)
call nf95_get_var(ncid, varid, corner(2))
allocate(u(nlon, nlat), v(nlon, nlat))
call nf95_inq_varid(ncid, "u", varid)
call nf95_get_var(ncid, varid, u)
call nf95_inq_varid(ncid, "v", varid)
call nf95_get_var(ncid, varid, v)
call nf95_close(ncid)
print *, "Reading from ", shapefile, "..."
call shp_open_03(shapefile, "rb", hshp)
call shp_open_03("contour", "rb", hshp)
call shp_read_object_03(hshp, 0, psobject)
CALL shpclose(hshp)
......
......@@ -6,7 +6,7 @@ program test_set_max_speed
use derived_types, only: eddy
use netcdf, only: nf90_nowrite
use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, nf95_get_var, &
nf95_gw_var
find_coord, nf95_inquire_dimension
use nr_util, only: pi
use set_max_speed_m, only: set_max_speed
use shapelib, only: shpt_polygon, shpfileobject, ftdouble, shpclose, &
......@@ -16,15 +16,16 @@ program test_set_max_speed
implicit none
integer ncid, varid
real, allocatable:: ssh(:, :) ! sea-surface height, in m
real, allocatable:: u(:, :), v(:, :) ! wind, in m s-1
integer ncid, varid, dimid
integer nlon, nlat
real, allocatable:: ssh(:, :) ! (nlon, nlat) sea-surface height, in m
real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1
type(eddy) e
integer:: ind_targ_extr(2) = [5, 4]
! indices of the target extremum, relative to corner
integer, allocatable:: extr_map(:, :) ! map of extrema
integer, allocatable:: extr_map(:, :) ! (nlon, nlat) map of extrema
real corner(2)
real, parameter:: deg_over_rad = pi / 180.
real, parameter:: rad_over_deg = 180. / pi
......@@ -48,33 +49,39 @@ program test_set_max_speed
print *, "Reading from h.nc..."
call nf95_open("h.nc", nf90_nowrite, ncid)
call nf95_inq_varid(ncid, "adt", varid)
call nf95_gw_var(ncid, varid, ssh)
call nf95_inq_varid(ncid, "lon", varid)
call find_coord(ncid, dimid = dimid, varid = varid, std_name = "longitude")
call nf95_inquire_dimension(ncid, dimid, nclen = nlon)
call nf95_get_var(ncid, varid, corner(1))
call nf95_inq_varid(ncid, "lat", varid)
call find_coord(ncid, dimid = dimid, varid = varid, std_name = "latitude")
call nf95_inquire_dimension(ncid, dimid, nclen = nlat)
call nf95_get_var(ncid, varid, corner(2))
allocate(ssh(nlon, nlat))
call nf95_inq_varid(ncid, "adt", varid)
call nf95_get_var(ncid, varid, ssh)
call nf95_close(ncid)
print *, "Reading from uv.nc..."
call nf95_open("uv.nc", nf90_nowrite, ncid)
allocate(u(nlon, nlat), v(nlon, nlat))
call nf95_inq_varid(ncid, "u", varid)
call nf95_gw_var(ncid, varid, u)
call nf95_get_var(ncid, varid, u)
call nf95_inq_varid(ncid, "v", varid)
call nf95_gw_var(ncid, varid, v)
call nf95_get_var(ncid, varid, v)
call nf95_close(ncid)
print *, "Reading from extr_map.nc..."
call nf95_open("extr_map.nc", nf90_nowrite, ncid)
allocate(extr_map(nlon, nlat))
call nf95_inq_varid(ncid, "extr_map", varid)
call nf95_gw_var(ncid, varid, extr_map)
call nf95_get_var(ncid, varid, extr_map)
call nf95_close(ncid)
......
......@@ -24,31 +24,31 @@
},
{
"args" : ["$compil_prod_dir/test_local_extrema",
"$input_dir/h_test_region.nc"],
"$input_dir/h_region_1.nc"],
"title" : "Local_extrema"
},
{
"args" : ["$compil_prod_dir/test_local_extrema",
"$input_dir/h_test_get_snapshot_larger.nc"],
"$input_dir/h_region_2.nc"],
"title" : "Local_extrema_larger"
},
{
"args" : "$compil_prod_dir/test_get_1_outerm",
"required": [["$input_dir/h_test_region.nc", "h.nc"],
"required": [["$input_dir/h_region_1.nc", "h.nc"],
["$tests_old_dir/Local_extrema/test_local_extrema.nc", "extr_map.nc"]],
"title" : "Get_1_outerm",
"input" : "&main_nml /\n"
},
{
"args" : "$compil_prod_dir/test_get_1_outerm",
"required": [["$input_dir/h_test_region.nc", "h.nc"],
"required": [["$input_dir/h_region_1.nc", "h.nc"],
["$input_dir/extr_map_negative_2_8.nc", "extr_map.nc"]],
"title" : "Get_1_outerm_noise_2_8",
"input" : "&main_nml /\n"
},
{
"args" : "$compil_prod_dir/test_get_1_outerm",
"required": [["$input_dir/h_test_region.nc", "h.nc"],
"required": [["$input_dir/h_region_1.nc", "h.nc"],
["$input_dir/extr_map_negative_2.nc", "extr_map.nc"]],
"title" : "Get_1_outerm_noise_2",
"input" : "&main_nml /\n"
......@@ -66,16 +66,23 @@
"stdin" : "$stdin_dir/max_speed_contour_ssh_nml.txt"
},
{
"args" : ["$compil_prod_dir/test_mean_speed",
"$input_dir/uv_test_region.nc",
"$tests_old_dir/Get_1_outerm/test_get_1_outerm"],
"args" : "$compil_prod_dir/test_mean_speed",
"required": [["$input_dir/uv_region_1.nc", "uv.nc"],
["$tests_old_dir/Get_1_outerm/test_get_1_outerm.shp",
"contour.shp"],
["$tests_old_dir/Get_1_outerm/test_get_1_outerm.dbf",
"contour.dbf"],
["$tests_old_dir/Get_1_outerm/test_get_1_outerm.shx",
"contour.shx"]],
"title" : "Mean_speed",
"input" : "&main_nml /\n"
},
{
"args" : ["$compil_prod_dir/test_mean_speed",
"$input_dir/uv_test_region.nc",
"$input_dir/outermost_contour_alt"],
"args" : "$compil_prod_dir/test_mean_speed",
"required": [["$input_dir/uv_region_1.nc","uv.nc"],
["$input_dir/outermost_contour_alt.shp", "contour.shp"],
["$input_dir/outermost_contour_alt.dbf", "contour.dbf"],
["$input_dir/outermost_contour_alt.shx", "contour.shx"]],
"title" : "Mean_speed_alt",
"input" : "&main_nml /\n"
},
......@@ -93,8 +100,8 @@
{
"args": "$compil_prod_dir/test_set_max_speed",
"title": "Set_max_speed_noise",
"required": [["$input_dir/h_test_region.nc", "h.nc"],
["$input_dir/uv_test_region.nc", "uv.nc"],
"required": [["$input_dir/h_region_1.nc", "h.nc"],
["$input_dir/uv_region_1.nc", "uv.nc"],
["$input_dir/extr_map_negative_2_8.nc", "extr_map.nc"],
"$tests_old_dir/Get_1_outerm_noise_2_8/test_get_1_outerm.shp",
"$tests_old_dir/Get_1_outerm_noise_2_8/test_get_1_outerm.shx",
......@@ -103,36 +110,36 @@
},
{
"args": ["$compil_prod_dir/test_set_all_outerm",
"$input_dir/h_comparison_region.nc"],
"$input_dir/h_region_3.nc"],
"title": "Set_all_outerm",
"input": "0.001\n"
},
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot",
"required": [["$input_dir/h_test_get_snapshot.nc", "h.nc"],
["$input_dir/uv_test_get_snapshot.nc", "uv.nc"]],
"required": [["$input_dir/h_region_1.nc", "h.nc"],
["$input_dir/uv_region_1.nc", "uv.nc"]],
"input": "0.\n"
},
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot_noise",
"required": [["$input_dir/h_test_get_snapshot.nc", "h.nc"],
["$input_dir/uv_test_get_snapshot.nc", "uv.nc"]],
"required": [["$input_dir/h_region_1.nc", "h.nc"],
["$input_dir/uv_region_1.nc", "uv.nc"]],
"input": "1e-3\n"
},
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot_larger",
"required": [["$input_dir/h_test_get_snapshot_larger.nc", "h.nc"],
["$input_dir/uv_test_get_snapshot_larger.nc", "uv.nc"]],
"required": [["$input_dir/h_region_2.nc", "h.nc"],
["$input_dir/uv_region_2.nc", "uv.nc"]],
"input": "0.\n"
},
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot_larger_noise",
"required": [["$input_dir/h_test_get_snapshot_larger.nc", "h.nc"],
["$input_dir/uv_test_get_snapshot_larger.nc", "uv.nc"]],
"required": [["$input_dir/h_region_2.nc", "h.nc"],
["$input_dir/uv_region_2.nc", "uv.nc"]],
"input": "1e-3\n"
},
{
......@@ -148,16 +155,16 @@
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot_120",
"required": [["$input_dir/h_comparison_region.nc", "h.nc"],
["$input_dir/uv_comparison_region.nc", "uv.nc"]],
"required": [["$input_dir/h_region_3.nc", "h.nc"],
["$input_dir/uv_region_3.nc", "uv.nc"]],
"input": "0.\n",
"description": "Larger region, 120 x 120. Includes degenerate extrema."
},
{
"args": "$compil_prod_dir/test_get_snapshot",
"title": "Get_snapshot_120_min",
"required": [["$input_dir/h_comparison_region.nc", "h.nc"],
["$input_dir/uv_comparison_region.nc", "uv.nc"]],
"required": [["$input_dir/h_region_3.nc", "h.nc"],
["$input_dir/uv_region_3.nc", "uv.nc"]],
"input": "1e-3\n",
"description": "Same as Get_snapshot_120 except with 1 mm minimum amplitude."
}
......
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