Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
RoutingPP
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
Container Registry
Model registry
Operate
Environments
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
Show more breadcrumbs
IPSL
LMD
InTro
RoutingPP
Commits
6f440c1a
Commit
6f440c1a
authored
5 years ago
by
POLCHER Jan
Browse files
Options
Downloads
Patches
Plain Diff
Included the special case where the intersection polygone is of length zero.
parent
b10aa2fd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RoutingPreProc.py
+9
-8
9 additions, 8 deletions
RoutingPreProc.py
with
9 additions
and
8 deletions
RoutingPreProc.py
+
9
−
8
View file @
6f440c1a
...
...
@@ -96,12 +96,13 @@ if not os.path.exists(wdir+"/"+wfile) :
index
=
hydrogrid
.
index
[
isel
]
if
cell
.
intersects_poly
(
hydrocell
):
inter
=
cell
.
intersection
(
hydrocell
)
inside
=
inter
.
polygons
[
0
].
_inside
if
hydrocell
.
contains_point
(
inside
)
and
cell
.
contains_point
(
inside
):
area_in
[
index
[
0
],
index
[
1
]]
=
inter
.
area
()
*
(
EarthRadius
**
2
)
else
:
area_in
[
index
[
0
],
index
[
1
]]
=
(
4
*
np
.
pi
-
inter
.
area
())
*
(
EarthRadius
**
2
)
# Another strange behaviour of SphericalHarmonics. There should be an overlap but the intersection polygone is empty.
if
len
(
inter
.
polygons
)
>
0
:
inside
=
inter
.
polygons
[
0
].
_inside
if
hydrocell
.
contains_point
(
inside
)
and
cell
.
contains_point
(
inside
):
area_in
[
index
[
0
],
index
[
1
]]
=
inter
.
area
()
*
(
EarthRadius
**
2
)
else
:
area_in
[
index
[
0
],
index
[
1
]]
=
(
4
*
np
.
pi
-
inter
.
area
())
*
(
EarthRadius
**
2
)
##############
# Output of Overlap areas for each grid point
...
...
@@ -110,8 +111,8 @@ if not os.path.exists(wdir+"/"+wfile) :
#RPP.dumpfield(area_in, hydrogrid.lon, hydrogrid.lat, ncfile, "Intersect area")
#
INFO
(
str
(
icell
)
+
"
Sum of overlap
"
+
str
(
np
.
sum
(
area_in
)
/
area
)
+
"
Nb of Hydro grid overlaping :
"
+
str
(
np
.
count_nonzero
(
area_in
)))
INFO
(
str
(
icell
)
+
"
Sum of overlap
"
+
str
(
np
.
sum
(
area_in
)
/
area
)
+
"
Nb of Hydro grid overlaping :
"
+
str
(
np
.
count_nonzero
(
area_in
)))
sub_index
.
append
(
np
.
where
(
area_in
>
0.0
))
sub_area
.
append
(
np
.
extract
(
area_in
>
0.0
,
area_in
))
sub_lon
.
append
(
np
.
extract
(
area_in
>
0.0
,
hydrogrid
.
lon
))
...
...
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