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
Admin message
Gitlab has been updated. More info
here
and
there
.
Show more breadcrumbs
IPSL
LMD
InTro
RoutingPP
Commits
82f98503
Commit
82f98503
authored
5 years ago
by
Anthony Schrapffer
Browse files
Options
Downloads
Patches
Plain Diff
Add an output to check the area calculation
parent
d8364a0d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RPPtools.py
+40
-0
40 additions, 0 deletions
RPPtools.py
with
40 additions
and
0 deletions
RPPtools.py
+
40
−
0
View file @
82f98503
...
@@ -36,3 +36,43 @@ def boxit(cent, dlon, dlat, polyres) :
...
@@ -36,3 +36,43 @@ def boxit(cent, dlon, dlat, polyres) :
# Close
# Close
boxll
.
append
(
boxll
[
0
])
boxll
.
append
(
boxll
[
0
])
return
boxll
return
boxll
#
# Simple routine to dump a field into a file.
#
def
dumpfield
(
x
,
lon
,
lat
,
filename
,
varname
)
:
#
from
netCDF4
import
Dataset
NCFillValue
=
1.0e20
vtyp
=
np
.
float64
#
print
(
"
Dumping overlap into file :
"
,
filename
)
i
=
np
.
nonzero
(
np
.
mean
(
x
,
axis
=
0
))
j
=
np
.
nonzero
(
np
.
mean
(
x
,
axis
=
1
))
ilen
=
np
.
max
(
i
)
-
np
.
min
(
i
)
+
1
jlen
=
np
.
max
(
j
)
-
np
.
min
(
j
)
+
1
print
(
"
Overlap
"
)
outnf
=
Dataset
(
filename
,
'
w
'
,
format
=
'
NETCDF4_CLASSIC
'
)
# Dimensions
outnf
.
createDimension
(
'
lon
'
,
ilen
)
outnf
.
createDimension
(
'
lat
'
,
jlen
)
lonnc
=
outnf
.
createVariable
(
"
lon
"
,
vtyp
,
(
'
lat
'
,
'
lon
'
),
fill_value
=
NCFillValue
)
lonnc
.
units
=
"
Longitude of grid box centre degrees east
"
lonnc
.
standard_name
=
"
grid longitude
"
lonnc
.
title
=
"
Longitude
"
lonnc
.
axis
=
"
X
"
lonnc
[:,:]
=
lon
[
np
.
min
(
j
):
np
.
max
(
j
)
+
1
,
np
.
min
(
i
):
np
.
max
(
i
)
+
1
]
latnc
=
outnf
.
createVariable
(
"
lat
"
,
vtyp
,
(
'
lat
'
,
'
lon
'
),
fill_value
=
NCFillValue
)
latnc
.
units
=
"
Latitude of grid box centre degrees north
"
latnc
.
standard_name
=
"
grid latitude
"
latnc
.
title
=
"
Latitude
"
latnc
.
axis
=
"
Y
"
latnc
[:,:]
=
lat
[
np
.
min
(
j
):
np
.
max
(
j
)
+
1
,
np
.
min
(
i
):
np
.
max
(
i
)
+
1
]
#
xnc
=
outnf
.
createVariable
(
varname
,
vtyp
,
(
'
lat
'
,
'
lon
'
),
fill_value
=
NCFillValue
)
xnc
[:,:]
=
x
[
np
.
min
(
j
):
np
.
max
(
j
)
+
1
,
np
.
min
(
i
):
np
.
max
(
i
)
+
1
]
outnf
.
close
()
#
return
#
#
#
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