Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lex
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
LIVVkit
lex
Commits
2edd2e89
Verified
Commit
2edd2e89
authored
3 years ago
by
Kelleher, Michael
Browse files
Options
Downloads
Patches
Plain Diff
Add initial version of SMB components plot
parent
b7def18e
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
smb/smb/plot_spatial.py
+44
-1
44 additions, 1 deletion
smb/smb/plot_spatial.py
smb/smb_icecores.py
+1
-1
1 addition, 1 deletion
smb/smb_icecores.py
smb/smb_icecores_e3sm.json
+9
-1
9 additions, 1 deletion
smb/smb_icecores_e3sm.json
with
54 additions
and
3 deletions
smb/smb/plot_spatial.py
+
44
−
1
View file @
2edd2e89
...
...
@@ -4,6 +4,7 @@
Module containing routines to create map plots of Surface Mass Balance data.
"""
import
os
from
typing
import
OrderedDict
import
numpy
as
np
import
numpy.ma
as
ma
import
matplotlib.pyplot
as
plt
...
...
@@ -13,6 +14,7 @@ from netCDF4 import Dataset
from
scipy.interpolate
import
griddata
from
matplotlib
import
colors
as
c
from
livvkit
import
elements
as
el
import
xarray
as
xr
DESCRIBE_CORE
=
"""
Filled contour of modeled annual surface mass balance of the Greenland ice
...
...
@@ -372,7 +374,9 @@ def plot_metadata(args, config):
if
lons_model
.
ndim
==
1
and
lons_model
.
shape
[
0
]
<
1000
:
lons_model
,
lats_model
=
np
.
meshgrid
(
lons_model
,
lats_model
)
elif
lons_model
.
shape
[
0
]
>=
1000
:
lons_model
,
lats_model
,
mbasins
=
mali_to_contour
(
lons_model
,
lats_model
,
mbasins
)
lons_model
,
lats_model
,
mbasins
=
mali_to_contour
(
lons_model
,
lats_model
,
mbasins
)
xi
,
yi
=
pmap
(
lons_model
.
squeeze
(),
lats_model
.
squeeze
())
_
=
pmap
.
pcolormesh
(
xi
,
yi
,
mbasins
,
cmap
=
forcolors
,
zorder
=
2
)
...
...
@@ -442,3 +446,42 @@ def plot_metadata(args, config):
img_list
.
append
(
img_elem
)
return
img_list
def
component_plot
(
args
,
config
):
"""
Plot each component of surface mass balance.
"""
img_list
=
[]
mons
=
np
.
arange
(
1
,
13
)
in_files
=
[
config
[
"
aavg
"
].
replace
(
"
ANN
"
,
f
"
{
mon
:
02
d
}
"
)
for
mon
in
mons
]
model_data
=
xr
.
open_mfdataset
(
in_files
).
load
()
_vars
=
config
[
"
vars
"
]
scale
=
(
3600
*
24
*
365
)
/
1000.
model_plot
=
OrderedDict
({
"
Pr_tot
"
:
model_data
[
_vars
[
"
rain
"
]]
+
model_data
[
_vars
[
"
snow
"
]],
"
Melt
"
:
model_data
[
_vars
[
"
melt
"
]],
"
Runoff
"
:
model_data
[
_vars
[
"
runoff
"
]],
"
Re-freeze
"
:
model_data
[
_vars
[
"
freeze
"
]],
"
Rain
"
:
model_data
[
_vars
[
"
rain
"
]],
})
for
_var
in
model_plot
:
plt
.
plot
(
mons
,
model_plot
[
_var
]
*
scale
,
label
=
_var
,
linestyle
=
"
-
"
)
plt
.
ylabel
(
"
m / yr
"
)
plt
.
legend
()
plt
.
tight_layout
()
img_file
=
os
.
path
.
join
(
args
.
out
,
"
plot_aavg_component.png
"
)
plt
.
savefig
(
img_file
)
plt
.
close
()
img_link
=
os
.
path
.
join
(
"
imgs
"
,
os
.
path
.
basename
(
args
.
out
),
os
.
path
.
basename
(
img_file
)
)
img_elem
=
el
.
Image
(
"
SMB Components (Model) AAVG
"
,
"
Componentwise breakdown of SMB
"
,
img_link
,
height
=
args
.
img_height
,
group
=
IMG_GROUP
,
)
img_list
.
append
(
img_elem
)
return
img_list
\ No newline at end of file
This diff is collapsed.
Click to expand it.
smb/smb_icecores.py
+
1
−
1
View file @
2edd2e89
...
...
@@ -101,7 +101,7 @@ def run(name, config):
preproc
.
main
(
args
,
config
)
img_list
=
[]
img_list
.
extend
(
plt_spatial
.
component_plot
(
args
,
config
))
img_list
.
extend
(
plt_spatial
.
plot_metadata
(
args
,
config
))
img_list
.
extend
(
plt_spatial
.
plot_core
(
args
,
config
))
img_list
.
extend
(
plt_spatial
.
plot_ib_spatial
(
args
,
config
))
...
...
This diff is collapsed.
Click to expand it.
smb/smb_icecores_e3sm.json
+
9
−
1
View file @
2edd2e89
...
...
@@ -17,6 +17,7 @@
]
},
"climo"
:
"data/e3sm/lnd/20201112.A_BGWCYCL1850.ne30pg2_r05_oECv3_gis1to10.cori-knl.intel.testIGinitCond_ANN_climo.nc"
,
"aavg"
:
"data/e3sm/lnd/20201112.A_BGWCYCL1850.ne30pg2_r05_oECv3_gis1to10.cori-knl.intel.testIGinitCond_ANN_climo_aavg..nc"
,
"latlon"
:
"data/e3sm/lnd/20201112.A_BGWCYCL1850.ne30pg2_r05_oECv3_gis1to10.cori-knl.intel.testIGinitCond_ANN_climo.nc"
,
"elevation"
:
"data/e3sm/lnd/20201112.A_BGWCYCL1850.ne30pg2_r05_oECv3_gis1to10.cori-knl.intel.testIGinitCond_ANN_climo.nc"
,
"latv"
:
"lat"
,
...
...
@@ -31,6 +32,13 @@
"zwally_file"
:
"model_zwally_basins_elm.csv"
,
"ib_file"
:
"IceBridge_modelXY_elm.csv"
,
"smb_cf_file"
:
"SMB_CoreFirnEstimates_elm.csv"
,
"smb_mo_file"
:
"SMB_Obs_Model_elm.csv"
"smb_mo_file"
:
"SMB_Obs_Model_elm.csv"
,
"vars"
:
{
"rain"
:
"RAIN"
,
"snow"
:
"SNOW"
,
"melt"
:
"QICE_MELT"
,
"runoff"
:
"QRUNOFF"
,
"freeze"
:
"QICE_FRZ"
}
}
}
\ No newline at end of file
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