Commit 49953e91 authored by Kennedy, Joseph H's avatar Kennedy, Joseph H
Browse files

Add figure captions to the energy extension

For #20
parent eb17b655
# coding=utf-8
import os
import Ngl
import numpy.ma as ma
......@@ -7,7 +9,14 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_albedo plot."""
describe = """
Average of the annual average surface albedo over Greenland
for every summer (June-July-August; JJA) from 1980--1999
for CESM (left) and RACMO 2.3 (middle), and the difference between them (right; CESM -
RACMO 2.3). The black solid lines denote the 0, 1000, 2000, and 3000 meter
Greenland ice sheet elevation contours as seen by the models (CESM's contours
shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,14 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_laft plot."""
describe = """
Average of the annual average latent heat flux (W m^-2) over Greenland
for every summer (June-July-August; JJA) from 1980--1999
for CESM (left) and RACMO 2.3 (middle), and the difference between them (right; CESM -
RACMO 2.3). The black solid lines denote the 0, 1000, 2000, and 3000 meter
Greenland ice sheet elevation contours as seen by the models (CESM's contours
shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,14 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_lwsd plot."""
describe = """
Average of the annual average downward longwave radiation (W m^-2) over Greenland
for every summer (June-July-August; JJA) from 1980--1999
for CESM (left) and RACMO 2.3 (middle), and the difference between them (right; CESM -
RACMO 2.3). The black solid lines denote the 0, 1000, 2000, and 3000 meter
Greenland ice sheet elevation contours as seen by the models (CESM's contours
shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,14 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_lwsn plot."""
describe = """
Average of the annual average net longwave radiation (W m^-2) over Greenland
for every summer (June-July-August; JJA) from 1980--1999
for CESM (left) and RACMO 2.3 (middle), and the difference between them (right; CESM -
RACMO 2.3). The black solid lines denote the 0, 1000, 2000, and 3000 meter
Greenland ice sheet elevation contours as seen by the models (CESM's contours
shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,14 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_rnet plot."""
describe = """
Average of the summer (June-July-August; JJA) average net radiation (W m^-2)
over Greenland for every summer (June-July-August; JJA) from 1980--1999
for CESM (left) and RACMO 2.3 (middle), and the difference between them (right; CESM -
RACMO 2.3). The black solid lines denote the 0, 1000, 2000, and 3000 meter
Greenland ice sheet elevation contours as seen by the models (CESM's contours
shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,14 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_senf plot."""
describe = """
Average of the annual average sensible heat flux (W m^-2) over Greenland for
every summer (June-July-August; JJA) from 1980--1999 for CESM (left) and RACMO
2.3 (middle), and the difference between them (right; CESM - RACMO 2.3). The
black solid lines denote the 0, 1000, 2000, and 3000 meter Greenland ice sheet
elevation contours as seen by the models (CESM's contours shown in the
difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
......@@ -9,7 +11,13 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_smb plot."""
describe = """
Average of the annual average surface mass balance (kg m^-2 a^-1) over Greenland for every
summer (June-July-August; JJA) from 1980--1999 for CESM (left) and RACMO 2.3 (middle),
and the difference between them (right; CESM - RACMO 2.3). The black solid lines denote
the 0, 1000, 2000, and 3000 meter Greenland ice sheet elevation contours as seen by
the models (CESM's contours shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,13 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_swsd plot."""
describe = """
Average of the annual average downward shortwave radiation (W m^-2) over Greenland
for every summer (June-July-August; JJA) from 1980--1999 for CESM (left) and
RACMO 2.3 (middle), and the difference between them (right; CESM - RACMO 2.3).
The black solid lines denote the 0, 1000, 2000, and 3000 meter Greenland ice sheet
elevation contours as seen by the models (CESM's contours shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,13 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_swsn plot."""
describe = """
Average of the average net shortwave radiation (W m^-2)
over Greenland for every summer (June-July-August; JJA) from 1980--1999 for CESM (left)
and RACMO 2.3 (middle), and the difference between them (right; CESM - RACMO 2.3).
The black solid lines denote the 0, 1000, 2000, and 3000 meter Greenland ice sheet
elevation contours as seen by the models (CESM's contours shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,13 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_t2m_ann plot."""
describe = """
Average of the annual average 2-meter air temperature (°C) over Greenland from 1980--1999
for CESM (left) and RACMO 2.3 (middle), and the difference between them (right; CESM -
RACMO 2.3). The black solid lines denote the 0, 1000, 2000, and 3000 meter
Greenland ice sheet elevation contours as seen by the models (CESM's contours
shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,13 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_t2m_djf plot."""
describe = """
Average of the 2-meter air temperature (°C) over Greenland for every winter
(December-January-Feburary; DJF) from 1980--1999 for CESM (left) and RACMO 2.3 (middle), and the
difference between them (right; CESM - RACMO 2.3). The black solid lines denote
the 0, 1000, 2000, and 3000 meter Greenland ice sheet elevation contours as seen
by the models (CESM's contours shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import Ngl
import numpy as np
......@@ -8,7 +10,13 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """CESM_RACMO23_t2m_jja plot."""
describe = """
Average of the 2-meter air temperature (°C) over Greenland for every summer
(June-July-August; JJA) from 1980--1999 for CESM (left) and RACMO 2.3 (middle), and the
difference between them (right; CESM - RACMO 2.3). The black solid lines denote
the 0, 1000, 2000, and 3000 meter Greenland ice sheet elevation contours as seen
by the models (CESM's contours shown in the difference plot).
"""
def make_plot(config, out_path='.'):
......
# coding=utf-8
import os
import numpy as np
import matplotlib.pyplot as plt
......@@ -6,7 +8,20 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """TimeSeries_QICE_GT and BoxPlot_QICE_GT plot."""
describe_ts = """
Time series of the ({model_color}) CESM surface mass balance (Gt a^-1) for the
entire {model_start:.0f}--{model_end:.0f} simulation compared to the ({obs_color})
{obs_start:.0f}--{obs_end:.0f} RACMO 2.3 surface mass balance.
"""
describe_bx = """
Box plot of the CESM surface mass balance (Gt a^-1) for the entire
{model_start:.0f}--{model_end:.0f} simulation compared to the {obs_start:.0f}--{obs_end:.0f}
RACMO 2.3 surface mass balance. Here, the colored lines represent the median
values, the boxes are drawn from the first quartile to the third quartile
(covering the interqartile range, or IQR), and the whiskers cover 1.5x the IQR.
Diamonds outside the whiskers represent suspected outliers.
"""
def make_plot(config, out_path='.'):
......@@ -69,7 +84,6 @@ def make_plot(config, out_path='.'):
ax.set_ylabel('Surface mass balance (Gt a$^{-1}$)', fontsize=14)
ax.set_xlabel('time', fontsize=14)
plt.tight_layout()
ts_img_path = os.path.join(out_path, 'TimeSeries_QICE_GT.png')
plt.savefig(ts_img_path)
......@@ -78,7 +92,13 @@ def make_plot(config, out_path='.'):
img_link = os.path.join(os.path.basename(out_path),
os.path.basename(ts_img_path))
img_elem = el.image('TimeSeries_QICE_GT',
' '.join(describe.split()),
' '.join(describe_ts.format(model_color='blue',
model_start=time[0],
model_end=time[-1],
obs_color='orange',
obs_start=time2[0],
obs_end=time2[-1],
).split()),
img_link)
if config:
img_elem['Height'] = config['image_height']
......@@ -112,7 +132,11 @@ def make_plot(config, out_path='.'):
img_link = os.path.join(os.path.basename(out_path),
os.path.basename(bx_img_path))
img_elem = el.image('BoxPlot_QICE_GT',
' '.join(describe.split()),
' '.join(describe_bx.format(model_start=time[0],
model_end=time[-1],
obs_start=time2[0],
obs_end=time2[-1],
).split()),
img_link)
img_elem['Height'] = config['image_height']
img_list.append(img_elem)
......
# coding=utf-8
import os
import numpy as np
import matplotlib.pyplot as plt
......@@ -6,7 +8,20 @@ from netCDF4 import Dataset
from livvkit.util import elements as el
describe = """TimeSeries_T2M and BoxPlot_T2M plot."""
describe_ts = """
Time series of the ({model_color}) CESM 2-meter air temperature (°C) for the
entire {model_start:.0f}--{model_end:.0f} simulation compared to the ({obs_color})
{obs_start:.0f}--{obs_end:.0f} RACMO 2.3 2-meter air temperature.
"""
describe_bx = """
Box plot of the CESM 2-meter air temperature (°C) for the entire
{model_start:.0f}--{model_end:.0f} simulation compared to the {obs_start:.0f}--{obs_end:.0f}
RACMO 2.3 2-meter air temperature. Here, the colored lines represent the median
values, the boxes are drawn from the first quartile to the third quartile
(covering the interqartile range, or IQR), and the whiskers cover 1.5x the IQR.
Diamonds outside the whiskers represent suspected outliers.
"""
def make_plot(config, out_path='.'):
......@@ -63,7 +78,6 @@ def make_plot(config, out_path='.'):
ax.set_ylabel('2-meter air temperature ($^{\circ}$C)', fontsize=14)
ax.set_xlabel('time', fontsize=14)
ts_img_path = os.path.join(out_path, 'TimeSeries_T2M.png')
plt.savefig(ts_img_path)
plt.close()
......@@ -71,7 +85,13 @@ def make_plot(config, out_path='.'):
img_link = os.path.join(os.path.basename(out_path),
os.path.basename(ts_img_path))
img_elem = el.image('TimeSeries_T2M',
' '.join(describe.split()),
' '.join(describe_ts.format(model_color='blue',
model_start=time[0],
model_end=time[-1],
obs_color='orange',
obs_start=time2[0],
obs_end=time2[-1],
).split()),
img_link)
if config:
img_elem['Height'] = config['image_height']
......@@ -98,7 +118,6 @@ def make_plot(config, out_path='.'):
ax.set_ylim(-24, -14)
ax.grid(False)
plt.tight_layout()
bx_img_path = os.path.join(out_path, 'BoxPlot_T2M.png')
plt.savefig(bx_img_path)
......@@ -107,7 +126,11 @@ def make_plot(config, out_path='.'):
img_link = os.path.join(os.path.basename(out_path),
os.path.basename(bx_img_path))
img_elem = el.image('BoxPlot_T2M',
' '.join(describe.split()),
' '.join(describe_bx.format(model_start=time[0],
model_end=time[-1],
obs_start=time2[0],
obs_end=time2[-1],
).split()),
img_link)
img_elem['Height'] = config['image_height']
img_list.append(img_elem)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment