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

In program test_max_speed_contour_ssh, read u and v with get_var in

order to take missing value attribute into account.
parent 364f3d64
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,9 @@ src_test_successive_overlap = test_successive_overlap.f derived_types.f successi ...@@ -29,7 +29,9 @@ src_test_successive_overlap = test_successive_overlap.f derived_types.f successi
src_test_nearby_extr = test_nearby_extr.f nearby_extr.f derived_types.f src_test_nearby_extr = test_nearby_extr.f nearby_extr.f derived_types.f
sources := $(sort ${src_test_local_extrema} ${src_test_get_1_outerm} ${src_test_set_max_speed} ${src_test_get_snapshot} ${src_test_set_all_outerm} ${src_test_weight} ${src_test_spherical_polygon_area} ${src_test_read_eddy} ${src_test_read_snapshot} ${src_test_successive_overlap} ${src_test_nearby_extr}) test_good_contour.f test_inside_4.f test_max_speed_contour_ssh.f test_mean_speed.f test_spherical_polyline_area.f src_test_max_speed_contour_ssh = test_max_speed_contour_ssh.f max_speed_contour_ssh.f get_var.f
sources := $(sort ${src_test_local_extrema} ${src_test_get_1_outerm} ${src_test_set_max_speed} ${src_test_get_snapshot} ${src_test_set_all_outerm} ${src_test_weight} ${src_test_spherical_polygon_area} ${src_test_read_eddy} ${src_test_read_snapshot} ${src_test_successive_overlap} ${src_test_nearby_extr} ${src_test_max_speed_contour_ssh}) test_good_contour.f test_inside_4.f test_mean_speed.f test_spherical_polyline_area.f
lib_list = GPC_F contour_531 numer_rec_95 GPC shapelib_03 netcdf95 geometry jumble netcdff fortrangis shp fortranc nr_util lib_list = GPC_F contour_531 numer_rec_95 GPC shapelib_03 netcdf95 geometry jumble netcdff fortrangis shp fortranc nr_util
...@@ -46,6 +48,7 @@ obj_test_read_eddy := $(src_test_read_eddy:.f=.o) ...@@ -46,6 +48,7 @@ obj_test_read_eddy := $(src_test_read_eddy:.f=.o)
obj_test_read_snapshot := $(src_test_read_snapshot:.f=.o) obj_test_read_snapshot := $(src_test_read_snapshot:.f=.o)
obj_test_successive_overlap := $(src_test_successive_overlap:.f=.o) obj_test_successive_overlap := $(src_test_successive_overlap:.f=.o)
obj_test_nearby_extr := $(src_test_nearby_extr:.f=.o) obj_test_nearby_extr := $(src_test_nearby_extr:.f=.o)
obj_test_max_speed_contour_ssh := $(src_test_max_speed_contour_ssh:.f=.o)
objects := $(sources:.f=.o) objects := $(sources:.f=.o)
...@@ -63,7 +66,7 @@ endif ...@@ -63,7 +66,7 @@ endif
all: ${execut} log all: ${execut} log
test_get_1_outerm: ${obj_test_get_1_outerm} test_get_1_outerm: ${obj_test_get_1_outerm}
test_set_max_speed: ${obj_test_set_max_speed} test_set_max_speed: ${obj_test_set_max_speed}
test_max_speed_contour_ssh: max_speed_contour_ssh.o test_max_speed_contour_ssh: ${obj_test_max_speed_contour_ssh}
test_good_contour: good_contour.o test_good_contour: good_contour.o
test_inside_4: inside_4.o test_inside_4: inside_4.o
test_local_extrema: ${obj_test_local_extrema} test_local_extrema: ${obj_test_local_extrema}
......
program test_max_speed_contour_ssh program test_max_speed_contour_ssh
use, intrinsic:: ieee_arithmetic, only: ieee_value, IEEE_QUIET_NAN
use, intrinsic:: ISO_FORTRAN_ENV use, intrinsic:: ISO_FORTRAN_ENV
! Libraries: ! Libraries:
use jumble, only: get_command_arg_dyn use jumble, only: get_command_arg_dyn
use netcdf, only: nf90_nowrite use netcdf, only: nf90_nowrite
use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, nf95_get_var, & use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, nf95_gw_var
nf95_gw_var
use nr_util, only: assert use nr_util, only: assert
use get_var_m, only: get_var
use max_speed_contour_ssh_m, only: max_speed_contour_ssh use max_speed_contour_ssh_m, only: max_speed_contour_ssh
implicit none implicit none
integer n_lon, n_lat integer nlon, nlat
character(len = :), allocatable:: adt_file, velocity_file character(len = :), allocatable:: adt_file, velocity_file
integer ncid, varid integer ncid, varid
real, allocatable:: ssh(:, :, :) ! (n_lon, n_lat, 1) sea-surface height, in m real, allocatable:: ssh(:, :, :) ! (nlon, nlat, 1) sea-surface height, in m
real, allocatable:: u(:, :), v(:, :) ! (n_lon, n_lat) wind, in m s-1 real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1
integer:: ind_extr(2) = [19, 11] integer:: ind_extr(2) = [19, 11]
! indices in the two dimensions of the extremum ! indices in the two dimensions of the extremum
...@@ -46,19 +47,18 @@ program test_max_speed_contour_ssh ...@@ -46,19 +47,18 @@ program test_max_speed_contour_ssh
call nf95_gw_var(ncid, varid, ssh) call nf95_gw_var(ncid, varid, ssh)
call nf95_close(ncid) call nf95_close(ncid)
n_lon = size(ssh, 1) nlon = size(ssh, 1)
n_lat = size(ssh, 2) nlat = size(ssh, 2)
allocate(u(n_lon, n_lat), v(n_lon, n_lat)) allocate(u(nlon, nlat), v(nlon, nlat))
print *, "Reading from ", velocity_file, "..." print *, "Reading from ", velocity_file, "..."
call nf95_open(velocity_file, nf90_nowrite, ncid) call nf95_open(velocity_file, nf90_nowrite, ncid)
call get_var(periodic = .false., max_rad_lon = 0, values = u, ncid = ncid, &
call nf95_inq_varid(ncid, "u", varid) nlon = nlon, k = 1, name = "u", &
call nf95_get_var(ncid, varid, u) new_fill_value = ieee_value(0., IEEE_QUIET_NAN))
call get_var(periodic = .false., max_rad_lon = 0, values = v, ncid = ncid, &
call nf95_inq_varid(ncid, "v", varid) nlon = nlon, k = 1, name = "v", &
call nf95_get_var(ncid, varid, v) new_fill_value = ieee_value(0., IEEE_QUIET_NAN))
call nf95_close(ncid) call nf95_close(ncid)
print *, "level = ", max_speed_contour_ssh(ssh(:, :, 1), u, v, ind_extr, & print *, "level = ", max_speed_contour_ssh(ssh(:, :, 1), u, v, ind_extr, &
......
...@@ -13,6 +13,7 @@ successive_overlap.o : weight.o spherical_polyline_area.o spherical_polygon_area ...@@ -13,6 +13,7 @@ successive_overlap.o : weight.o spherical_polyline_area.o spherical_polygon_area
test_get_1_outerm.o : get_1_outerm.o derived_types.o test_get_1_outerm.o : get_1_outerm.o derived_types.o
test_get_snapshot.o : init_shapefiles.o get_snapshot.o dispatch_snapshot.o derived_types.o test_get_snapshot.o : init_shapefiles.o get_snapshot.o dispatch_snapshot.o derived_types.o
test_local_extrema.o : local_extrema.o test_local_extrema.o : local_extrema.o
test_max_speed_contour_ssh.o : max_speed_contour_ssh.o get_var.o
test_nearby_extr.o : nearby_extr.o derived_types.o test_nearby_extr.o : nearby_extr.o derived_types.o
test_read_eddy.o : write_eddy.o read_field_indices.o read_eddy.o init_shapefiles.o derived_types.o test_read_eddy.o : write_eddy.o read_field_indices.o read_eddy.o init_shapefiles.o derived_types.o
test_read_snapshot.o : read_snapshot.o init_shapefiles.o dispatch_snapshot.o derived_types.o test_read_snapshot.o : read_snapshot.o init_shapefiles.o dispatch_snapshot.o derived_types.o
...@@ -25,6 +26,5 @@ weight.o : derived_types.o ...@@ -25,6 +26,5 @@ weight.o : derived_types.o
write_eddy.o : init_shapefiles.o derived_types.o write_eddy.o : init_shapefiles.o derived_types.o
test_good_contour.o : good_contour.o test_good_contour.o : good_contour.o
test_inside_4.o : inside_4.o test_inside_4.o : inside_4.o
test_max_speed_contour_ssh.o : max_speed_contour_ssh.o
test_mean_speed.o : mean_speed.o test_mean_speed.o : mean_speed.o
test_spherical_polyline_area.o : spherical_polyline_area.o test_spherical_polyline_area.o : spherical_polyline_area.o
...@@ -19,8 +19,10 @@ contains ...@@ -19,8 +19,10 @@ contains
! longitude, in number of grid points, used only if periodic ! longitude, in number of grid points, used only if periodic
real, intent(out):: values(1 - merge(max_rad_lon, 0, periodic):, :) real, intent(out):: values(1 - merge(max_rad_lon, 0, periodic):, :)
! (1 - merge(max_rad_lon, 0, periodic):nlon + merge(max_rad_lon, 0, ! (1 - merge(max_rad_lon, 0, periodic):nlon + merge(max_rad_lon,
! periodic), nlat) ssh, u or v ! 0, periodic), nlat) ssh, u or v. We cannot place this argument
! first because the declaration references max_rad_lon and
! periodic.
integer, intent(in):: ncid, nlon integer, intent(in):: ncid, nlon
integer, intent(in):: k ! date index integer, intent(in):: k ! date index
......
...@@ -11,6 +11,7 @@ contains ...@@ -11,6 +11,7 @@ contains
use, intrinsic:: IEEE_ARITHMETIC, only: IEEE_IS_NAN use, intrinsic:: IEEE_ARITHMETIC, only: IEEE_IS_NAN
! Library:
use nr_util, only: assert use nr_util, only: assert
real, intent(in):: ssh(:, :), u(:, :), v(:, :) real, intent(in):: ssh(:, :), u(:, :), v(:, :)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment