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 = '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, 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 ------- Phillip J. Wolfram, Riley X. Brady, Xylar Asay-Davis """ # call the constructor from the base class (AnalysisTask) bgcVars = config.getExpression('climatologyMapBGC', 'variables') super(ClimatologyMapBGC, self).__init__( config=config, taskName='climatologyMapBGC', componentName='ocean', tags=['climatology', 'horizontalMap', 'BGC'] + bgcVars) sectionName = 'climatologyMapBGC' # 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)) preindustrial = config.getboolean(sectionName, 'preindustrial') obsFileDict = { 'Chl': 'Chl_SeaWIFS_20180702.nc', 'CO2_gas_flux': 'CO2_gas_flux_1.0x1.0degree_20180628.nc', 'SiO3': 'SiO3_1.0x1.0degree_20180628.nc', 'PO4': 'PO4_1.0x1.0degree_20180628.nc', 'ALK': 'ALK_1.0x1.0degree_20180629.nc', 'NO3': 'NO3_1.0x1.0degree_20180628.nc', 'pCO2surface': 'pCO2surface_1.0x1.0degree_20180629.nc', 'O2': 'O2_1.0x1.0degree_20180628.nc', 'pH_3D': 'pH_3D_1.0x1.0degree_20180629.nc' } # If user wants to compare to preindustrial data, make sure # that we load in the right DIC field. if preindustrial: obsFileDict['DIC'] = 'PI_DIC_1.0x1.0degree_20180629.nc' else: obsFileDict['DIC'] = 'DIC_1.0x1.0degree_20180629.nc' for fieldName in bgcVars: fieldSectionName = '{}_{}'.format(sectionName, fieldName) prefix = config.get(fieldSectionName, 'filePrefix') mpasFieldName = '{}{}'.format(prefix, fieldName) # CO2 flux and pCO2 has no vertical levels, throws error if you try # to select any. Can add any other flux-like variables to this # list. if fieldName not in ['CO2_gas_flux', 'pCO2surface']: iselValues = {'nVertLevels': 0} else: iselValues = None # Read in units (since BGC units are variable) units = config.get(fieldSectionName, 'units') # Pass multiple variables if working with Chlorophyll to sum # them to total chlorophyll if fieldName == 'Chl': prefix = 'timeMonthly_avg_ecosysTracers_' variableList = [ prefix + 'spChl', prefix + 'diatChl', prefix + 'diazChl', prefix + 'phaeoChl' ] plotField = 'Chl' else: variableList = [mpasFieldName] plotField = mpasFieldName remapClimatologySubtask = RemapBGCClimatology( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName=fieldName, variableList=variableList, comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues, subtaskName='remapMpasClimatology_{}'.format(fieldName)) if controlConfig is None: refTitleLabel = 'Observations' if preindustrial and 'DIC' in fieldName: refTitleLabel += ' (Preindustrial)' observationsDirectory = build_obs_path( config, 'ocean', '{}Subdirectory'.format(fieldName)) obsFileName = "{}/{}".format(observationsDirectory, obsFileDict[fieldName]) observationsLabel = config.get(fieldSectionName, 'observationsLabel') refFieldName = fieldName outFileLabel = fieldName + observationsLabel galleryLabel = config.get(fieldSectionName, 'galleryLabel') galleryName = '{} (Compared to {})'.format( galleryLabel, observationsLabel) remapObservationsSubtask = RemapObservedBGCClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix=refFieldName, comparisonGridNames=comparisonGridNames, subtaskName='remapObservations_{}'.format(fieldName)) self.add_subtask(remapObservationsSubtask) diffTitleLabel = 'Model - Observations' # Certain BGC observations are only available at annual # resolution. Need to ensure that the user is aware that their # seasonal or monthly climatology is being compared to ANN. # Currently, this is just with GLODAP. if observationsLabel == 'GLODAPv2': diffTitleLabel += ' (Compared to ANN)' else: remapObservationsSubtask = None controlRunName = controlConfig.get('runs', 'mainRunName') galleryName = None refTitleLabel = 'Control: {}'.format(controlRunName) refFieldName = mpasFieldName outFileLabel = fieldName 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, subtaskName='plot{}_{}_{}'.format( fieldName, season, comparisonGridName)) subtask.set_plot_info( outFileLabel=outFileLabel, fieldNameInTitle=fieldName, mpasFieldName=plotField, refFieldName=refFieldName, refTitleLabel=refTitleLabel, unitsLabel=units, imageCaption='Mean ' + fieldName, galleryGroup='Sea Surface Biogeochemistry', groupSubtitle=None, groupLink=fieldName, galleryName=galleryName, diffTitleLabel=diffTitleLabel, configSectionName=fieldSectionName) 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 = 'ssh' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapSSH, self).__init__(config=config, taskName='climatologyMapSSH', componentName='ocean', tags=['climatology', 'horizontalMap', fieldName]) mpasFieldName = 'timeMonthly_avg_pressureAdjustedSSH' iselValues = None 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 mpasFieldName will be added to mpasClimatologyTask # along with the seasons. remapClimatologySubtask = RemapSSHClimatology( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName=fieldName, variableList=[mpasFieldName], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) if refConfig is None: refTitleLabel = 'Observations (AVISO Dynamic ' \ 'Topography, 1993-2010)' observationsDirectory = build_config_full_path( config, 'oceanObservations', '{}Subdirectory'.format(fieldName)) obsFileName = \ "{}/zos_AVISO_L4_199210-201012.nc".format( observationsDirectory) refFieldName = 'zos' outFileLabel = 'sshAVISO' galleryName = 'Observations: AVISO' remapObservationsSubtask = RemapObservedSSHClimatology( 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 = 'ssh' 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, removeMean=True) subtask.set_plot_info(outFileLabel=outFileLabel, fieldNameInTitle='Zero-mean SSH', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'cm', imageCaption='Mean Sea Surface Height', galleryGroup='Sea Surface Height', groupSubtitle=None, groupLink='ssh', galleryName=galleryName) self.add_subtask(subtask)
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 = '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 mpasFieldName = 'timeMonthly_avg_landIceFreshwaterFlux' 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_landIceFreshwaterFlux' will be added to # mpasClimatologyTask along with the seasons. remapClimatologySubtask = RemapMpasAntarcticMeltClimatology( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName=fieldName, variableList=[mpasFieldName], comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) if controlConfig is None: refTitleLabel = \ 'Observations (Rignot et al, 2013)' observationsDirectory = build_obs_path( config, 'ocean', 'meltSubdirectory') obsFileName = \ '{}/Rignot_2013_melt_rates_6000.0x6000.0km_10.0km_' \ 'Antarctic_stereo.nc'.format(observationsDirectory) refFieldName = 'meltRate' outFileLabel = 'meltRignot' galleryName = 'Observations: Rignot et al. (2013)' remapObservationsSubtask = RemapObservedAntarcticMeltClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix=refFieldName, comparisonGridNames=comparisonGridNames) self.add_subtask(remapObservationsSubtask) diffTitleLabel = 'Model - Observations' else: remapObservationsSubtask = None controlRunName = controlConfig.get('runs', 'mainRunName') galleryName = None refTitleLabel = 'Control: {}'.format(controlRunName) refFieldName = mpasFieldName outFileLabel = 'melt' 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='Melt Rate', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'm a$^{-1}$', imageCaption='Antarctic Melt Rate', galleryGroup='Melt Rate', groupSubtitle=None, groupLink='antarctic_melt', 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, 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 fields = \ [{'prefix': 'temperature', 'mpas': '******', 'units': r'$\degree$C', 'obs': 'botTheta', 'title': 'Potential Temperature'}, {'prefix': 'salinity', 'mpas': '******', 'units': r'PSU', 'obs': 'botSalinity', 'title': 'Salinity'}, {'prefix': 'potentialDensity', 'mpas': '******', 'units': r'kg m$^{-3}$', 'obs': 'botPotentialDensity', 'title': 'Potential Density'}] tags = ['climatology', 'horizontalMap', 'antarctic'] \ + [field['prefix'] for field in fields] # call the constructor from the base class (AnalysisTask) super(ClimatologyMapSchmidtko, self).__init__(config=config, taskName='climatologyMapSchmidtko', componentName='ocean', tags=tags) 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)) observationsDirectory = build_obs_path(config, 'ocean', 'schmidtkoSubdirectory') obsFileName = '{}/Schmidtko_et_al_2014_bottom_PT_S_PD_' \ '6000.0x6000.0km_10.0km_Antarctic_stereo.nc' \ ''.format(observationsDirectory) # the variable 'timeMonthly_avg_landIceFreshwaterFlux' will be added to # mpasClimatologyTask along with the seasons. remapClimatologySubtask = RemapDepthSlicesSubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName='schmidtko', variableList=[field['mpas'] for field in fields], seasons=seasons, depths=['bot'], comparisonGridNames=comparisonGridNames) if controlConfig is None: refTitleLabel = 'Observations: Schmidtko et al. (2014)' diffTitleLabel = 'Model - Observations' groupSubtitle = refTitleLabel else: controlRunName = controlConfig.get('runs', 'mainRunName') refTitleLabel = 'Control: {}'.format(controlRunName) diffTitleLabel = 'Main - Control' groupSubtitle = None for field in fields: fieldPrefix = field['prefix'] upperFieldPrefix = fieldPrefix[0].upper() + fieldPrefix[1:] if controlConfig is None: refFieldName = field['obs'] outFileLabel = '{}Schmidtko'.format(fieldPrefix) remapObservationsSubtask = RemapSchmidtko( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix='{}Schmidtko'.format(fieldPrefix), fieldName=refFieldName, comparisonGridNames=comparisonGridNames, subtaskName='remapObservations{}'.format(upperFieldPrefix)) self.add_subtask(remapObservationsSubtask) else: remapObservationsSubtask = None refFieldName = field['mpas'] outFileLabel = '{}Bottom'.format(fieldPrefix) diffTitleLabel = 'Main - Control' for comparisonGridName in comparisonGridNames: for season in seasons: subtask = PlotClimatologyMapSubtask( parentTask=self, season=season, comparisonGridName=comparisonGridName, remapMpasClimatologySubtask=remapClimatologySubtask, remapObsClimatologySubtask=remapObservationsSubtask, controlConfig=controlConfig, depth='bot', subtaskName='plot{}_{}_{}'.format( upperFieldPrefix, season, comparisonGridName)) subtask.set_plot_info( outFileLabel=outFileLabel, fieldNameInTitle=field['title'], mpasFieldName=field['mpas'], refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=field['units'], imageCaption=field['title'], galleryGroup='Seafloor Maps', groupSubtitle=groupSubtitle, groupLink='seafloor', galleryName=field['title'], configSectionName='climatologyMapSchmidtko{}'.format( upperFieldPrefix)) 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 # ------- # Luke Van Roekel, Xylar Asay-Davis fieldName = 'temperatureArgo' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapArgoTemperature, self).__init__( config=config, taskName='climatologyMapArgoTemperature', componentName='ocean', tags=['climatology', 'horizontalMap', 'argo', fieldName]) sectionName = self.taskName mpasFieldName = 'timeMonthly_avg_activeTracers_temperature' 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)) depths = config.getExpression(sectionName, 'depths') if len(depths) == 0: raise ValueError('config section {} does not contain valid ' 'list of depths'.format(sectionName)) # the variable 'timeMonthly_avg_landIceFreshwaterFlux' will be added to # mpasClimatologyTask along with the seasons. remapClimatologySubtask = RemapDepthSlicesSubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName=fieldName, variableList=[mpasFieldName], seasons=seasons, depths=depths, comparisonGridNames=comparisonGridNames, iselValues=iselValues) if refConfig is None: refTitleLabel = 'Roemmich-Gilson Argo Climatology: Temperature' observationsDirectory = build_config_full_path( config, 'oceanObservations', 'argoSubdirectory') obsFileName = \ '{}/ArgoClimatology_TS.nc'.format( observationsDirectory) refFieldName = 'theta' outFileLabel = 'tempArgo' galleryName = 'Roemmich-Gilson Climatology: Argo' diffTitleLabel = 'Model - Argo' remapObservationsSubtask = RemapArgoClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix='{}Argo'.format(refFieldName), fieldName=refFieldName, depths=depths, comparisonGridNames=comparisonGridNames) self.add_subtask(remapObservationsSubtask) else: remapObservationsSubtask = None refRunName = refConfig.get('runs', 'mainRunName') galleryName = 'Ref: {}'.format(refRunName) refTitleLabel = galleryName refFieldName = mpasFieldName outFileLabel = 'temp' diffTitleLabel = 'Main - Reference' for comparisonGridName in comparisonGridNames: for season in seasons: for depth in depths: subtask = PlotClimatologyMapSubtask( parentTask=self, season=season, comparisonGridName=comparisonGridName, remapMpasClimatologySubtask=remapClimatologySubtask, remapObsClimatologySubtask=remapObservationsSubtask, refConfig=refConfig, depth=depth) subtask.set_plot_info( outFileLabel=outFileLabel, fieldNameInTitle='Temperature', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'$^\circ$C', imageCaption='Model temperature compared with Argo ' 'observations', galleryGroup='Argo Temperature', groupSubtitle=None, groupLink='tempArgo', galleryName=galleryName) self.add_subtask(subtask)
def __init__(self, config, mpasClimatologyTask, refYearClimatolgyTask, refConfig=None): # {{{ """ Construct the analysis task. Parameters ---------- config : ``MpasAnalysisConfigParser`` Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted refYearClimatolgyTask : ``RefYearMpasClimatologyTask`` The task that produced the climatology from the first year to be remapped and then subtracted from the main climatology refConfig : ``MpasAnalysisConfigParser``, optional Configuration options for a reference run (if any) """ # Authors # ------- # Xylar Asay-Davis fieldName = 'deltaOHC' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapOHCAnomaly, self).__init__( config=config, taskName='climatologyMapOHCAnomaly', componentName='ocean', tags=['climatology', 'horizontalMap', fieldName, 'publicObs']) sectionName = self.taskName mpasFieldName = 'deltaOHC' # 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)) variableList = ['timeMonthly_avg_activeTracers_temperature', 'timeMonthly_avg_layerThickness'] depthRanges = config.getExpression('climatologyMapOHCAnomaly', 'depthRanges', usenumpyfunc=True) for minDepth, maxDepth in depthRanges: depthRangeString = '{:g}-{:g}m'.format(numpy.abs(minDepth), numpy.abs(maxDepth)) remapClimatologySubtask = RemapMpasOHCClimatology( mpasClimatologyTask=mpasClimatologyTask, refYearClimatolgyTask=refYearClimatolgyTask, parentTask=self, climatologyName='{}_{}'.format(fieldName, depthRangeString), variableList=variableList, comparisonGridNames=comparisonGridNames, seasons=seasons, minDepth=minDepth, maxDepth=maxDepth) self.add_subtask(remapClimatologySubtask) outFileLabel = 'deltaOHC_{}'.format(depthRangeString) remapObservationsSubtask = None if refConfig is None: refTitleLabel = None refFieldName = None diffTitleLabel = 'Model - Observations' else: refRunName = refConfig.get('runs', 'mainRunName') refTitleLabel = 'Ref: {}'.format(refRunName) refFieldName = mpasFieldName diffTitleLabel = 'Main - Reference' for comparisonGridName in comparisonGridNames: for season in seasons: # make a new subtask for this season and comparison grid subtaskName = 'plot{}_{}_{}'.format( season, comparisonGridName, depthRangeString) subtask = PlotClimatologyMapSubtask( self, season, comparisonGridName, remapClimatologySubtask, remapObservationsSubtask, refConfig, subtaskName=subtaskName) subtask.set_plot_info( outFileLabel=outFileLabel, fieldNameInTitle=r'$\Delta$OHC over {}'.format( depthRangeString), mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'GJ m$^{-2}$', imageCaption='Anomaly in Ocean Heat Content over ' '{}'.format(depthRangeString), galleryGroup='OHC Anomaly', groupSubtitle=None, groupLink='ohc_anom', galleryName=None) self.add_subtask(subtask)
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 # ------- # Milena Veneziani fields = \ [{'prefix': 'temperature', 'mpas': '******', 'units': r'$\degree$C', 'titleName': 'Potential Temperature', 'obsFieldName': 't_an'}, {'prefix': 'salinity', 'mpas': '******', 'units': r'PSU', 'titleName': 'Salinity', 'obsFieldName': 's_an'}] tags = ['climatology', 'horizontalMap', 'woa', 'publicObs'] + \ [field['prefix'] for field in fields] # call the constructor from the base class (AnalysisTask) super(ClimatologyMapWoa, self).__init__(config=config, taskName='climatologyMapWoa', 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)) 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] shallowVsDeepColormapDepth = config.getfloat( sectionName, 'shallowVsDeepColormapDepth') shallow = [] for depth in depths: if depth == 'top': shallow.append(True) elif depth == 'bot': shallow.append(False) else: shallow.append(depth >= shallowVsDeepColormapDepth) remapMpasSubtask = RemapDepthSlicesSubtask( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName='WOA', variableList=variableList, seasons=seasons, depths=depths, comparisonGridNames=comparisonGridNames, iselValues=None) remapAnnObsSubtask = None remapMonObsSubtask = None if controlConfig is None: # Since we have a WOA18 annual climatology file and # another file containing the 12 WOA18 monthly climatologies, # do the remapping for each season separately observationsDirectory = build_obs_path(config, 'ocean', 'woa18Subdirectory') refFieldNames = [field['obsFieldName'] for field in fields] if 'ANN' in seasons: obsFileName = \ '{}/woa18_decav_04_TS_ann_20190829.nc'.format( observationsDirectory) remapAnnObsSubtask = RemapWoaClimatology( parentTask=self, seasons=['ANN'], fileName=obsFileName, outFilePrefix='woa18_ann', fieldNames=refFieldNames, depths=depths, comparisonGridNames=comparisonGridNames, subtaskName='remapObservationsAnn') self.add_subtask(remapAnnObsSubtask) seasonsMinusAnn = list(seasons) if 'ANN' in seasonsMinusAnn: seasonsMinusAnn.remove('ANN') if len(seasonsMinusAnn) > 0: obsFileName = \ '{}/woa18_decav_04_TS_mon_20190829.nc'.format( observationsDirectory) remapMonObsSubtask = RemapWoaClimatology( parentTask=self, seasons=seasonsMinusAnn, fileName=obsFileName, outFilePrefix='woa18_mon', fieldNames=refFieldNames, depths=depths, comparisonGridNames=comparisonGridNames, subtaskName='remapObservationsMon') self.add_subtask(remapMonObsSubtask) for field in fields: fieldPrefix = field['prefix'] upperFieldPrefix = fieldPrefix[0].upper() + fieldPrefix[1:] sectionName = '{}{}'.format(self.taskName, upperFieldPrefix) if controlConfig is None: refTitleLabel = 'WOA18 Climatology' refFieldName = field['obsFieldName'] outFileLabel = '{}WOA18'.format(fieldPrefix) galleryName = 'WOA18 Climatology' diffTitleLabel = 'Model - Climatology' else: controlRunName = controlConfig.get('runs', 'mainRunName') galleryName = 'Control: {}'.format(controlRunName) refTitleLabel = galleryName refFieldName = field['mpas'] outFileLabel = '{}WOA18'.format(fieldPrefix) diffTitleLabel = 'Main - Control' for comparisonGridName in comparisonGridNames: for depthIndex, depth in enumerate(depths): for season in seasons: if season == 'ANN': remapObsSubtask = remapAnnObsSubtask else: remapObsSubtask = remapMonObsSubtask subtaskName = 'plot{}_{}_{}_depth_{}'.format( upperFieldPrefix, season, comparisonGridName, depth) subtask = PlotClimatologyMapSubtask( parentTask=self, season=season, comparisonGridName=comparisonGridName, remapMpasClimatologySubtask=remapMpasSubtask, remapObsClimatologySubtask=remapObsSubtask, controlConfig=controlConfig, depth=depth, subtaskName=subtaskName) configSectionName = 'climatologyMapWoa{}'.format( upperFieldPrefix) # if available, use a separate color map for shallow # and deep if depth is not None: if shallow[depthIndex]: suffix = 'Shallow' else: suffix = 'Deep' testSectionName = '{}{}'.format( configSectionName, suffix) if config.has_section(testSectionName): configSectionName = testSectionName 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='{}_woa'.format(fieldPrefix), galleryName=galleryName, configSectionName=configSectionName) self.add_subtask(subtask)
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, Kevin Rosa fieldName = 'eke' # call the constructor from the base class (AnalysisTask) super(ClimatologyMapEKE, self).__init__( config=config, taskName='climatologyMapEKE', componentName='ocean', tags=['climatology', 'horizontalMap', fieldName, 'publicObs']) mpasFieldName = 'eke' iselValues = {'nVertLevels': 0} sectionName = self.taskName # read in what seasons we want to plot seasons = config.getExpression(sectionName, 'seasons') # EKE observations are annual climatology so only accept annual # climatology **should move this to setup_and_check() if seasons != ['ANN']: raise ValueError('config section {} does not contain valid list ' 'of seasons. For EKE, may only request annual ' 'climatology'.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 variables in variableList will be added to mpasClimatologyTask # along with the seasons. variableList = ['timeMonthly_avg_velocityZonal', 'timeMonthly_avg_velocityMeridional', 'timeMonthly_avg_velocityZonalSquared', 'timeMonthly_avg_velocityMeridionalSquared'] remapClimatologySubtask = RemapMpasEKEClimatology( mpasClimatologyTask=mpasClimatologyTask, parentTask=self, climatologyName=fieldName, variableList=variableList, comparisonGridNames=comparisonGridNames, seasons=seasons, iselValues=iselValues) # to compare to observations: if controlConfig is None: refTitleLabel = \ 'Observations (Surface EKE from Drifter Data)' observationsDirectory = build_obs_path( config, 'ocean', '{}Subdirectory'.format(fieldName)) obsFileName = \ "{}/drifter_variance_20180804.nc".format( observationsDirectory) refFieldName = 'eke' outFileLabel = 'ekeDRIFTER' galleryName = 'Observations: EKE from Drifters' remapObservationsSubtask = RemapObservedEKEClimatology( parentTask=self, seasons=seasons, fileName=obsFileName, outFilePrefix=refFieldName, comparisonGridNames=comparisonGridNames) self.add_subtask(remapObservationsSubtask) diffTitleLabel = 'Model - Observations' # compare with previous run: else: remapObservationsSubtask = None controlRunName = controlConfig.get('runs', 'mainRunName') galleryName = None refTitleLabel = 'Control: {}'.format(controlRunName) refFieldName = mpasFieldName outFileLabel = 'eke' 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='EKE', mpasFieldName=mpasFieldName, refFieldName=refFieldName, refTitleLabel=refTitleLabel, diffTitleLabel=diffTitleLabel, unitsLabel=r'cm$^2$/s$^2$', imageCaption='Mean Surface Eddy Kinetic Energy', galleryGroup='Eddy Kinetic Energy', groupSubtitle=None, groupLink='eke', 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 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)