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
49698608
Commit
49698608
authored
4 years ago
by
POLCHER Jan
Browse files
Options
Downloads
Patches
Plain Diff
Added the parameters to the GraphFile so that ORCHIDEE can read it.
parent
2eafc43d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
HydroGrid.py
+28
-0
28 additions, 0 deletions
HydroGrid.py
Interface.py
+29
-1
29 additions, 1 deletion
Interface.py
RoutingPreProc.py
+2
-1
2 additions, 1 deletion
RoutingPreProc.py
with
59 additions
and
2 deletions
HydroGrid.py
+
28
−
0
View file @
49698608
...
...
@@ -258,3 +258,31 @@ class HydroData :
self
.
floodplainsdesc
=
nf
.
variables
[
"
floodplains
"
].
long_name
else
:
self
.
floodplains
=
gather
(
np
.
zeros
((
jend
-
jstr
,
iend
-
istr
)).
astype
(
np
.
float32
),
index
)
class
HydroParameter
:
# Class to set, compute and manage the time constants of the routing scheme.
def
__init__
(
self
,
hydrogrid
)
:
if
hydrogrid
.
hd
>=
0.5
:
# Case of the Fekete/Vörösmarty hydrological data set
self
.
stream_tcst
=
0.24
self
.
fast_tcst
=
3.0
self
.
slow_tcst
=
25.0
self
.
flood_tcst
=
4.0
self
.
swamp_tcst
=
0.2
elif
hydrogrid
.
hd
>=
0.016
:
# Case for MERIT
self
.
stream_tcst
=
0.7
self
.
fast_tcst
=
1.0
self
.
slow_tcst
=
10.0
self
.
flood_tcst
=
4.0
self
.
swamp_tcst
=
0.2
elif
hydrogrid
.
hd
>=
0.008
:
# Case for HydroSEHDS
self
.
stream_tcst
=
0.01
self
.
fast_tcst
=
0.5
self
.
slow_tcst
=
7.0
self
.
flood_tcst
=
4.0
self
.
swamp_tcst
=
0.2
else
:
print
(
"
For the resolution
"
,
hydrogrid
.
hd
,
"
deg. we do not yet have a parameter set.
"
)
sys
.
exit
This diff is collapsed.
Click to expand it.
Interface.py
+
29
−
1
View file @
49698608
...
...
@@ -176,6 +176,33 @@ def addenvironment(outnf, procgrid, part, vtyp, NCFillValue, nbpt) :
#
return
#
# Add time constants and possibly other prameters to the graph file
#
def
addparameters
(
outnf
,
part
,
tcst
,
vtyp
,
NCFillValue
)
:
if
part
.
rank
==
0
:
outnf
.
createDimension
(
'
dimpara
'
,
1
)
stream
=
outnf
.
createVariable
(
"
StreamTimeCst
"
,
vtyp
,
(
'
dimpara
'
),
fill_value
=
NCFillValue
)
stream
.
title
=
"
Time constant for the stream reservoir
"
stream
.
units
=
"
day/m
"
stream
[:]
=
tcst
.
stream_tcst
fast
=
outnf
.
createVariable
(
"
FastTimeCst
"
,
vtyp
,
(
'
dimpara
'
),
fill_value
=
NCFillValue
)
fast
.
title
=
"
Time constant for the fast reservoir
"
fast
.
units
=
"
day/m
"
fast
[:]
=
tcst
.
fast_tcst
slow
=
outnf
.
createVariable
(
"
SlowTimeCst
"
,
vtyp
,
(
'
dimpara
'
),
fill_value
=
NCFillValue
)
slow
.
title
=
"
Time constant for the slow reservoir
"
slow
.
units
=
"
day/m
"
slow
[:]
=
tcst
.
slow_tcst
flood
=
outnf
.
createVariable
(
"
FloodTimeCst
"
,
vtyp
,
(
'
dimpara
'
),
fill_value
=
NCFillValue
)
flood
.
title
=
"
Time constant for the flood reservoir
"
flood
.
units
=
"
day/m
"
flood
[:]
=
tcst
.
flood_tcst
swamp
=
outnf
.
createVariable
(
"
SwampCst
"
,
vtyp
,
(
'
dimpara
'
),
fill_value
=
NCFillValue
)
swamp
.
title
=
"
Fraction of the river transport that flows to the swamps
"
swamp
.
units
=
"
-
"
swamp
[:]
=
tcst
.
flood_tcst
return
#
#
#
def
finalfetch
(
part
,
routing_area
,
basin_count
,
route_togrid
,
route_tobasin
,
fetch_in
)
:
...
...
@@ -690,7 +717,7 @@ class HydroGraph :
#
#
#
def
dumpnetcdf
(
self
,
filename
,
globalgrid
,
procgrid
,
part
)
:
def
dumpnetcdf
(
self
,
filename
,
globalgrid
,
procgrid
,
part
,
tcst
)
:
#
NCFillValue
=
1.0e20
vtyp
=
np
.
float64
...
...
@@ -711,6 +738,7 @@ class HydroGraph :
#
addcoordinates
(
outnf
,
globalgrid
,
procgrid
,
part
,
vtyp
,
NCFillValue
,
nbcorners
,
cornerind
)
addenvironment
(
outnf
,
procgrid
,
part
,
vtyp
,
NCFillValue
,
self
.
nbpt
)
addparameters
(
outnf
,
part
,
tcst
,
vtyp
,
NCFillValue
)
#
# land grid index -> to facilitate the analyses of the routing
#
...
...
This diff is collapsed.
Click to expand it.
RoutingPreProc.py
+
2
−
1
View file @
49698608
...
...
@@ -74,6 +74,7 @@ INFO("nbasmax : {0}".format(nbasmax))
#
INFO
(
"
=================== HYDRODATA ====================
"
)
hydrodata
=
HG
.
HydroData
(
hydrogrid
.
ncfile
,
hydrogrid
.
box
,
w
.
index
,
part
,
hydrogrid
)
hydrotcst
=
HG
.
HydroParameter
(
hydrogrid
)
INFO
(
"
=================== INITATMGRID ====================
"
)
IF
.
initatmgrid
(
rank
,
nbcore
,
nbpt
,
modelgrid
)
...
...
@@ -122,6 +123,6 @@ print("Rank : {0} - Basin_count After Truncate : ".format(part.rank), hsuper.bas
INFO
(
"
=================== HydroGraph ====================
"
)
hgraph
=
IF
.
HydroGraph
(
nbasmax
,
hsuper
,
part
,
modelgrid
)
hgraph
.
dumpnetcdf
(
OutGraphFile
,
gg
,
modelgrid
,
part
)
hgraph
.
dumpnetcdf
(
OutGraphFile
,
gg
,
modelgrid
,
part
,
hydrotcst
)
IF
.
closeinterface
(
comm
)
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