Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Detection eddies
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
IPSL
LMD
DPAO
Detection eddies
Commits
9eb1c01d
Commit
9eb1c01d
authored
7 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
In program test_spherical_polygon_area, read a shapefile instead of
specifying polygon in source code.
parent
36b0c18c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/test_spherical_polygon_area.f
+20
-11
20 additions, 11 deletions
Tests/test_spherical_polygon_area.f
Tests/tests.json
+6
-3
6 additions, 3 deletions
Tests/tests.json
with
26 additions
and
14 deletions
Tests/test_spherical_polygon_area.f
+
20
−
11
View file @
9eb1c01d
program
test_spherical_polygon_area
use
contour_531
,
only
:
polyline
use
gpc_f
,
only
:
polygon
use
nr_util
,
only
:
pi
use
gpc_f
,
only
:
polygon
,
shpobj2pol
use
jumble
,
only
:
get_command_arg_dyn
use
nr_util
,
only
:
pi
,
assert
use
shapelib
,
only
:
shpfileobject
,
shpobject
,
shpclose
,
shpdestroyobject
use
shapelib_03
,
only
:
shp_open_03
,
shp_read_object_03
use
spherical_polygon_area_m
,
only
:
spherical_polygon_area
implicit
none
real
points
(
2
,
4
)
character
(
len
=
:),
allocatable
::
filename
TYPE
(
shpfileobject
)
hshp
TYPE
(
shpobject
)
psobject
type
(
POLYGON
)
p
real
,
parameter
::
deg2rad
=
pi
/
180.
integer
i
!---------------------------------------------------------------------
points
(:,
1
)
=
[
0.
,
0.
]
points
(:,
2
)
=
[
30.
*
deg2rad
,
0.
]
points
(:,
3
)
=
[
0.
,
30.
*
deg2rad
]
points
(:,
4
)
=
points
(:,
1
)
call
get_command_arg_dyn
(
1
,
filename
,
"Required argument: shapefile"
)
call
shp_open_03
(
filename
,
"rb"
,
hshp
)
call
shp_read_object_03
(
hshp
,
0
,
psobject
)
call
shpclose
(
hshp
)
call
assert
(
psobject
%
nparts
>=
1
,
"psobject%nparts >= 1"
)
call
assert
(
psobject
%
panpartstart
(
1
)
==
0
,
"psobject%panpartstart(1)"
)
p
=
shpobj2pol
(
psobject
)
call
shpdestroyobject
(
psobject
)
print
*
,
"Area = "
,
spherical_polygon_area
(
polygon
(
nparts
=
1
,
&
part
=
[
polyline
(
n_points
=
4
,
closed
=
.true.
,
points
=
points
)],
&
hole
=
[
.false.
]))
/
1e6
,
"km2"
forall
(
i
=
1
:
p
%
nparts
)
p
%
part
(
i
)
%
points
=
p
%
part
(
i
)
%
points
*
deg2rad
print
*
,
"Area = "
,
spherical_polygon_area
(
p
)
/
1e6
,
"km2"
end
program
test_spherical_polygon_area
This diff is collapsed.
Click to expand it.
Tests/tests.json
+
6
−
3
View file @
9eb1c01d
...
...
@@ -146,12 +146,14 @@
"input"
:
"1e-3
\n
"
},
{
"args"
:
[
"$compil_prod_dir/test_inside_4"
,
"$input_dir/outermost_eddy_5"
],
"args"
:
[
"$compil_prod_dir/test_inside_4"
,
"$input_dir/outermost_eddy_5"
],
"title"
:
"Inside_4_true"
,
"stdin"
:
"$stdin_dir/inside_4_true_nml.txt"
},
{
"args"
:
[
"$compil_prod_dir/test_inside_4"
,
"$input_dir/outermost_eddy_5"
],
"args"
:
[
"$compil_prod_dir/test_inside_4"
,
"$input_dir/outermost_eddy_5"
],
"title"
:
"Inside_4_false"
,
"stdin"
:
"$stdin_dir/inside_4_false_nml.txt"
},
...
...
@@ -193,7 +195,8 @@
"title"
:
"Spherical_polyline_area"
},
{
"args"
:
"$compil_prod_dir/test_spherical_polygon_area"
,
"args"
:
[
"$compil_prod_dir/test_spherical_polygon_area"
,
"$input_dir/triangle"
],
"title"
:
"Spherical_polygon_area"
}
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment