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

Add test for procedure spherical_polyline_area.

parent c7232be1
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@ src_test_set_all_outerm = test_set_all_outerm.f derived_types.f set_all_outerm.f
src_test_weight = test_weight.f weight.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}) test_good_contour.f test_inside_4.f test_max_speed_contour_ssh.f test_mean_speed.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}) test_good_contour.f test_inside_4.f test_max_speed_contour_ssh.f test_mean_speed.f test_spherical_polyline_area.f
lib_list = contour_531 numer_rec_95 shapelib_03 netcdf95 geometry jumble netcdff fortrangis shp fortranc nr_util
......@@ -31,7 +31,7 @@ obj_test_set_all_outerm := $(src_test_set_all_outerm:.f=.o)
obj_test_weight := $(src_test_weight:.f=.o)
objects := $(sources:.f=.o)
execut = test_good_contour test_inside_4 test_get_1_outerm test_local_extrema test_max_speed_contour_ssh test_mean_speed test_set_max_speed test_get_snapshot test_set_all_outerm test_weight
execut = test_good_contour test_inside_4 test_get_1_outerm test_local_extrema test_max_speed_contour_ssh test_mean_speed test_set_max_speed test_get_snapshot test_set_all_outerm test_weight test_spherical_polyline_area
# 3. Compiler-dependent part
......@@ -70,6 +70,7 @@ test_mean_speed: mean_speed.o
test_get_snapshot: ${obj_test_get_snapshot}
test_set_all_outerm: ${obj_test_set_all_outerm}
test_weight: ${obj_test_weight}
test_spherical_polyline_area: spherical_polyline_area.o
depend ${makefile_dir}/depend.mk:
makedepf90 -free -Wmissing -Wconfused $(addprefix -I, ${VPATH}) -nosrc $(addprefix -u , ${lib_list} shapelib netcdf intrinsic) ${sources} >${makefile_dir}/depend.mk
......
program test_spherical_polyline_area
use contour_531, only: polyline
use nr_util, only: pi
use spherical_polyline_area_m, only: spherical_polyline_area
implicit none
real points(2, 4)
real, parameter:: deg2rad = pi / 180.
!-------------------------------------------------------------------------
points(:, 1) = [0., 0.]
points(:, 2) = [30. * deg2rad, 0.]
points(:, 3) = [0., 30. * deg2rad]
points(:, 4) = points(:, 1)
print *, "Area = ", spherical_polyline_area(polyline(n_points = 4, &
closed = .true., points = points)) / 1e6, "km2"
end program test_spherical_polyline_area
......@@ -187,5 +187,9 @@
"input": "1e-3\n",
"description": "Same as Get_snapshot_region_4 with larger domain."
},
{"args": "$compil_prod_dir/test_weight", "title": "Weight"}
{"args": "$compil_prod_dir/test_weight", "title": "Weight"},
{
"args": "$compil_prod_dir/test_spherical_polyline_area",
"title": "Spherical_polyline_area"
}
]
......@@ -17,3 +17,4 @@ test_good_contour.o : good_contour.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_spherical_polyline_area.o : spherical_polyline_area.o
......@@ -6,8 +6,8 @@ contains
pure real function spherical_polyline_area(p)
! Assuming p is a polyline in longitude, latitude, in
! rad. Computing the area of a polyline in longitude, sin(latitude)
! Assuming p is a polyline in longitude, latitude, in rad, compute
! the area (positive) of a polyline in longitude, sin(latitude)
! with the same vertices. Result in m2.
use contour_531, only: polyline
......
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