Skip to content

Commit b992832

Browse files
committed
Remap 2D and 3D custom climatologies with same subtask
1 parent 6dc2b5d commit b992832

1 file changed

Lines changed: 10 additions & 35 deletions

File tree

mpas_analysis/ocean/climatology_map_custom.py

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None):
7878
# we assume variables have depth unless otherwise specified
7979
variables[varName]['has_depth'] = True
8080

81-
variables3D = {varName: variables[varName] for varName in
82-
variables if variables[varName]['has_depth']}
83-
84-
variableList2D = [variables[varName]['mpas'][0] for varName in
85-
variables if not variables[varName]['has_depth']]
86-
8781
# read in what seasons we want to plot
8882
seasons = config.getexpression(sectionName, 'seasons')
8983

@@ -104,29 +98,14 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None):
10498
raise ValueError(f'config section {sectionName} does not '
10599
f'contain valid list of depths')
106100

107-
if variables3D:
108-
remapMpasSubtask3D = RemapMpasDerivedVariableClimatology(
109-
mpasClimatologyTask=mpasClimatologyTask,
110-
parentTask=self,
111-
climatologyName='custom3D',
112-
variables=variables3D,
113-
seasons=seasons,
114-
depths=depths,
115-
comparisonGridNames=comparisonGridNames)
116-
else:
117-
remapMpasSubtask3D = None
118-
119-
if len(variableList2D) > 0:
120-
remapMpasSubtask2D = RemapMpasClimatologySubtask(
121-
mpasClimatologyTask=mpasClimatologyTask,
122-
parentTask=self,
123-
climatologyName='custom2D',
124-
variableList=variableList2D,
125-
seasons=seasons,
126-
comparisonGridNames=comparisonGridNames,
127-
subtaskName='remap2DVariables')
128-
else:
129-
remapMpasSubtask2D = None
101+
remapMpasSubtask = RemapMpasDerivedVariableClimatology(
102+
mpasClimatologyTask=mpasClimatologyTask,
103+
parentTask=self,
104+
climatologyName='custom3D',
105+
variables=variables,
106+
seasons=seasons,
107+
depths=depths,
108+
comparisonGridNames=comparisonGridNames)
130109

131110
galleryGroup = 'Custom Climatology Maps'
132111
groupLink = 'custclimmaps'
@@ -149,12 +128,8 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None):
149128

150129
if hasDepth:
151130
localDepths = depths
152-
remapMpasSubtask = remapMpasSubtask3D
153-
mpasVarName = varName
154131
else:
155132
localDepths = [None]
156-
remapMpasSubtask = remapMpasSubtask2D
157-
mpasVarName = metadata['mpas'][0]
158133

159134
for comparisonGridName in comparisonGridNames:
160135
for depth in localDepths:
@@ -178,8 +153,8 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None):
178153
subtask.set_plot_info(
179154
outFileLabel=f'cust_{varName}',
180155
fieldNameInTitle=title,
181-
mpasFieldName=mpasVarName,
182-
refFieldName=mpasVarName,
156+
mpasFieldName=varName,
157+
refFieldName=varName,
183158
refTitleLabel=refTitleLabel,
184159
diffTitleLabel=diffTitleLabel,
185160
unitsLabel=units,

0 commit comments

Comments
 (0)