-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathclimatology_map_antarctic_melt.py
More file actions
707 lines (567 loc) · 25.1 KB
/
Copy pathclimatology_map_antarctic_melt.py
File metadata and controls
707 lines (567 loc) · 25.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
# This software is open source software available under the BSD-3 license.
#
# Copyright (c) 2022 Triad National Security, LLC. All rights reserved.
# Copyright (c) 2022 Lawrence Livermore National Security, LLC. All rights
# reserved.
# Copyright (c) 2022 UT-Battelle, LLC. All rights reserved.
#
# Additional copyright and license information can be found in the LICENSE file
# distributed with this code, or at
# https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/main/LICENSE
import os
import csv
import numpy as np
import xarray as xr
import dask
from multiprocessing.pool import ThreadPool
from pyremap import ProjectionGridDescriptor
from mpas_analysis.shared import AnalysisTask
from mpas_analysis.shared.io.utility import build_obs_path, decode_strings, \
build_config_full_path
from mpas_analysis.shared.io import write_netcdf_with_fill
from mpas_analysis.shared.climatology import RemapMpasClimatologySubtask, \
RemapObservedClimatologySubtask
from mpas_analysis.shared.projection import get_pyproj_projection
from mpas_analysis.shared.climatology.climatology import \
get_masked_mpas_climatology_file_name
from mpas_analysis.shared.plot import PlotClimatologyMapSubtask
from mpas_analysis.shared.constants import constants
class ClimatologyMapAntarcticMelt(AnalysisTask):
"""
An analysis task for comparison of Antarctic melt rates against
observations
"""
# Authors
# -------
# Xylar Asay-Davis
def __init__(self, config, mpasClimatologyTask, regionMasksTask,
controlConfig):
"""
Construct the analysis task.
Parameters
----------
config : tranche.Tranche
Configuration options
mpasClimatologyTask : ``MpasClimatologyTask``
The task that produced the climatology to be remapped and plotted
regionMasksTask : ``ComputeRegionMasks``
A task for computing region masks
controlConfig : tranche.Tranche
Configuration options for a control run
"""
# Authors
# -------
# Xylar Asay-Davis
fieldName = 'meltRate'
# call the constructor from the base class (AnalysisTask)
super(ClimatologyMapAntarcticMelt, self).__init__(
config=config, taskName='climatologyMapAntarcticMelt',
componentName='ocean',
tags=['climatology', 'horizontalMap', fieldName,
'landIceCavities', 'antarctic'])
sectionName = self.taskName
iselValues = None
# read in what seasons we want to plot
seasons = config.getexpression(sectionName, 'seasons')
if len(seasons) == 0:
raise ValueError(f'config section {sectionName} does not contain '
f'valid list of seasons')
comparisonGridNames = config.getexpression(sectionName,
'comparisonGrids')
makeTables = config.getboolean(sectionName, 'makeTables')
if makeTables:
for season in seasons:
tableSubtask = AntarcticMeltTableSubtask(
parentTask=self, mpasClimatologyTask=mpasClimatologyTask,
controlConfig=controlConfig,
regionMasksTask=regionMasksTask, season=season)
self.add_subtask(tableSubtask)
if len(comparisonGridNames) == 0:
raise ValueError(f'config section {sectionName} does not contain '
f'valid list of comparison grids')
# the variable 'timeMonthly_avg_landIceFreshwaterFlux' will be added to
# mpasClimatologyTask along with the seasons.
remapClimatologySubtask = RemapMpasAntarcticMeltClimatology(
mpasClimatologyTask=mpasClimatologyTask,
parentTask=self,
climatologyName=fieldName,
variableList=None,
comparisonGridNames=comparisonGridNames,
seasons=seasons,
iselValues=iselValues)
if controlConfig is None:
refTitleLabel = \
'Observations (Paolo et al. 2023)'
observationsDirectory = build_obs_path(
config, 'ocean', 'meltSubdirectory')
comparison_res = config.getfloat(
'climatology', 'comparisonAntarcticStereoResolution')
# the maximum available resolution that is not coarser than the
# comparison
avail_res = np.array([10., 4., 1.])
valid = avail_res >= comparison_res
if np.count_nonzero(valid) == 0:
res = np.amin(avail_res)
else:
res = np.amax(avail_res[valid])
obsFileName = \
f'{observationsDirectory}/Paolo/Paolo_2023_' \
f'iceshelf_melt_rates_1992-2017_v1.0_6000x6000km_{res:g}km_' \
f'Antarctic_stereo.20240220.nc'
remapObservationsSubtask = RemapObservedAntarcticMeltClimatology(
parentTask=self, seasons=seasons, fileName=obsFileName,
outFilePrefix='meltRate',
comparisonGridNames=comparisonGridNames)
self.add_subtask(remapObservationsSubtask)
diffTitleLabel = 'Model - Observations'
else:
remapObservationsSubtask = None
controlRunName = controlConfig.get('runs', 'mainRunName')
refTitleLabel = f'Control: {controlRunName}'
diffTitleLabel = 'Main - Control'
totalFluxVar = 'timeMonthly_avg_landIceFreshwaterFluxTotal'
landIceFluxVar = 'timeMonthly_avg_landIceFreshwaterFlux'
frazilFluxVar = 'timeMonthly_avg_frazilIceFreshwaterFlux'
mpasFieldName = totalFluxVar
if controlConfig is None:
refFieldName = 'meltRate'
else:
refFieldName = mpasFieldName
for comparisonGridName in comparisonGridNames:
for season in seasons:
# make a new subtask for this season and comparison grid
subtaskName = f'plot_total_melt_{season}_{comparisonGridName}'
subtask = PlotAntarcticMeltSubtask(
self, season, comparisonGridName, remapClimatologySubtask,
remapObservationsSubtask, controlConfig=controlConfig,
subtaskName=subtaskName)
subtask.set_plot_info(
outFileLabel='antMeltTotal',
fieldNameInTitle='Total Melt Flux',
mpasFieldName=mpasFieldName,
refFieldName=refFieldName,
refTitleLabel=refTitleLabel,
diffTitleLabel=diffTitleLabel,
unitsLabel=r'm a$^{-1}$ freshwater equiv.',
imageCaption='Antarctic Total Melt Flux',
galleryGroup='Melt Rate',
groupSubtitle=None,
groupLink='antarctic_melt',
galleryName='Total Melt Flux')
self.add_subtask(subtask)
mpasFieldName = landIceFluxVar
if controlConfig is None:
refFieldName = 'meltRate'
else:
refFieldName = mpasFieldName
for comparisonGridName in comparisonGridNames:
for season in seasons:
# make a new subtask for this season and comparison grid
subtaskName = \
f'plot_interface_melt_{season}_{comparisonGridName}'
subtask = PlotAntarcticMeltSubtask(
self, season, comparisonGridName, remapClimatologySubtask,
remapObservationsSubtask, controlConfig=controlConfig,
subtaskName=subtaskName)
# In PlotAntarcticMeltSubtask, we will remove the obs from
# these plots if totalFluxVar is present so we only compare one
# field with obs
subtask.set_plot_info(
outFileLabel='antMeltInterface',
fieldNameInTitle='Melt Rate at Interface',
mpasFieldName=mpasFieldName,
refFieldName=refFieldName,
refTitleLabel=refTitleLabel,
diffTitleLabel=diffTitleLabel,
unitsLabel=r'm a$^{-1}$ freshwater equiv.',
imageCaption='Antarctic Melt Rate at Interface',
galleryGroup='Melt Rate',
groupSubtitle=None,
groupLink='antarctic_melt_int',
galleryName='Melt Rate at the Ice-ocean Interface')
self.add_subtask(subtask)
mpasFieldName = frazilFluxVar
if controlConfig is None:
refTitleLabel = None
refFieldName = None
diffTitleLabel = None
else:
controlRunName = controlConfig.get('runs', 'mainRunName')
refTitleLabel = f'Control: {controlRunName}'
refFieldName = mpasFieldName
diffTitleLabel = 'Main - Control'
for comparisonGridName in comparisonGridNames:
for season in seasons:
# make a new subtask for this season and comparison grid
subtaskName = \
f'plot_interface_frazil_{season}_{comparisonGridName}'
subtask = PlotAntarcticMeltSubtask(
self, season, comparisonGridName, remapClimatologySubtask,
controlConfig=controlConfig, subtaskName=subtaskName)
subtask.set_plot_info(
outFileLabel='antFrazil',
fieldNameInTitle='Frazil Accretion Rate, neg. upward',
mpasFieldName=mpasFieldName,
refFieldName=refFieldName,
refTitleLabel=refTitleLabel,
diffTitleLabel=diffTitleLabel,
unitsLabel=r'm a$^{-1}$ freshwater equiv.',
imageCaption='Antarctic Accretion Rate',
galleryGroup='Melt Rate',
groupSubtitle=None,
groupLink='antarctic_frazil_flux',
galleryName='Frazil Accretion Rate')
self.add_subtask(subtask)
def setup_and_check(self):
"""
Perform steps to set up the analysis and check for errors in the setup.
"""
# Authors
# -------
# Xylar Asay-Davis
# first, call setup_and_check from the base class
# (AnalysisTask), which will perform some common setup
super(ClimatologyMapAntarcticMelt, self).setup_and_check()
landIceFluxMode = self.namelist.get('config_land_ice_flux_mode')
if landIceFluxMode not in ['data', 'active']:
raise ValueError('*** climatologyMapMeltAntarctic requires '
'config_land_ice_flux_mode \n'
' to be data or active. '
' Otherwise, no melt rates are available \n'
' for plotting.')
class RemapMpasAntarcticMeltClimatology(RemapMpasClimatologySubtask):
"""
A subtask for remapping climatologies of Antarctic melt rates and adding
Attributes
----------
landIceMask : xarray.DataArray
A mask indicating where there is land ice on the ocean grid (thus,
where melt rates are valid)
renameDict : dict
A dictionary use to rename variables in the climatology
"""
# Authors
# -------
# Xylar Asay-Davis
def setup_and_check(self):
"""
Figure out which variable(s) to remap
"""
# Authors
# -------
# Xylar Asay-Davis
totalFluxVar = 'timeMonthly_avg_landIceFreshwaterFluxTotal'
landIceFluxVar = 'timeMonthly_avg_landIceFreshwaterFlux'
frazilFluxVar = 'timeMonthly_avg_frazilIceFreshwaterFlux'
if totalFluxVar in self.mpasClimatologyTask.allVariables:
# include the total and constituent fluxes
self.variableList = [totalFluxVar, landIceFluxVar, frazilFluxVar]
else:
# we only have the old name without the frazil accretion rate
self.variableList = [landIceFluxVar]
super().setup_and_check()
def run_task(self):
"""
Compute climatologies of melt rates from E3SM/MPAS output
This function has been overridden to load ``landIceMask`` from a
restart file for later use in masking the melt rate. It then simply
calls the run function from
"""
# Authors
# -------
# Xylar Asay-Davis
# first, load the land-ice mask from the mesh file
dsLandIceMask = xr.open_dataset(self.meshFilename)
dsLandIceMask = dsLandIceMask[['landIceMask']]
dsLandIceMask = dsLandIceMask.isel(Time=0)
self.landIceMask = dsLandIceMask.landIceMask > 0.
# then, call run from the base class (RemapMpasClimatologySubtask),
# which will perform the main function of the task
super(RemapMpasAntarcticMeltClimatology, self).run_task()
def customize_masked_climatology(self, climatology, season):
"""
Mask the melt rates using ``landIceMask`` and rescale it to m/yr
Parameters
----------
climatology : ``xarray.Dataset`` object
the climatology data set
season : str
The name of the season to be masked
Returns
-------
climatology : ``xarray.Dataset`` object
the modified climatology data set
"""
# Authors
# -------
# Xylar Asay-Davis
for fieldName in self.variableList:
# scale the field to m/yr from kg/m^2/s and mask out non-land-ice
# areas
climatology[fieldName] = \
constants.sec_per_year / constants.rho_fw * \
climatology[fieldName].where(self.landIceMask)
climatology[fieldName].attrs['units'] = 'm yr^-1'
return climatology
class RemapObservedAntarcticMeltClimatology(RemapObservedClimatologySubtask):
"""
A subtask for reading and remapping Antarctic melt-rate observations
"""
# Authors
# -------
# Xylar Asay-Davis
def get_observation_descriptor(self, fileName):
"""
get a MeshDescriptor for the observation grid
Parameters
----------
fileName : str
observation file name describing the source grid
Returns
-------
obsDescriptor : ``MeshDescriptor``
The descriptor for the observation grid
"""
# Authors
# -------
# Xylar Asay-Davis
# create a descriptor of the observation grid using the x/y polar
# stereographic coordinates
projection = get_pyproj_projection(comparison_grid_name='antarctic')
obsDescriptor = ProjectionGridDescriptor.read(
projection, filename=fileName, x_var_name='x', y_var_name='y')
# update the mesh name to match the format used elsewhere in
# MPAS-Analysis
x = obsDescriptor.x
y = obsDescriptor.y
width = 1e-3 * (x[-1] - x[0])
height = 1e-3 * (y[-1] - y[0])
res = 1e-3 * (x[1] - x[0])
obsDescriptor.mesh_name = f'{width}x{height}km_{res}km_Antarctic_stereo'
return obsDescriptor
def build_observational_dataset(self, fileName):
"""
read in the data sets for observations, and possibly rename some
variables and dimensions
Parameters
----------
fileName : str
observation file name
Returns
-------
dsObs : ``xarray.Dataset``
The observational dataset
"""
# Authors
# -------
# Xylar Asay-Davis
# Load MLD observational data
dsObs = xr.open_dataset(fileName)
return dsObs
class AntarcticMeltTableSubtask(AnalysisTask):
def __init__(self, parentTask, mpasClimatologyTask, controlConfig,
regionMasksTask, season, subtaskName=None):
"""
Construct the analysis task.
Parameters
----------
parentTask : ``ClimatologyMapAntarcticMelt``
The parent task, used to get the ``taskName``, ``config`` and
``componentName``
mpasClimatologyTask : ``MpasClimatologyTask``
The task that produced the climatology to be remapped and plotted
controlConfig : tranche.Tranche
Configuration options for a control run (if any)
regionMasksTask : ``ComputeRegionMasks``
A task for computing region masks
season : str
One of the seasons in ``constants.monthDictionary``
subtaskName : str, optional
The name of the subtask
"""
# Authors
# -------
# Xylar Asay-Davis
tags = ['climatology', 'table']
if subtaskName is None:
subtaskName = f'table{season}'
# call the constructor from the base class (AnalysisTask)
super(AntarcticMeltTableSubtask, self).__init__(
config=parentTask.config,
taskName=parentTask.taskName,
subtaskName=subtaskName,
componentName=parentTask.componentName,
tags=tags)
self.season = season
self.mpasClimatologyTask = mpasClimatologyTask
self.controlConfig = controlConfig
self.masksSubtask = regionMasksTask.add_mask_subtask(
regionGroup='Ice Shelves')
self.iceShelfMasksFile = self.masksSubtask.geojsonFileName
self.run_after(self.masksSubtask)
self.run_after(mpasClimatologyTask)
def run_task(self):
"""
Computes and plots table of Antarctic sub-ice-shelf melt rates.
"""
# Authors
# -------
# Xylar Asay-Davis
self.logger.info("Computing Antarctic melt rate table...")
config = self.config
sectionName = self.taskName
iceShelvesInTable = config.getexpression(sectionName,
'iceShelvesInTable')
if len(iceShelvesInTable) == 0:
return
iceShelvesInTable = self.masksSubtask.expand_region_names(
iceShelvesInTable)
meltRateFileName = get_masked_mpas_climatology_file_name(
config, self.season, self.componentName,
climatologyName='antarcticMeltTable')
if not os.path.exists(meltRateFileName):
with dask.config.set(schedular='threads',
pool=ThreadPool(1)):
# Load data:
inFileName = \
self.mpasClimatologyTask.get_file_name(self.season)
mpasFieldName = 'timeMonthly_avg_landIceFreshwaterFlux'
dsIn = xr.open_dataset(inFileName)
freshwaterFlux = dsIn[mpasFieldName]
if 'Time' in freshwaterFlux.dims:
freshwaterFlux = freshwaterFlux.isel(Time=0)
regionMaskFileName = self.masksSubtask.maskFileName
dsRegionMask = xr.open_dataset(regionMaskFileName)
# figure out the indices of the regions to plot
regionNames = decode_strings(dsRegionMask.regionNames)
regionIndices = []
for iceShelf in iceShelvesInTable:
for index, regionName in enumerate(regionNames):
if iceShelf == regionName:
regionIndices.append(index)
break
# select only those regions we want to plot
dsRegionMask = dsRegionMask.isel(nRegions=regionIndices)
cellMasks = \
dsRegionMask.regionCellMasks.chunk({'nRegions': 10})
meshFilename = self.get_mesh_filename()
dsMesh = xr.open_dataset(meshFilename)
landIceFraction = dsMesh.landIceFraction.isel(Time=0)
areaCell = dsMesh.areaCell
# convert from kg/s to kg/yr
totalMeltFlux = constants.sec_per_year * \
(cellMasks * areaCell * freshwaterFlux).sum(dim='nCells')
totalMeltFlux.compute()
totalArea = \
(landIceFraction * cellMasks * areaCell).sum(dim='nCells')
# from kg/m^2/yr to m/yr
meltRates = ((1. / constants.rho_fw) *
(totalMeltFlux / totalArea))
meltRates.compute()
# convert from kg/yr to GT/yr
totalMeltFlux /= constants.kg_per_GT
ds = xr.Dataset()
ds['totalMeltFlux'] = totalMeltFlux
ds.totalMeltFlux.attrs['units'] = 'GT a$^{-1}$'
ds.totalMeltFlux.attrs['description'] = \
'Total melt flux summed over each ice shelf or region'
ds['meltRates'] = meltRates
ds.meltRates.attrs['units'] = 'm a$^{-1}$'
ds.meltRates.attrs['description'] = \
'Melt rate averaged over each ice shelf or region'
ds['area'] = 1e-6*totalArea
ds.meltRates.attrs['units'] = 'km$^2$'
ds.meltRates.attrs['description'] = \
'Region or ice shelf area'
ds['regionNames'] = dsRegionMask.regionNames
write_netcdf_with_fill(ds, meltRateFileName)
else:
ds = xr.open_dataset(meltRateFileName)
mainRunName = config.get('runs', 'mainRunName')
fieldNames = ['Region', 'Area', mainRunName]
controlConfig = self.controlConfig
if controlConfig is not None:
controlFileName = get_masked_mpas_climatology_file_name(
controlConfig, self.season, self.componentName,
climatologyName='antarcticMeltTable')
dsControl = xr.open_dataset(controlFileName)
controlRunName = controlConfig.get('runs', 'mainRunName')
fieldNames.append(controlRunName)
else:
dsControl = None
controlRunName = None
regionNames = decode_strings(ds.regionNames)
tableBase = build_config_full_path(config, 'output',
'tablesSubdirectory')
outDirectory = f'{tableBase}/antarcticMelt/'
try:
os.makedirs(outDirectory)
except OSError:
pass
tableFileName = \
f'{outDirectory}/antarcticMeltRateTable_{self.season}.csv'
with open(tableFileName, 'w', newline='') as csvfile:
writer = csv.DictWriter(csvfile, fieldnames=fieldNames)
writer.writeheader()
for index, regionName in enumerate(regionNames):
row = {'Region': regionName,
'Area': f'{ds.area[index].values}',
mainRunName: f'{ds.meltRates[index].values}'}
if dsControl is not None:
row[controlRunName] = \
f'{dsControl.meltRates[index].values}'
writer.writerow(row)
tableFileName = \
f'{outDirectory}/antarcticMeltFluxTable_{self.season}.csv'
with open(tableFileName, 'w', newline='') as csvfile:
writer = csv.DictWriter(csvfile, fieldnames=fieldNames)
writer.writeheader()
for index, regionName in enumerate(regionNames):
row = {'Region': regionName,
'Area': f'{ds.area[index].values}',
mainRunName: f'{ds.totalMeltFlux[index].values}'}
if dsControl is not None:
row[controlRunName] = \
f'{dsControl.totalMeltFlux[index].values}'
writer.writerow(row)
class PlotAntarcticMeltSubtask(PlotClimatologyMapSubtask):
"""
A subtask for plotting antarctic melt fields if available
Attributes
----------
doPlot : bool
Whether the required variable from the climatology is available so that
a plot should be generated
"""
# Authors
# -------
# Xylar Asay-Davis
def setup_and_check(self):
"""
Perform steps to set up the analysis and check for errors in the setup.
"""
allVariables = \
self.remapMpasClimatologySubtask.mpasClimatologyTask.allVariables
totalFluxVar = 'timeMonthly_avg_landIceFreshwaterFluxTotal'
landIceFluxVar = 'timeMonthly_avg_landIceFreshwaterFlux'
plotAll = (totalFluxVar in allVariables)
if self.mpasFieldName == landIceFluxVar and plotAll and \
self.controlConfig is None:
# need to remove obs because we only wnat to plot them vs the
# total flux
self.remapObsClimatologySubtask = None
self.refTitleLabel = None
self.refFieldName = None
self.diffTitleLabel = None
self.doPlot = (self.mpasFieldName == landIceFluxVar or plotAll)
if self.doPlot:
super().setup_and_check()
else:
# still need to call the base class's method
AnalysisTask.setup_and_check(self=self)
def run_task(self):
"""
Plot the variable if available
"""
if self.doPlot:
super().run_task()