Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
IPSL
LMD
InTro
RoutingPP
Commits
d0a8f271
Commit
d0a8f271
authored
Feb 03, 2021
by
Anthony
Browse files
numba alternative instead of Fortran call -> I will remove the fortran part when it's fully tested
parent
50779cac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
Locations.py
Locations.py
+32
-0
No files found.
Locations.py
View file @
d0a8f271
...
...
@@ -9,6 +9,7 @@ import codecs
import
os
from
inspect
import
currentframe
,
getframeinfo
import
sys
from
numba
import
jit
#
import
F90tools
as
F90T
#
...
...
@@ -327,6 +328,7 @@ class PlacedLocations :
"""
g0
=
self
.
nbpt_glo
[
int
(
j
)
-
1
,
int
(
i
)
-
1
]
# -1 Because F -> C
b0
=
int
(
k
)
"""
mask = diagst.diagst.upstmask(
nbpt = self.nbpt,
nbasmax = self.nbasmax,
...
...
@@ -338,6 +340,14 @@ class PlacedLocations :
g0 = g0,
b0 = b0,
)
"""
mask
=
diag_upstmask
(
self
.
routetogrid
,
self
.
routetobasin
,
self
.
routenbintobas
,
self
.
basin_area
,
self
.
area
,
g0
,
b0
)
return
mask
def
mask
(
self
,
index
):
...
...
@@ -352,3 +362,25 @@ class PlacedLocations :
jj
,
ii
=
self
.
conv_land2ij
[
g
]
mask
[
jj
,
ii
]
=
min
(
mask_raw
[
g
],
1
)
return
mask
@
jit
(
nopython
=
True
)
def
diag_upstmask
(
routetogrid
,
routetobasin
,
routenbintobas
,
basin_area
,
area
,
g0
,
b0
):
"""
Attention à l'indexation
"""
nbpt
,
nbasmax
=
routetobasin
.
shape
mask
=
np
.
zeros
((
nbpt
))
for
ig
in
range
(
nbpt
):
nbas
=
routenbintobas
[
ig
]
for
ib
in
range
(
nbas
):
jg
=
ig
jb
=
ib
while
(
jb
<
nbasmax
):
if
((
jg
==
g0
-
1
)
and
(
jb
==
b0
-
1
)):
mask
[
ig
]
+=
basin_area
[
ig
,
ib
]
/
area
[
ig
]
jb
=
nbasmax
else
:
jt
=
int
(
routetogrid
[
jg
,
jb
]
-
1
)
jb
=
int
(
routetobasin
[
jg
,
jb
]
-
1
)
jg
=
jt
return
mask
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment