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
3b997f43
Commit
3b997f43
authored
Jan 17, 2021
by
POLCHER Jan
🚴🏾
Browse files
The area weighted topoindex histogram is also computed.
parent
3378ab20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
GraphHydro.py
GraphHydro.py
+12
-2
No files found.
GraphHydro.py
View file @
3b997f43
...
...
@@ -163,16 +163,21 @@ class HydroGraph :
#
#
#
def
add_tstepdistrib
(
self
,
outnf
,
procgrid
,
NCFillValue
,
part
,
data
,
vtyp
,
nbbins
,
tcst
,
arrayorder
=
'F'
)
:
def
add_tstepdistrib
(
self
,
outnf
,
procgrid
,
NCFillValue
,
part
,
data
,
area
,
vtyp
,
nbbins
,
tcst
,
arrayorder
=
'F'
)
:
var
=
procgrid
.
landscatter
(
data
.
astype
(
vtyp
),
order
=
arrayorder
)
gvar
=
part
.
gather
(
var
,
default
=
NCFillValue
)
larea
=
procgrid
.
landscatter
(
area
.
astype
(
vtyp
),
order
=
arrayorder
)
garea
=
part
.
gather
(
larea
,
default
=
NCFillValue
)
if
part
.
rank
==
0
:
gvar
[
gvar
>=
NCFillValue
]
=
np
.
nan
#
hist
,
bin_edges
=
np
.
histogram
(
gvar
[
~
np
.
isnan
(
gvar
)],
bins
=
nbbins
,
range
=
(
0
,
min
(
10000
,
np
.
nanmax
(
gvar
))))
whist
,
bin_edges
=
np
.
histogram
(
gvar
[
~
np
.
isnan
(
gvar
)],
weights
=
garea
[
~
np
.
isnan
(
gvar
)],
\
bins
=
nbbins
,
range
=
(
0
,
min
(
10000
,
np
.
nanmax
(
gvar
))))
#
topobins
=
outnf
.
createVariable
(
"topobins"
,
vtyp
,
(
'nbbnds'
,
'nbbins'
))
topobins
.
title
=
"Topographic index"
topobins
.
units
=
"km"
...
...
@@ -182,6 +187,10 @@ class HydroGraph :
topohist
.
title
=
"Counts of HTU by topoindex"
topohist
.
units
=
"counts"
topohist
[:]
=
hist
[:]
wtopohist
=
outnf
.
createVariable
(
"wtopocount"
,
vtyp
,
(
"nbbins"
,),
fill_value
=
NCFillValue
)
wtopohist
.
title
=
"Area weighted counts of HTU by topoindex"
wtopohist
.
units
=
"counts"
wtopohist
[:]
=
whist
[:]
#
thist
,
tbin_edges
=
np
.
histogram
(
gvar
[
~
np
.
isnan
(
gvar
)]
*
tcst
.
stream_tcst
,
bins
=
nbbins
,
range
=
(
0
,
RPP
.
OneDay
/
8
))
tbins
=
outnf
.
createVariable
(
"tstepbins"
,
vtyp
,
(
'nbbnds'
,
'nbbins'
))
...
...
@@ -300,7 +309,8 @@ class HydroGraph :
# topographic index
self
.
add_variable
(
outnf
,
procgrid
,
NCFillValue
,
part
,
(
'z'
,
'y'
,
'x'
),
\
"topoindex"
,
"Topographic index of the retention time"
,
"km"
,
self
.
topo_resid
[:,:],
vtyp
)
self
.
add_tstepdistrib
(
outnf
,
procgrid
,
NCFillValue
,
part
,
self
.
topo_resid
[:,:],
vtyp
,
nbbins
,
tcst
)
self
.
add_tstepdistrib
(
outnf
,
procgrid
,
NCFillValue
,
part
,
self
.
topo_resid
[:,:],
self
.
routing_area
[:,:],
\
vtyp
,
nbbins
,
tcst
)
#
# Inflow number
...
...
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