Skip to content

Commit

Permalink
Merge pull request #1035 from xylar/remove-region-name-from-sea-ice-t…
Browse files Browse the repository at this point in the history
…itles

Remove the comparison grid name from sea ice gallery groups
  • Loading branch information
xylar authored Nov 6, 2024
2 parents 2b081b8 + 1f04a00 commit 69c249a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
3 changes: 2 additions & 1 deletion mpas_analysis/sea_ice/climatology_map_berg_conc.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ def __init__(self, config, mpasClimatologyTask, hemisphere,
groupSubtitle=None,
groupLink='{}_conc'.format(hemisphere.lower()),
galleryName=galleryName,
extend='neither')
extend='neither',
prependComparisonGrid=False)

self.add_subtask(subtask)

Expand Down
3 changes: 2 additions & 1 deletion mpas_analysis/sea_ice/climatology_map_melting.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ def __init__(self, config, mpas_climatology_task, hemisphere,
groupSubtitle=None,
groupLink=f'{hemisphere.lower()}_melting',
galleryName=gallery_name,
extend='max')
extend='max',
prependComparisonGrid=False)

self.add_subtask(subtask)

Expand Down
3 changes: 2 additions & 1 deletion mpas_analysis/sea_ice/climatology_map_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ def __init__(self, config, mpas_climatology_task, hemisphere,
groupSubtitle=None,
groupLink=f'{hemisphere.lower()}_production',
galleryName=gallery_name,
extend='max')
extend='max',
prependComparisonGrid=False)

self.add_subtask(subtask)

Expand Down
6 changes: 4 additions & 2 deletions mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ def _add_obs_tasks(self, seasons, comparisonGridNames, hemisphere,
galleryName='Observations: SSM/I {}'.format(
prefix),
maskMinThreshold=minConcentration,
extend='neither')
extend='neither',
prependComparisonGrid=False)

self.add_subtask(subtask)

Expand Down Expand Up @@ -230,7 +231,8 @@ def _add_ref_tasks(self, seasons, comparisonGridNames, hemisphere,
groupLink='{}_conc'.format(hemisphere.lower()),
galleryName=galleryName,
maskMinThreshold=minConcentration,
extend='neither')
extend='neither',
prependComparisonGrid=False)

self.add_subtask(subtask)

Expand Down
3 changes: 2 additions & 1 deletion mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ def __init__(self, config, mpasClimatologyTask, hemisphere,
groupLink=f'{hemisphere.lower()}_thick',
galleryName=galleryName,
maskMinThreshold=0,
extend='neither')
extend='neither',
prependComparisonGrid=False)

self.add_subtask(subtask)

Expand Down
21 changes: 17 additions & 4 deletions mpas_analysis/shared/plot/plot_climatology_map_subtask.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,15 @@ def __init__(self, parentTask, season, comparisonGridName,
self.maskMinThreshold = None
self.maskMaxThreshold = None
self.extend = 'both'
self.prependComparisonGrid = None

def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName,
refFieldName, refTitleLabel, unitsLabel,
imageCaption, galleryGroup, groupSubtitle, groupLink,
galleryName, diffTitleLabel='Model - Observations',
configSectionName=None, maskMinThreshold=None,
maskMaxThreshold=None, extend=None):
maskMaxThreshold=None, extend=None,
prependComparisonGrid=True):
"""
Store attributes related to plots, plot file names and HTML output.
Expand Down Expand Up @@ -282,7 +284,11 @@ def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName,
extend : {'neither', 'both', 'min', 'max'}, optional
Determines the ``contourf``-coloring of values that are outside the
range of the levels provided if using an indexed colormap.
range of the levels provided if using an indexed colormap
prependComparisonGrid : bool, optional
Whether to prepend the name of the comparison grid to the gallery
group
"""

self.outFileLabel = outFileLabel
Expand Down Expand Up @@ -325,6 +331,8 @@ def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName,
if extend is not None:
self.extend = extend

self.prependComparisonGrid = prependComparisonGrid

def setup_and_check(self):
"""
Perform steps to set up the analysis and check for errors in the setup.
Expand Down Expand Up @@ -647,14 +655,19 @@ def _plot_projection(self, remappedModelClimatology,
vertical=vertical,
extend=self.extend)

upperGridName = capwords(comparisonGridName.replace('_', ' '))
if self.prependComparisonGrid:
upperGridName = capwords(comparisonGridName.replace('_', ' '))
galleryGroup = f'{upperGridName} {self.galleryGroup}'
else:
galleryGroup = self.galleryGroup

caption = f'{season} {self.imageCaption}'
write_image_xml(
config,
filePrefix,
componentName=componentName,
componentSubdirectory=componentSubdirectory,
galleryGroup=f'{upperGridName} {self.galleryGroup}',
galleryGroup=galleryGroup,
groupSubtitle=self.groupSubtitle,
groupLink=f'{comparisonGridName}_{self.groupLink}',
gallery=self.galleryName,
Expand Down

0 comments on commit 69c249a

Please sign in to comment.