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
Open sidebar
IPSL
LMD
InTro
RoutingPP
Commits
3885fda4
Commit
3885fda4
authored
Jun 22, 2020
by
POLCHER Jan
🚴🏾
Browse files
Some cleanÃ-up in Interface.py
parent
b95f4ae2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
17 deletions
+4
-17
Interface.py
Interface.py
+4
-17
No files found.
Interface.py
View file @
3885fda4
...
...
@@ -669,7 +669,7 @@ class HydroGraph :
#
#
#
def
add_variable
(
self
,
outnf
,
procgrid
,
NCFillValue
,
part
,
coord
,
name
,
title
,
units
,
data
,
vtyp
,
orig_type
=
"float"
):
def
add_variable
(
self
,
outnf
,
procgrid
,
NCFillValue
,
part
,
coord
,
name
,
title
,
units
,
data
,
vtyp
,
orig_type
=
"float"
):
var
=
procgrid
.
landscatter
(
data
.
astype
(
vtyp
),
order
=
'F'
)
if
orig_type
==
"float"
:
...
...
@@ -715,26 +715,13 @@ class HydroGraph :
nbpt_loc
=
np
.
zeros
((
self
.
nbpt
,
1
)).
astype
(
np
.
int32
)
nbpt_loc
[:,
0
]
=
np
.
arange
(
1
,
self
.
nbpt
+
1
)
nbpt_glo
=
part
.
l2glandindex
(
nbpt_loc
)
self
.
add_variable
(
outnf
,
procgrid
,
NCFillValue
,
part
,
(
'y'
,
'x'
),
"nbpt_glo"
,
"
Gri
d point
Global
"
,
"-"
,
nbpt_glo
[:,
0
],
vtyp
)
self
.
add_variable
(
outnf
,
procgrid
,
NCFillValue
,
part
,
(
'y'
,
'x'
),
"nbpt_glo"
,
"
Lan
d point
indices on global grid
"
,
"-"
,
nbpt_glo
[:,
0
],
vtyp
)
#
################
#
# TEST: l2glandindex
itarget
=-
1
for
il
in
range
(
procgrid
.
nbland
)
:
lo
=
procgrid
.
lon_full
[
procgrid
.
indP
[
il
][
0
],
procgrid
.
indP
[
il
][
1
]]
la
=
procgrid
.
lat_full
[
procgrid
.
indP
[
il
][
0
],
procgrid
.
indP
[
il
][
1
]]
d
=
np
.
sqrt
((
lo
-
3.13
)
**
2
+
(
la
-
39.70
)
**
2
)
if
d
<
0.05
:
itarget
=
il
if
itarget
>+
0
:
print
(
part
.
rank
,
itarget
,
" Before route_togrid = "
,
self
.
route_togrid
[
itarget
,:])
# Conversion
# Conversion of grid indices for route_togrid
grgrid
=
part
.
l2glandindex
(
self
.
route_togrid
[:,:])
if
itarget
>+
0
:
print
(
part
.
rank
,
itarget
,
" After route_togrid = "
,
self
.
route_togrid
[
itarget
,:])
################
#
#
# The field route_togrid is with indices on the local grid. That needs to be converted to the global grid.
self
.
add_variable
(
outnf
,
procgrid
,
NCFillValue
,
part
,
(
'z'
,
'y'
,
'x'
),
"routetogrid"
,
"Grid into which the basin flows"
,
"-"
,
grgrid
,
vtyp
,
"int"
)
...
...
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