def build_analysis_list(config): # {{{ """ Build a list of analysis modules based on the 'generate' config option. Author: Xylar Asay-Davis Last Modified: 03/07/2017 """ # choose the right rendering backend, depending on whether we're displaying # to the screen if not config.getboolean('plot', 'displayToScreen'): mpl.use('Agg') # analysis can only be imported after the right MPL renderer is selected from mpas_analysis import ocean from mpas_analysis import sea_ice # analyses will be a list of analysis classes analyses = [] # Ocean Analyses analyses.append(ocean.TimeSeriesOHC(config)) analyses.append(ocean.TimeSeriesSST(config)) analyses.append(ocean.IndexNino34(config)) analyses.append(ocean.MeridionalHeatTransport(config)) analyses.append(ocean.StreamfunctionMOC(config)) analyses.append(ocean.ClimatologyMapSST(config)) analyses.append(ocean.ClimatologyMapMLD(config)) analyses.append(ocean.ClimatologyMapSSS(config)) # Sea Ice Analyses analyses.append(sea_ice.TimeSeriesSeaIce(config)) analyses.append(sea_ice.ClimatologyMapSeaIce(config)) # check which analysis we actually want to generate and only keep those analysesToGenerate = [] for analysisTask in analyses: # for each anlaysis module, check if we want to generate this task # and if the analysis task has a valid configuration if analysisTask.check_generate(): add = False try: analysisTask.setup_and_check() add = True except: traceback.print_exc(file=sys.stdout) print "ERROR: analysis module {} failed during check and " \ "will not be run".format(analysisTask.taskName) if add: analysesToGenerate.append(analysisTask) return analysesToGenerate # }}}
def build_analysis_list(config, controlConfig): # {{{ """ Build a list of analysis tasks. New tasks should be added here, following the approach used for existing analysis tasks. Parameters ---------- config : ``MpasAnalysisConfigParser`` object contains config options controlConfig : ``MpasAnalysisConfigParser`` object contains config options for a control run, or ``None`` if no config file for a control run was specified Returns ------- analyses : list of ``AnalysisTask`` objects A list of all analysis tasks """ # Authors # ------- # Xylar Asay-Davis analyses = [] # Ocean Analyses oceanClimatolgyTasks = {} for op in ['avg', 'min', 'max']: oceanClimatolgyTasks[op] = MpasClimatologyTask(config=config, componentName='ocean', op=op) oceanTimeSeriesTask = MpasTimeSeriesTask(config=config, componentName='ocean') oceanIndexTask = MpasTimeSeriesTask(config=config, componentName='ocean', section='index') oceanRefYearClimatolgyTask = RefYearMpasClimatologyTask( config=config, componentName='ocean') for op in oceanClimatolgyTasks: analyses.append(oceanClimatolgyTasks[op]) analyses.append(oceanRefYearClimatolgyTask) analyses.append( ocean.ClimatologyMapMLD(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapMLDMinMax(config, oceanClimatolgyTasks, controlConfig)) analyses.append( ocean.ClimatologyMapSST(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapSSS(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapSSH(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapEKE(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapOHCAnomaly(config, oceanClimatolgyTasks['avg'], oceanRefYearClimatolgyTask, controlConfig)) analyses.append( ocean.ClimatologyMapSose(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapBGC(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapArgoTemperature(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapArgoSalinity(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapSchmidtko(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.ClimatologyMapAntarcticMelt(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.TimeSeriesAntarcticMelt(config, oceanTimeSeriesTask, controlConfig)) analyses.append(ocean.TimeSeriesOceanRegions(config, controlConfig)) analyses.append( ocean.TimeSeriesTemperatureAnomaly(config, oceanTimeSeriesTask)) analyses.append( ocean.TimeSeriesSalinityAnomaly(config, oceanTimeSeriesTask)) analyses.append( ocean.TimeSeriesOHCAnomaly(config, oceanTimeSeriesTask, controlConfig)) analyses.append( ocean.TimeSeriesSST(config, oceanTimeSeriesTask, controlConfig)) analyses.append( ocean.MeridionalHeatTransport(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.StreamfunctionMOC(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append(ocean.IndexNino34(config, oceanIndexTask, controlConfig)) analyses.append( ocean.WoceTransects(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.SoseTransects(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append( ocean.GeojsonTransects(config, oceanClimatolgyTasks['avg'], controlConfig)) analyses.append(ocean.OceanRegionalProfiles(config, controlConfig)) # Sea Ice Analyses seaIceClimatolgyTask = MpasClimatologyTask(config=config, componentName='seaIce') seaIceTimeSeriesTask = MpasTimeSeriesTask(config=config, componentName='seaIce') analyses.append(seaIceClimatolgyTask) analyses.append( sea_ice.ClimatologyMapSeaIceConc( config=config, mpasClimatologyTask=seaIceClimatolgyTask, hemisphere='NH', controlConfig=controlConfig)) analyses.append( sea_ice.ClimatologyMapSeaIceThick( config=config, mpasClimatologyTask=seaIceClimatolgyTask, hemisphere='NH', controlConfig=controlConfig)) analyses.append( sea_ice.ClimatologyMapSeaIceConc( config=config, mpasClimatologyTask=seaIceClimatolgyTask, hemisphere='SH', controlConfig=controlConfig)) analyses.append( sea_ice.ClimatologyMapSeaIceThick( config=config, mpasClimatologyTask=seaIceClimatolgyTask, hemisphere='SH', controlConfig=controlConfig)) analyses.append(seaIceTimeSeriesTask) analyses.append( sea_ice.TimeSeriesSeaIce(config, seaIceTimeSeriesTask, controlConfig)) # Iceberg Analyses analyses.append( sea_ice.ClimatologyMapIcebergConc( config=config, mpasClimatologyTask=seaIceClimatolgyTask, hemisphere='SH', controlConfig=controlConfig)) return analyses # }}}