def setup_subtask(self, mpasClimatologyTask): parentTask = AnalysisTask( config=mpasClimatologyTask.config, taskName='fake', componentName=mpasClimatologyTask.componentName, tags=['climatology']) climatologyName = 'ssh' variableList = ['timeMonthly_avg_ssh'] seasons = [mpasClimatologyTask.seasons[0]] remapSubtask = RemapMpasClimatologySubtask(mpasClimatologyTask, parentTask, climatologyName, variableList, seasons) remapSubtask.setup_and_check() return remapSubtask
def __init__(self, config, mpasClimatologyTask, hemisphere, controlConfig=None): # {{{ """ Construct the analysis task. Parameters ---------- config : ``MpasAnalysisConfigParser`` Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted hemisphere : {'NH', 'SH'} The hemisphere to plot controlConfig : ``MpasAnalysisConfigParser``, optional Configuration options for a control run (if any) """ # Authors # ------- # Darin Comeau, Xylar Asay-Davis taskName = 'climatologyMapIcebergConc{}'.format(hemisphere) fieldName = 'IcebergConc' tags = ['icebergs', 'climatology', 'horizontalMap', fieldName] if hemisphere == 'NH': tags = tags + ['arctic'] else: tags = tags + ['antarctic'] # call the constructor from the base class (AnalysisTask) super(ClimatologyMapIcebergConc, self).__init__(config=config, taskName=taskName, componentName='seaIce', tags=tags) mpasFieldName = 'timeMonthly_avg_bergAreaCell' iselValues = None sectionName = taskName if hemisphere == 'NH': hemisphereLong = 'Northern' else: hemisphereLong = 'Southern' # read in what seasons we want to plot seasons = config.getExpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) comparisonGridNames = config.getExpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) # the variable self.mpasFieldName will be added to mpasClimatologyTask # along with the seasons. remapClimatologySubtask = RemapMpasClimatologySubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName='{}{}'.format(fieldName, hemisphere), variableList=[mpasFieldName], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) if controlConfig is None: refTitleLabel = 'Observations (Altiberg)' galleryName = 'Observations: Altiberg' diffTitleLabel = 'Model - Observations' refFieldName = 'icebergConc' obsFileName = build_obs_path( config, 'iceberg', 'concentrationAltiberg{}'.format(hemisphere)) remapObservationsSubtask = RemapAltibergConcClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix='{}{}'.format(refFieldName, hemisphere), comparisonGridNames=comparisonGridNames) self.add_subtask(remapObservationsSubtask) else: controlRunName = controlConfig.get('runs', 'mainRunName') galleryName = None refTitleLabel = 'Control: {}'.format(controlRunName) refFieldName = mpasFieldName diffTitleLabel = 'Main - Control' remapObservationsSubtask = None for season in seasons: for comparisonGridName in comparisonGridNames: imageDescription = \ '{} Climatology Map of {}-Hemisphere Iceberg ' \ 'Concentration.'.format(season, hemisphereLong) imageCaption = imageDescription galleryGroup = \ '{}-Hemisphere Iceberg Concentration'.format( hemisphereLong) # make a new subtask for this season and comparison grid subtask = PlotClimatologyMapSubtask(self, hemisphere, season, comparisonGridName, remapClimatologySubtask, remapObservationsSubtask, controlConfig) subtask.set_plot_info( outFileLabel='bergconc{}'.format(hemisphere), fieldNameInTitle='Iceberg concentration', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'fraction', imageDescription=imageDescription, imageCaption=imageCaption, galleryGroup=galleryGroup, groupSubtitle=None, groupLink='{}_conc'.format(hemisphere.lower()), galleryName=galleryName, maskValue=None) self.add_subtask(subtask)
def __init__(self, config, mpasClimatologyTask, refConfig=None): # {{{ """ Construct the analysis task. Parameters ---------- config : ``MpasAnalysisConfigParser`` Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted refConfig : ``MpasAnalysisConfigParser``, optional Configuration options for a reference run (if any) """ # Authors # ------- # Xylar Asay-Davis fieldName = 'sss' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapSSS, self).__init__( config=config, taskName='climatologyMapSSS', componentName='ocean', tags=['climatology', 'horizontalMap', fieldName, 'publicObs']) mpasFieldName = 'timeMonthly_avg_activeTracers_salinity' iselValues = {'nVertLevels': 0} sectionName = self.taskName # read in what seasons we want to plot seasons = config.getExpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) comparisonGridNames = config.getExpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) # the variable self.mpasFieldName will be added to mpasClimatologyTask # along with the seasons. remapClimatologySubtask = RemapMpasClimatologySubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName=fieldName, variableList=[mpasFieldName], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) if refConfig is None: refTitleLabel = \ 'Observations (Aquarius, 2011-2014)' observationsDirectory = build_config_full_path( config, 'oceanObservations', '{}Subdirectory'.format(fieldName)) obsFileName = \ "{}/Aquarius_V3_SSS_Monthly.nc".format( observationsDirectory) refFieldName = 'sss' outFileLabel = 'sssAquarius' galleryName = 'Observations: Aquarius' remapObservationsSubtask = RemapObservedSSSClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix=refFieldName, comparisonGridNames=comparisonGridNames) self.add_subtask(remapObservationsSubtask) diffTitleLabel = 'Model - Observations' else: remapObservationsSubtask = None refRunName = refConfig.get('runs', 'mainRunName') galleryName = None refTitleLabel = 'Ref: {}'.format(refRunName) refFieldName = mpasFieldName outFileLabel = 'sss' diffTitleLabel = 'Main - Reference' for comparisonGridName in comparisonGridNames: for season in seasons: # make a new subtask for this season and comparison grid subtask = PlotClimatologyMapSubtask(self, season, comparisonGridName, remapClimatologySubtask, remapObservationsSubtask, refConfig) subtask.set_plot_info(outFileLabel=outFileLabel, fieldNameInTitle='SSS', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'PSU', imageCaption='Mean Sea Surface Salinity', galleryGroup='Sea Surface Salinity', groupSubtitle=None, groupLink='sss', galleryName=galleryName) self.add_subtask(subtask)
def __init__(self, config, mpasClimatologyTask, hemisphere, refConfig=None): # {{{ """ Construct the analysis task. Parameters ---------- config : ``MpasAnalysisConfigParser`` Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted hemisphere : {'NH', 'SH'} The hemisphere to plot refConfig : ``MpasAnalysisConfigParser``, optional Configuration options for a reference run (if any) """ # Authors # ------- # Xylar Asay-Davis taskName = 'climatologyMapSeaIceConc{}'.format(hemisphere) fieldName = 'seaIceConc' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapSeaIceConc, self).__init__(config=config, taskName=taskName, componentName='seaIce', tags=['climatology', 'horizontalMap', fieldName]) mpasFieldName = 'timeMonthly_avg_iceAreaCell' iselValues = None sectionName = taskName if hemisphere == 'NH': hemisphereLong = 'Northern' else: hemisphereLong = 'Southern' # read in what seasons we want to plot seasons = config.getExpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) comparisonGridNames = config.getExpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) # the variable self.mpasFieldName will be added to mpasClimatologyTask # along with the seasons. remapClimatologySubtask = RemapMpasClimatologySubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName='{}{}'.format(fieldName, hemisphere), variableList=[mpasFieldName], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) if refConfig is None: self._add_obs_tasks(seasons, comparisonGridNames, hemisphere, hemisphereLong, remapClimatologySubtask, mpasFieldName) else: self._add_ref_tasks(seasons, comparisonGridNames, hemisphere, hemisphereLong, remapClimatologySubtask, refConfig, mpasFieldName, fieldName, iselValues)
def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ """ Construct the analysis task. Parameters ---------- config : ``MpasAnalysisConfigParser`` Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted controlConfig : ``MpasAnalysisConfigParser``, optional Configuration options for a control run (if any) """ # Authors # ------- # Xylar Asay-Davis fieldName = 'mld' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapMLD, self).__init__( config=config, taskName='climatologyMapMLD', componentName='ocean', tags=['climatology', 'horizontalMap', fieldName, 'publicObs']) sectionName = self.taskName mpasFieldName = 'timeMonthly_avg_dThreshMLD' iselValues = None # read in what seasons we want to plot seasons = config.getExpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) comparisonGridNames = config.getExpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) # the variable 'timeMonthly_avg_dThreshMLD' will be added to # mpasClimatologyTask along with the seasons. remapClimatologySubtask = RemapMpasClimatologySubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName=fieldName, variableList=[mpasFieldName], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) if controlConfig is None: observationsDirectory = build_obs_path( config, 'ocean', '{}Subdirectory'.format(fieldName)) obsFileName = "{}/holtetalley_mld_climatology_20180710.nc".format( observationsDirectory) refFieldName = 'mld' outFileLabel = 'mldHolteTalleyARGO' remapObservationsSubtask = RemapObservedMLDClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix=refFieldName, comparisonGridNames=comparisonGridNames) self.add_subtask(remapObservationsSubtask) galleryName = 'Observations: Holte-Talley ARGO' refTitleLabel = \ 'Observations (HolteTalley density threshold MLD)' diffTitleLabel = 'Model - Observations' else: remapObservationsSubtask = None controlRunName = controlConfig.get('runs', 'mainRunName') galleryName = None refTitleLabel = 'Control: {}'.format(controlRunName) refFieldName = mpasFieldName outFileLabel = 'mld' diffTitleLabel = 'Main - Control' for comparisonGridName in comparisonGridNames: for season in seasons: # make a new subtask for this season and comparison grid subtask = PlotClimatologyMapSubtask( self, season, comparisonGridName, remapClimatologySubtask, remapObservationsSubtask, controlConfig=controlConfig) subtask.set_plot_info(outFileLabel=outFileLabel, fieldNameInTitle='MLD', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'm', imageCaption='Mean Mixed-Layer Depth', galleryGroup='Mixed-Layer Depth', groupSubtitle=None, groupLink='mld', galleryName=galleryName) self.add_subtask(subtask)
def __init__(self, config, mpasClimatologyTask, refConfig=None): # {{{ """ Construct the analysis task. Parameters ---------- config : ``MpasAnalysisConfigParser`` Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted refConfig : ``MpasAnalysisConfigParser``, optional Configuration options for a reference run (if any) """ # Authors # ------- # Xylar Asay-Davis fieldName = 'sst' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapSST, self).__init__(config=config, taskName='climatologyMapSST', componentName='ocean', tags=['climatology', 'horizontalMap', fieldName]) mpasFieldName = 'timeMonthly_avg_activeTracers_temperature' iselValues = {'nVertLevels': 0} sectionName = self.taskName climStartYear = config.getint('oceanObservations', 'sstClimatologyStartYear') climEndYear = config.getint('oceanObservations', 'sstClimatologyEndYear') # read in what seasons we want to plot seasons = config.getExpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) comparisonGridNames = config.getExpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) # the variable mpasFieldName will be added to mpasClimatologyTask # along with the seasons. remapClimatologySubtask = RemapMpasClimatologySubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName=fieldName, variableList=[mpasFieldName], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) if refConfig is None: if climStartYear < 1925: period = 'pre-industrial' else: period = 'present-day' refTitleLabel = \ 'Observations (Hadley/OI, {} {:04d}-{:04d})'.format( period, climStartYear, climEndYear) observationsDirectory = build_config_full_path( config, 'oceanObservations', '{}Subdirectory'.format(fieldName)) obsFileName = \ "{}/MODEL.SST.HAD187001-198110.OI198111-201203.nc".format( observationsDirectory) refFieldName = 'sst' outFileLabel = 'sstHADOI' galleryName = 'Observations: Hadley-NOAA-OI' remapObservationsSubtask = RemapObservedSSTClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix=refFieldName, comparisonGridNames=comparisonGridNames) self.add_subtask(remapObservationsSubtask) diffTitleLabel = 'Model - Observations' else: remapObservationsSubtask = None refRunName = refConfig.get('runs', 'mainRunName') galleryName = None refTitleLabel = 'Ref: {}'.format(refRunName) refFieldName = mpasFieldName outFileLabel = 'sst' diffTitleLabel = 'Main - Reference' for comparisonGridName in comparisonGridNames: for season in seasons: # make a new subtask for this season and comparison grid subtask = PlotClimatologyMapSubtask(self, season, comparisonGridName, remapClimatologySubtask, remapObservationsSubtask, refConfig) subtask.set_plot_info( outFileLabel=outFileLabel, fieldNameInTitle='SST', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'$^o$C', imageCaption='Mean Sea Surface Temperature', galleryGroup='Sea Surface Temperature', groupSubtitle=None, groupLink='sst', galleryName=galleryName) self.add_subtask(subtask)
def __init__(self, config, mpasClimatologyTask, hemisphere, refConfig=None): # {{{ """ Construct the analysis task. Parameters ---------- config : ``MpasAnalysisConfigParser`` Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted hemisphere : {'NH', 'SH'} The hemisphere to plot refConfig : ``MpasAnalysisConfigParser``, optional Configuration options for a reference run (if any) """ # Authors # ------- # Xylar Asay-Davis taskName = 'climatologyMapSeaIceThick{}'.format(hemisphere) fieldName = 'seaIceThick' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapSeaIceThick, self).__init__(config=config, taskName=taskName, componentName='seaIce', tags=['climatology', 'horizontalMap', fieldName]) mpasFieldName = 'timeMonthly_avg_iceVolumeCell' iselValues = None sectionName = taskName if hemisphere == 'NH': hemisphereLong = 'Northern' else: hemisphereLong = 'Southern' # read in what seasons we want to plot seasons = config.getExpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) comparisonGridNames = config.getExpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) # the variable self.mpasFieldName will be added to mpasClimatologyTask # along with the seasons. remapClimatologySubtask = RemapMpasClimatologySubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName='{}{}'.format(fieldName, hemisphere), variableList=[mpasFieldName], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) if refConfig is None: refTitleLabel = 'Observations (ICESat)' galleryName = 'Observations: ICESat' diffTitleLabel = 'Model - Observations' refFieldName = 'seaIceThick' else: refRunName = refConfig.get('runs', 'mainRunName') galleryName = None refTitleLabel = 'Ref: {}'.format(refRunName) refFieldName = mpasFieldName diffTitleLabel = 'Main - Reference' remapObservationsSubtask = None for season in seasons: if refConfig is None: obsFileName = build_config_full_path( config, 'seaIceObservations', 'thickness{}_{}'.format(hemisphere, season)) remapObservationsSubtask = RemapObservedThickClimatology( parentTask=self, seasons=[season], fileName=obsFileName, outFilePrefix='{}{}_{}'.format(refFieldName, hemisphere, season), comparisonGridNames=comparisonGridNames, subtaskName='remapObservations{}'.format(season)) self.add_subtask(remapObservationsSubtask) for comparisonGridName in comparisonGridNames: imageDescription = \ '{} Climatology Map of {}-Hemisphere Sea-Ice ' \ 'Thickness.'.format(season, hemisphereLong) imageCaption = imageDescription galleryGroup = \ '{}-Hemisphere Sea-Ice Thickness'.format( hemisphereLong) # make a new subtask for this season and comparison grid subtask = PlotClimatologyMapSubtask(self, hemisphere, season, comparisonGridName, remapClimatologySubtask, remapObservationsSubtask, refConfig) subtask.set_plot_info( outFileLabel='icethick{}'.format(hemisphere), fieldNameInTitle='Sea ice thickness', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'm', imageDescription=imageDescription, imageCaption=imageCaption, galleryGroup=galleryGroup, groupSubtitle=None, groupLink='{}_thick'.format(hemisphere.lower()), galleryName=galleryName, maskValue=0) self.add_subtask(subtask)
def __init__(self, config, mpasClimatologyTask, refConfig=None): # {{{ """ Construct the analysis task. Parameters ---------- config : ``MpasAnalysisConfigParser`` Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted refConfig : ``MpasAnalysisConfigParser``, optional Configuration options for a reference run (if any) """ # Authors # ------- # Xylar Asay-Davis fields = \ [{'prefix': 'temperature', 'mpas': '******', 'units': r'$\degree$C', 'titleName': 'Potential Temperature', '3D': True, 'obsFilePrefix': 'pot_temp', 'obsFieldName': 'theta', 'obsBotFieldName': 'botTheta'}, {'prefix': 'salinity', 'mpas': '******', 'units': r'PSU', 'titleName': 'Salinity', '3D': True, 'obsFilePrefix': 'salinity', 'obsFieldName': 'salinity', 'obsBotFieldName': 'botSalinity'}, {'prefix': 'potentialDensity', 'mpas': '******', 'units': r'kg m$^{-3}$', 'titleName': 'Potential Density', '3D': True, 'obsFilePrefix': 'pot_den', 'obsFieldName': 'potentialDensity', 'obsBotFieldName': 'botPotentialDensity'}, {'prefix': 'mixedLayerDepth', 'mpas': '******', 'units': r'm', 'titleName': 'Mixed Layer Depth', '3D': False, 'obsFilePrefix': 'mld', 'obsFieldName': 'mld', 'obsBotFieldName': None}, {'prefix': 'zonalVelocity', 'mpas': '******', 'units': r'm s$^{-1}$', 'titleName': 'Zonal Velocity', '3D': True, 'obsFilePrefix': 'zonal_vel', 'obsFieldName': 'zonalVel', 'obsBotFieldName': 'botZonalVel'}, {'prefix': 'meridionalVelocity', 'mpas': '******', 'units': r'm s$^{-1}$', 'titleName': 'Meridional Velocity', '3D': True, 'obsFilePrefix': 'merid_vel', 'obsFieldName': 'meridVel', 'obsBotFieldName': 'botMeridVel'}, {'prefix': 'velocityMagnitude', 'mpas': '******', 'units': r'm s$^{-1}$', 'titleName': 'Velocity Magnitude', '3D': True, 'obsFilePrefix': 'vel_mag', 'obsFieldName': 'velMag', 'obsBotFieldName': 'botVelMag'}] tags = ['climatology', 'horizontalMap', 'sose', 'publicObs'] \ + [field['prefix'] for field in fields] # call the constructor from the base class (AnalysisTask) super(ClimatologyMapSose, self).__init__(config=config, taskName='climatologyMapSose', componentName='ocean', tags=tags) sectionName = self.taskName fieldList = config.getExpression(sectionName, 'fieldList') fields = [field for field in fields if field['prefix'] in fieldList] # read in what seasons we want to plot seasons = config.getExpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid ' 'list of seasons'.format(sectionName)) comparisonGridNames = config.getExpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid ' 'list of comparison grids'.format(sectionName)) if not numpy.any([field['3D'] for field in fields]): depths = None else: depths = config.getExpression(sectionName, 'depths') if len(depths) == 0: raise ValueError('config section {} does not contain valid ' 'list of depths'.format(sectionName)) variableList = [ field['mpas'] for field in fields if field['mpas'] != 'velMag' ] if depths is None: remapMpasSubtask = RemapMpasClimatologySubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName='SOSE', variableList=variableList, seasons=seasons, comparisonGridNames=comparisonGridNames, iselValues=None) else: remapMpasSubtask = RemapMpasVelMagClimatology( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName='SOSE', variableList=variableList, seasons=seasons, depths=depths, comparisonGridNames=comparisonGridNames, iselValues=None) for field in fields: fieldPrefix = field['prefix'] upperFieldPrefix = fieldPrefix[0].upper() + fieldPrefix[1:] sectionName = '{}{}'.format(self.taskName, upperFieldPrefix) if field['3D']: fieldDepths = depths else: fieldDepths = None if refConfig is None: refTitleLabel = 'State Estimate (SOSE)' observationsDirectory = build_config_full_path( config, 'oceanObservations', 'soseSubdirectory') obsFileName = \ '{}/SOSE_2005-2010_monthly_{}_6000.0x' \ '6000.0km_10.0km_Antarctic_stereo.nc'.format( observationsDirectory, field['obsFilePrefix']) refFieldName = field['obsFieldName'] outFileLabel = '{}SOSE'.format(fieldPrefix) galleryName = 'State Estimate: SOSE' diffTitleLabel = 'Model - State Estimate' remapObsSubtask = RemapSoseClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix='{}SOSE'.format(refFieldName), fieldName=refFieldName, botFieldName=field['obsBotFieldName'], depths=fieldDepths, comparisonGridNames=comparisonGridNames, subtaskName='remapObservations{}'.format(upperFieldPrefix)) self.add_subtask(remapObsSubtask) else: remapObsSubtask = None refRunName = refConfig.get('runs', 'mainRunName') galleryName = 'Ref: {}'.format(refRunName) refTitleLabel = galleryName refFieldName = field['mpas'] outFileLabel = fieldPrefix diffTitleLabel = 'Main - Reference' if field['3D']: fieldDepths = depths else: fieldDepths = [None] for comparisonGridName in comparisonGridNames: for season in seasons: for depth in fieldDepths: subtaskName = 'plot{}_{}_{}'.format( upperFieldPrefix, season, comparisonGridName) if depth is not None: subtaskName = '{}_depth_{}'.format( subtaskName, depth) subtask = PlotClimatologyMapSubtask( parentTask=self, season=season, comparisonGridName=comparisonGridName, remapMpasClimatologySubtask=remapMpasSubtask, remapObsClimatologySubtask=remapObsSubtask, refConfig=refConfig, depth=depth, subtaskName=subtaskName) subtask.set_plot_info( outFileLabel=outFileLabel, fieldNameInTitle=field['titleName'], mpasFieldName=field['mpas'], refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=field['units'], imageCaption=field['titleName'], galleryGroup=field['titleName'], groupSubtitle=None, groupLink='{}Sose'.format(fieldPrefix), galleryName=galleryName, configSectionName='climatologyMapSose{}'.format( upperFieldPrefix)) self.add_subtask(subtask)
def _add_tasks(self, config, mpasClimatologyTasks, controlConfig, title, mpasVariableSuffix, filePrefix, sectionPrefix): ''' Add tasks for a given variable ''' iselValues = None # read in what seasons we want to plot seasons = config.getExpression(self.taskName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(self.taskName)) comparisonGridNames = config.getExpression(self.taskName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(self.taskName)) remapClimatologySubtasks = {} mpasFieldNames = {} for op in ['min', 'max']: upperOp = op[0].upper() + op[1:] mpasFieldNames[op] = 'timeMonthly{}_{}_{}'.format( upperOp, op, mpasVariableSuffix) # the variable 'timeMonthly_avg_dThreshMLD' will be added to # mpasClimatologyTask along with the seasons. remapClimatologySubtasks[op] = RemapMpasClimatologySubtask( mpasClimatologyTask=mpasClimatologyTasks[op], parentTask=self, climatologyName=filePrefix, variableList=[mpasFieldNames[op]], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues, subtaskName='remap{}_{}'.format(upperOp, filePrefix)) if controlConfig is None: fieldNameInTitle = 'Max {}'.format(title) refTitleLabel = 'Min {}'.format(title) diffTitleLabel = 'Max - Min {}'.format(title) galleryName = title outFileLabel = '{}_min_max'.format(filePrefix) sectionName = '{}MinMax'.format(sectionPrefix) for comparisonGridName in comparisonGridNames: for season in seasons: subtaskName = 'plot_{}_{}_{}'.format(filePrefix, season, comparisonGridName) # make a new subtask for this season and comparison grid firstTask = remapClimatologySubtasks['max'] secondTask = remapClimatologySubtasks['min'] subtask = PlotClimatologyMapSubtask( self, season, comparisonGridName, remapMpasClimatologySubtask=firstTask, secondRemapMpasClimatologySubtask=secondTask, controlConfig=controlConfig, subtaskName=subtaskName) subtask.set_plot_info( outFileLabel=outFileLabel, fieldNameInTitle=fieldNameInTitle, mpasFieldName=mpasFieldNames['max'], refFieldName=mpasFieldNames['min'], refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'm', imageCaption='Min/Max Mixed-Layer Depth', galleryGroup='Min/Max Mixed-Layer Depth', groupSubtitle=None, groupLink='mld_min_max', galleryName=galleryName, configSectionName=sectionName) self.add_subtask(subtask) else: controlRunName = controlConfig.get('runs', 'mainRunName') galleryName = title refTitleLabel = 'Control: {}'.format(controlRunName) diffTitleLabel = 'Main - Control' for comparisonGridName in comparisonGridNames: for season in seasons: for op in ['min', 'max']: upperOp = op[0].upper() + op[1:] subtaskName = 'plot{}_{}_{}_{}'.format( upperOp, filePrefix, season, comparisonGridName) fieldNameInTitle = '{} {}'.format(upperOp, title) outFileLabel = '{}_{}'.format(filePrefix, op) sectionName = '{}{}'.format(sectionPrefix, upperOp) # make a new subtask for this season and comparison # grid subtask = PlotClimatologyMapSubtask( self, season, comparisonGridName, remapClimatologySubtasks[op], controlConfig=controlConfig, subtaskName=subtaskName) subtask.set_plot_info( outFileLabel=outFileLabel, fieldNameInTitle=fieldNameInTitle, mpasFieldName=mpasFieldNames[op], refFieldName=mpasFieldNames[op], refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'm', imageCaption=fieldNameInTitle, galleryGroup='Min/Max Mixed-Layer Depth', groupSubtitle=None, groupLink='mld_{}'.format(op), galleryName=galleryName, configSectionName=sectionName) self.add_subtask(subtask)