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
dad41b15
Commit
dad41b15
authored
Jan 13, 2021
by
Anthony
Browse files
Add lon/ lat variables to the Diagnostic file.
parent
bbf74fde
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
Locations.py
Locations.py
+2
-1
StationDiag.py
StationDiag.py
+10
-0
No files found.
Locations.py
View file @
dad41b15
...
...
@@ -294,12 +294,13 @@ class PlacedLocations :
self
.
lonrange
=
[
np
.
min
(
nc
.
variables
[
"lon"
][:,:]),
np
.
max
(
nc
.
variables
[
"lon"
][:,:])]
self
.
latrange
=
[
np
.
min
(
nc
.
variables
[
"lat"
][:,:]),
np
.
max
(
nc
.
variables
[
"lat"
][:,:])]
# Parameters
#to improve
basid
=
nc
.
variables
[
"basinid"
][:,:,:]
self
.
nbasmax
=
basid
.
shape
[
0
]
land
=
nc
.
variables
[
"land"
][:,:]
self
.
nbpt
=
int
(
np
.
sum
(
land
))
#
self
.
lnglat
=
{
varn
:
nc
.
variables
[
varn
][:]
for
varn
in
[
"lon"
,
"lat"
]}
#
# Grid points
self
.
nbpt_glo
=
nc
.
variables
[
"nbpt_glo"
][:]
a
=
np
.
unravel_index
(
ma
.
argsort
(
self
.
nbpt_glo
,
axis
=
None
)[:
self
.
nbpt
],
self
.
nbpt_glo
.
shape
)
...
...
StationDiag.py
View file @
dad41b15
...
...
@@ -88,6 +88,16 @@ nc.createDimension('x', L.gridshape[1])
nc
.
createDimension
(
'y'
,
L
.
gridshape
[
0
])
nc
.
setncattr
(
"RoutingGraph_File"
,
GraphFile
)
nc
.
setncattr
(
"GRDCObservation_File"
,
GRDCFile
)
# Lon and Lat variables
D
=
{
"lon"
:
[
"degrees east"
,
"Longitude"
,
"X"
],
"lat"
:
[
"degrees north"
,
"Latitude"
,
"Y"
]}
NCFillValue
=
1.0e20
for
vname
in
[
"lon"
,
"lat"
]:
var
=
nc
.
createVariable
(
vname
,
float
,
(
'y'
,
'x'
),
fill_value
=
NCFillValue
)
var
[:]
=
L
.
lnglat
[
vname
][:]
var
.
units
=
"grid box centre "
+
D
[
vname
][
0
]
var
.
title
=
D
[
vname
][
1
]
var
.
axis
=
D
[
vname
][
2
]
# Create variables only if the GRDC station has been placed on the graph
ncvar
=
[]
for
i
,
loc
in
enumerate
(
Lind
)
:
...
...
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