def generate_plots(self, env): """generate list of NCL plotting routines """ print(' Generating diagnostic plots for : {0}'.format( self.__class__.__name__)) for ncl in self._ncl: diagUtilsLib.generate_ncl_plots(env, ncl)
def generate_plots(self, env): """Put commands to generate plot here! """ print(' Generating diagnostic plots for : {0}'.format( self.__class__.__name__)) for ncl in self._ncl: diagUtilsLib.generate_ncl_plots(env, ncl)
def generate_plots(self, env): """Put commands to generate plot here! """ print(' Generating diagnostic plots for : {0}'.format(self.__class__.__name__)) # always compute the RHO value regardless of diagnostic type diagUtilsLib.generate_ncl_plots(env, 'compute_rho.ncl') for ncl in self._ncl: diagUtilsLib.generate_ncl_plots(env, ncl)
def generate_plots(self, env): """Put commands to generate plot here! """ print(' Generating diagnostic plots for : {0}'.format( self.__class__.__name__)) # always compute the RHO value regardless of diagnostic type diagUtilsLib.generate_ncl_plots(env, 'compute_rho.ncl') for ncl in self._ncl: diagUtilsLib.generate_ncl_plots(env, ncl)
def generate_plots(self, env): """Put commands to generate plot here! """ print(' Generating diagnostic plots for : {0}'.format(self.__class__.__name__)) for ncl in self._ncl: diagUtilsLib.generate_ncl_plots(env, ncl)
def check_prerequisites(self, env, scomm): """ check prerequisites """ print(" Checking prerequisites for : {0}".format( self.__class__.__name__)) super(modelVsModel, self).check_prerequisites(env, scomm) # Set some new env variables env['DIAG_CODE'] = env['NCLPATH'] env['test_path_diag'] = '{0}/{1}-{2}/'.format(env['test_path_diag'], env['test_casename'], env['cntl_casename']) env['WKDIR'] = env['test_path_diag'] env['WORKDIR'] = env['test_path_diag'] if scomm.is_manager(): if not os.path.exists(env['WKDIR']): os.makedirs(env['WKDIR']) env['COMPARE'] = env['CNTL'] env['PLOTTYPE'] = env['p_type'] env['COLORTYPE'] = env['c_type'] env['MG_MICRO'] = env['microph'] env['TIMESTAMP'] = env['time_stamp'] env['TICKMARKS'] = env['tick_marks'] if env['custom_names'] == 'True': env['CASENAMES'] = 'True' env['CASE1'] = env['test_name'] env['CASE2'] = env['cntl_name'] else: env['CASENAMES'] = 'False' env['CASE1'] = 'null' env['CASE2'] = 'null' env['CNTL_PLOTVARS'] = 'null' env['test_in'] = env['test_path_climo'] + env['test_casename'] env['test_out'] = env['test_path_climo'] + env['test_casename'] env['cntl_in'] = env['cntl_path_climo'] + env['cntl_casename'] env['cntl_out'] = env['cntl_path_climo'] + env['cntl_casename'] env['seas'] = [] if env['plot_ANN_climo'] == 'True': env['seas'].append('ANN') if env['plot_DJF_climo'] == 'True': env['seas'].append('DJF') if env['plot_MAM_climo'] == 'True': env['seas'].append('MAM') if env['plot_JJA_climo'] == 'True': env['seas'].append('JJA') if env['plot_SON_climo'] == 'True': env['seas'].append('SON') # Significance vars if env['significance'] == 'True': env['SIG_PLOT'] = 'True' env['SIG_LVL'] = env['sig_lvl'] else: env['SIG_PLOT'] = 'False' env['SIG_LVL'] = 'null' # Set the rgb file name env['RGB_FILE'] = env['DIAG_HOME'] + '/rgb/amwg.rgb' if 'default' in env['color_bar']: env['RGB_FILE'] = env['DIAG_HOME'] + '/rgb/amwg.rgb' elif 'blue_red' in env['color_bar']: env['RGB_FILE'] = env['DIAG_HOME'] + '/rgb/bluered.rgb' elif 'blue_yellow_red' in env['color_bar']: env['RGB_FILE'] = env['DIAG_HOME'] + '/rgb/blueyellowred.rgb' # Set Paleo variables env['PALEO'] = env['paleo'] if env['PALEO'] == 'True': env['DIFF_PLOTS'] = env['diff_plots'] # Test coastlines env['MODELFILE'] = env['test_path_climo'] + '/' + env[ 'test_casename'] + '_ANN_climo.nc' env['LANDMASK'] = env['land_mask1'] env['PALEODATA'] = env['test_path_climo'] + '/' + env[ 'test_casename'] if scomm.is_manager(): rc, err_msg = cesmEnvLib.checkFile(env['PALEODATA'], 'read') if not rc: diagUtilsLib.generate_ncl_plots(env, 'plot_paleo.ncl') env['PALEOCOAST1'] = env['PALEODATA'] # Cntl coastlines env['MODELFILE'] = env['cntl_path_climo'] + '/' + env[ 'cntl_casename'] + '_ANN_climo.nc' env['LANDMASK'] = env['land_mask2'] env['PALEODATA'] = env['cntl_path_climo'] + '/' + env[ 'cntl_casename'] if scomm.is_manager(): rc, err_msg = cesmEnvLib.checkFile(env['PALEODATA'], 'read') if not rc: diagUtilsLib.generate_ncl_plots(env, 'plot_paleo.ncl') env['PALEOCOAST2'] = env['PALEODATA'] else: env['PALEOCOAST1'] = 'null' env['PALEOCOAST2'] = 'null' env['DIFF_PLOTS'] = 'False' env['USE_WACCM_LEVS'] = 'False' scomm.sync() return env
def run_diagnostics(self, env, scomm): """ call the necessary plotting routines to generate diagnostics plots """ super(modelVsModel, self).run_diagnostics(env, scomm) scomm.sync() # setup some global variables requested_plot_sets = list() local_requested_plots = list() local_html_list = list() # all the plot module XML vars start with 'set_' need to strip that off for key, value in env.iteritems(): if ("wset_" in key and (value == 'True' or env['all_waccm_sets'] == 'True')): requested_plot_sets.append(key) elif ("cset_" in key and (value == 'True' or env['all_chem_sets'] == 'True')): requested_plot_sets.append(key) elif ("set_" in key and (value == 'True' or env['all_sets'] == 'True')): if ("wset_" not in key and "cset_" not in key): requested_plot_sets.append(key) scomm.sync() # partition requested plots to all tasks # first, create plotting classes and get the number of plots each will created requested_plots = {} set_sizes = {} plots_weights = [] for plot_set in requested_plot_sets: requested_plots.update( atm_diags_plot_factory.atmosphereDiagnosticPlotFactory( plot_set, env)) for plot_id, plot_class in requested_plots.iteritems(): if hasattr(plot_class, 'weight'): factor = plot_class.weight else: factor = 1 plots_weights.append( (plot_id, len(plot_class.expectedPlots) * factor)) # partition based on the number of plots each set will create local_plot_list = scomm.partition(plots_weights, func=partition.WeightBalanced(), involved=True) timer = timekeeper.TimeKeeper() # loop over local plot lists - set env and then run plotting script #for plot_id,plot_class in local_plot_list.interitems(): timer.start(str(scomm.get_rank()) + "ncl total time on task") for plot_set in local_plot_list: timer.start(str(scomm.get_rank()) + plot_set) plot_class = requested_plots[plot_set] # set all env variables (global and particular to this plot call plot_class.check_prerequisites(env) # Stringify the env dictionary for name, value in plot_class.plot_env.iteritems(): plot_class.plot_env[name] = str(value) # call script to create plots for script in plot_class.ncl_scripts: diagUtilsLib.generate_ncl_plots(plot_class.plot_env, script) plot_class.plot_env['NCDF_MODE'] = 'write' plot_class.plot_env['VAR_MODE'] = 'write' timer.stop(str(scomm.get_rank()) + plot_set) timer.stop(str(scomm.get_rank()) + "ncl total time on task") scomm.sync() print(timer.get_all_times()) w = 0 for p in plots_weights: if p[0] in local_plot_list: w = w + p[1] print(str(scomm.get_rank()) + ' weight:' + str(w)) # set html files if scomm.is_manager(): env['HTML_HOME'] = env['DIAG_HOME'] + '/html/model1-model2/' # Get web dir name and create it if it does not exist #web_dir = '{0}/{1}-{2}'.format(env['test_path_diag'], env['test_casename'], env['cntl_casename']) web_dir = env['test_path_diag'] #if not os.path.exists(web_dir): # os.makedirs(web_dir) # Copy over some files needed by web pages if not os.path.exists(web_dir + '/images'): os.mkdir(web_dir + '/images') diag_imgs = glob.glob(env['DIAG_HOME'] + '/html/images/*') for img in diag_imgs: shutil.copy(img, web_dir + '/images/') # Create set dirs, copy plots to set dir, and create html file for set requested_plot_sets.append( 'sets') # Add 'sets' to create top level html files for plot_set in requested_plot_sets: if 'set_5' == plot_set or 'set_6' == plot_set: glob_set = plot_set.replace('_', '') plot_set = 'set5_6' elif 'set_1' == plot_set: glob_set = 'table_' plot_set = plot_set.replace('_', '') elif 'sets' == plot_set: set_dir = web_dir + '/' else: plot_set = plot_set.replace('_', '') glob_set = plot_set if 'sets' not in plot_set: #'sets' is top level, don't create directory or copy images files set_dir = web_dir + '/' + plot_set # Create the plot set web directory if not os.path.exists(set_dir): os.makedirs(set_dir) # Copy plots into the correct web dir glob_string = env['test_path_diag'] + '/' + glob_set + '*.*' imgs = glob.glob(glob_string) if imgs > 0: for img in imgs: new_fn = set_dir + '/' + os.path.basename(img) os.rename(img, new_fn) # Copy/Process html files if 'sets' in plot_set: orig_html = env['HTML_HOME'] + '/' + plot_set else: orig_html = env[ 'HTML_HOME'] + '/' + plot_set + '/' + plot_set create_atm_html.create_plotset_html(orig_html, set_dir, plot_set, env, 'model_vs_model') # Remove any plotvar netcdf files that exists in the diag directory if env['save_ncdfs'] == 'False': cesmEnvLib.purge(env['test_path_diag'], '.*\.nc') cesmEnvLib.purge(env['test_path_diag'], '/station_ids') # move all the plots to the diag_path with the years appended to the path endYr1 = (int(env['test_first_yr']) + int(env['test_nyrs'])) - 1 endYr2 = (int(env['cntl_first_yr']) + int(env['cntl_nyrs'])) - 1 diag_path = '{0}/diag/{1}.{2}_{3}-{4}.{5}_{6}'.format( env['OUTPUT_ROOT_PATH'], env['test_casename'], env['test_first_yr'], str(endYr1), env['cntl_casename'], env['cntl_first_yr'], str(endYr2)) move_files = True try: os.makedirs(diag_path) except OSError as exception: if exception.errno != errno.EEXIST: err_msg = 'ERROR: {0} problem accessing directory {1}'.format( self.__class__.__name__, diag_path) raise OSError(err_msg) move_files = False elif env['CLEANUP_FILES'].lower() in ['t', 'true']: # delete all the files in the diag_path directory for root, dirs, files in os.walk('diag_path'): for f in files: os.unlink(os.path.join(root, f)) for d in dirs: shutil.rmtree(os.path.join(root, d)) elif env['CLEANUP_FILES'].lower() in ['f', 'false']: print( 'WARNING: {0} exists and is not empty and ATMDIAG_CLEANUP_FILES = False. Leaving new diagnostics files in {1}' .format(diag_path, web_dir)) diag_path = web_dir move_files = False # move the files to the new diag_path if move_files: try: print('DEBUG: model_vs_model renaming web files') os.rename(web_dir, diag_path) except OSError as e: print('WARNING: Error renaming %s to %s: %s' % (web_dir, diag_path, e)) diag_path = web_dir # setup the unique ATMDIAG_WEBDIR_MODEL_VS_OBS output file env_file = '{0}/env_diags_atm.xml'.format(env['PP_CASE_PATH']) key = 'ATMDIAG_WEBDIR_{0}'.format(self._name) value = diag_path ##web_file = '{0}/web_dirs/{1}.{2}-{3}'.format(env['PP_CASE_PATH'], key, scomm.get_size(), scomm.get_rank() ) web_file = '{0}/web_dirs/{1}.{2}'.format( env['PP_CASE_PATH'], key, datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')) try: diagUtilsLib.write_web_file(web_file, 'atm', key, value) except: print( 'WARNING atm model_vs_model unable to write {0}={1} to {2}' .format(key, value, web_file)) print( '*******************************************************************************' ) print( 'Successfully completed generating atmosphere diagnostics model vs. model plots' ) print( '*******************************************************************************' )
def run_diagnostics(self, env, scomm): """ call the necessary plotting routines to generate diagnostics plots """ super(modelVsModel, self).run_diagnostics(env, scomm) scomm.sync() # setup some global variables requested_plot_sets = list() local_requested_plots = list() local_html_list = list() # all the plot module XML vars start with 'set_' need to strip that off for key, value in env.iteritems(): if ("PLOT_" in key and value == 'True'): ## if ("DIFF" in key or 'PLOT_REGIONS' in key): if ("DIFF" in key): requested_plot_sets.append(key) scomm.sync() # partition requested plots to all tasks # first, create plotting classes and get the number of plots each will created requested_plots = {} set_sizes = {} for plot_set in requested_plot_sets: requested_plots.update( ice_diags_plot_factory.iceDiagnosticPlotFactory(plot_set, env)) # partition based on the number of plots each set will create local_plot_list = scomm.partition(requested_plots.keys(), func=partition.EqualStride(), involved=True) timer = timekeeper.TimeKeeper() # loop over local plot lists - set env and then run plotting script #for plot_id,plot_class in local_plot_list.interitems(): timer.start(str(scomm.get_rank()) + "ncl total time on task") for plot_set in local_plot_list: timer.start(str(scomm.get_rank()) + plot_set) plot_class = requested_plots[plot_set] # set all env variables (global and particular to this plot call plot_class.check_prerequisites(env) # Stringify the env dictionary for name, value in plot_class.plot_env.iteritems(): plot_class.plot_env[name] = str(value) # call script to create plots for script in plot_class.ncl_scripts: diagUtilsLib.generate_ncl_plots(plot_class.plot_env, script) timer.stop(str(scomm.get_rank()) + plot_set) timer.stop(str(scomm.get_rank()) + "ncl total time on task") scomm.sync() print(timer.get_all_times()) # set html files if scomm.is_manager(): # Setup (local) web directories env['HTML_HOME'] = env['POSTPROCESS_PATH'] + '/ice_diag/web/' web_dir = env['WKDIR'] + '/yrs' + env['BEGYR_CONT'] + '-' + env[ 'ENDYR_CONT'] if env['CLEANUP_FILES'].lower() in ['t', 'true' ] and os.path.exists(web_dir): shutil.rmtree(web_dir) if not os.path.exists(web_dir): os.mkdir(web_dir) if not os.path.exists(web_dir + '/contour'): os.mkdir(web_dir + '/contour') if not os.path.exists(web_dir + '/vector'): os.mkdir(web_dir + '/vector') if not os.path.exists(web_dir + '/line'): os.mkdir(web_dir + '/line') if not os.path.exists(web_dir + '/obs'): os.mkdir(web_dir + '/obs') # Move images tot the oppropriate directories plot_dir_map = { 'icesat': 'obs', 'ASPeCt': 'obs', 'diff_con_': 'contour', 'diff_vec_': 'vector', 'line': 'line', 'clim': 'line' } for key, dir in plot_dir_map.iteritems(): glob_string = env['WKDIR'] + '/*' + key + '*.png' imgs = glob.glob(glob_string) if imgs > 0: for img in imgs: new_fn = web_dir + '/' + dir + '/' + os.path.basename( img) os.rename(img, new_fn) # Create/format the html files and copy txt and map files shutil.copy(env['HTML_HOME'] + '/ICESat.txt', web_dir + '/obs/ICESat.txt') shutil.copy(env['HTML_HOME'] + '/ASPeCt.txt', web_dir + '/obs/ASPeCt.txt') glob_string = env['HTML_HOME'] + '/maps/*' maps = glob.glob(glob_string) for map in maps: mn = os.path.basename(map) shutil.copy(map, web_dir + '/' + mn) print('DEBUG: model_vs_model web_dir = {0}'.format(web_dir)) html_dir = env['HTML_HOME'] create_ice_html.create_plotset_html( html_dir + '/index_diff_temp.html', web_dir + '/index.html', env) create_ice_html.create_plotset_html( html_dir + '/contour_diff.html', web_dir + '/contour.html', env) create_ice_html.create_plotset_html( html_dir + '/timeseries_diff.html', web_dir + '/timeseries.html', env) create_ice_html.create_plotset_html( html_dir + '/regional_diff.html', web_dir + '/regional.html', env) create_ice_html.create_plotset_html(html_dir + '/vector_diff.html', web_dir + '/vector.html', env) # setup the unique ICEDIAG_WEBDIR_MODEL_VS_MODEL output file env_file = '{0}/env_diags_ice.xml'.format(env['PP_CASE_PATH']) key = 'ICEDIAG_WEBDIR_{0}'.format(self._name) value = env['WKDIR'] ##web_file = '{0}/web_dirs/{1}.{2}-{3}'.format(env['PP_CASE_PATH'], key, scomm.get_size(), scomm.get_rank() ) web_file = '{0}/web_dirs/{1}.{2}'.format( env['PP_CASE_PATH'], key, datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')) try: diagUtilsLib.write_web_file(web_file, 'ice', key, value) except: print( 'WARNING ice model_vs_model unable to write {0}={1} to {2}' .format(key, value, web_file)) print( '*******************************************************************************' ) print( 'Successfully completed generating ice diagnostics model vs. model plots' ) print( '*******************************************************************************' )
def check_prerequisites(self, env, scomm): """ check prerequisites """ print(" Checking prerequisites for : {0}".format(self.__class__.__name__)) super(modelVsModel, self).check_prerequisites(env, scomm) # Set some new env variables env['DIAG_CODE'] = env['NCLPATH'] env['test_path_diag'] = '{0}/{1}-{2}/'.format(env['test_path_diag'], env['test_casename'], env['cntl_casename']) env['WKDIR'] = env['test_path_diag'] env['WORKDIR'] = env['test_path_diag'] if scomm.is_manager(): if not os.path.exists(env['WKDIR']): os.makedirs(env['WKDIR']) env['COMPARE'] = env['CNTL'] env['PLOTTYPE'] = env['p_type'] env['COLORTYPE'] = env['c_type'] env['MG_MICRO'] = env['microph'] env['TIMESTAMP'] = env['time_stamp'] env['TICKMARKS'] = env['tick_marks'] if env['custom_names'] == 'True': env['CASENAMES'] = 'True' env['CASE1'] = env['test_name'] env['CASE2'] = env['cntl_name'] else: env['CASENAMES'] = 'False' env['CASE1'] = 'null' env['CASE2'] = 'null' env['CNTL_PLOTVARS'] = 'null' env['test_in'] = env['test_path_climo'] + env['test_casename'] env['test_out'] = env['test_path_climo'] + env['test_casename'] env['cntl_in'] = env['cntl_path_climo'] + env['cntl_casename'] env['cntl_out'] = env['cntl_path_climo'] + env['cntl_casename'] env['seas'] = [] if env['plot_ANN_climo'] == 'True': env['seas'].append('ANN') if env['plot_DJF_climo'] == 'True': env['seas'].append('DJF') if env['plot_MAM_climo'] == 'True': env['seas'].append('MAM') if env['plot_JJA_climo'] == 'True': env['seas'].append('JJA') if env['plot_SON_climo'] == 'True': env['seas'].append('SON') # Significance vars if env['significance'] == 'True': env['SIG_PLOT'] = 'True' env['SIG_LVL'] = env['sig_lvl'] else: env['SIG_PLOT'] = 'False' env['SIG_LVL'] = 'null' # Set the rgb file name env['RGB_FILE'] = env['DIAG_HOME']+'/rgb/amwg.rgb' if 'default' in env['color_bar']: env['RGB_FILE'] = env['DIAG_HOME']+'/rgb/amwg.rgb' elif 'blue_red' in env['color_bar']: env['RGB_FILE'] = env['DIAG_HOME']+'/rgb/bluered.rgb' elif 'blue_yellow_red' in env['color_bar']: env['RGB_FILE'] = env['DIAG_HOME']+'/rgb/blueyellowred.rgb' # Set Paleo variables env['PALEO'] = env['paleo'] if env['PALEO'] == 'True': env['DIFF_PLOTS'] = env['diff_plots'] # Test coastlines env['MODELFILE'] = env['test_path_climo']+'/'+env['test_casename']+'_ANN_climo.nc' env['LANDMASK'] = env['land_mask1'] env['PALEODATA'] = env['test_path_climo']+'/'+env['test_casename'] if scomm.is_manager(): rc, err_msg = cesmEnvLib.checkFile(env['PALEODATA'],'read') if not rc: diagUtilsLib.generate_ncl_plots(env,'plot_paleo.ncl') env['PALEOCOAST1'] = env['PALEODATA'] # Cntl coastlines env['MODELFILE'] = env['cntl_path_climo']+'/'+env['cntl_casename']+'_ANN_climo.nc' env['LANDMASK'] = env['land_mask2'] env['PALEODATA'] = env['cntl_path_climo']+'/'+env['cntl_casename'] if scomm.is_manager(): rc, err_msg = cesmEnvLib.checkFile(env['PALEODATA'],'read') if not rc: diagUtilsLib.generate_ncl_plots(env,'plot_paleo.ncl') env['PALEOCOAST2'] = env['PALEODATA'] else: env['PALEOCOAST1'] = 'null' env['PALEOCOAST2'] = 'null' env['DIFF_PLOTS'] = 'False' env['USE_WACCM_LEVS'] = 'False' scomm.sync() return env
def run_diagnostics(self, env, scomm): """ call the necessary plotting routines to generate diagnostics plots """ super(modelVsModel, self).run_diagnostics(env, scomm) scomm.sync() # setup some global variables requested_plot_sets = list() local_requested_plots = list() local_html_list = list() # all the plot module XML vars start with 'set_' need to strip that off for key, value in env.iteritems(): if ("wset_"in key and (value == 'True' or env['all_waccm_sets'] == 'True')): requested_plot_sets.append(key) elif ("cset_"in key and (value == 'True' or env['all_chem_sets'] == 'True')): requested_plot_sets.append(key) elif ("set_" in key and (value == 'True' or env['all_sets'] == 'True')): if ("wset_" not in key and "cset_" not in key): requested_plot_sets.append(key) scomm.sync() # partition requested plots to all tasks # first, create plotting classes and get the number of plots each will created requested_plots = {} set_sizes = {} plots_weights = [] for plot_set in requested_plot_sets: requested_plots.update(atm_diags_plot_factory.atmosphereDiagnosticPlotFactory(plot_set,env)) for plot_id,plot_class in requested_plots.iteritems(): if hasattr(plot_class, 'weight'): factor = plot_class.weight else: factor = 1 plots_weights.append((plot_id,len(plot_class.expectedPlots)*factor)) # partition based on the number of plots each set will create local_plot_list = scomm.partition(plots_weights, func=partition.WeightBalanced(), involved=True) timer = timekeeper.TimeKeeper() # loop over local plot lists - set env and then run plotting script #for plot_id,plot_class in local_plot_list.interitems(): timer.start(str(scomm.get_rank())+"ncl total time on task") for plot_set in local_plot_list: timer.start(str(scomm.get_rank())+plot_set) plot_class = requested_plots[plot_set] # set all env variables (global and particular to this plot call plot_class.check_prerequisites(env) # Stringify the env dictionary for name,value in plot_class.plot_env.iteritems(): plot_class.plot_env[name] = str(value) # call script to create plots for script in plot_class.ncl_scripts: diagUtilsLib.generate_ncl_plots(plot_class.plot_env,script) plot_class.plot_env['NCDF_MODE'] = 'write' plot_class.plot_env['VAR_MODE'] = 'write' timer.stop(str(scomm.get_rank())+plot_set) timer.stop(str(scomm.get_rank())+"ncl total time on task") scomm.sync() print(timer.get_all_times()) w = 0 for p in plots_weights: if p[0] in local_plot_list: w = w + p[1] print(str(scomm.get_rank())+' weight:'+str(w)) # set html files if scomm.is_manager(): env['HTML_HOME'] = env['DIAG_HOME']+'/html/model1-model2/' # Get web dir name and create it if it does not exist #web_dir = '{0}/{1}-{2}'.format(env['test_path_diag'], env['test_casename'], env['cntl_casename']) web_dir = env['test_path_diag'] #if not os.path.exists(web_dir): # os.makedirs(web_dir) # Copy over some files needed by web pages if not os.path.exists(web_dir+'/images'): os.mkdir(web_dir+'/images') diag_imgs = glob.glob(env['DIAG_HOME']+'/html/images/*') for img in diag_imgs: shutil.copy(img,web_dir+'/images/') # Create set dirs, copy plots to set dir, and create html file for set requested_plot_sets.append('sets') # Add 'sets' to create top level html files glob_set = list() for plot_set in requested_plot_sets: if 'set_5' == plot_set or 'set_6' == plot_set: glob_set.append(plot_set.replace('_','')) plot_set = 'set5_6' elif 'cset_1' == plot_set: glob_set.append('table_soa') glob_set.append('table_chem') plot_set = plot_set.replace('_','') elif 'set_1' == plot_set: glob_set.append('table_GLBL') glob_set.append('table_NEXT') glob_set.append('table_SEXT') glob_set.append('table_TROP') plot_set = plot_set.replace('_','') elif 'sets' == plot_set: set_dir = web_dir + '/' else: glob_set.append(plot_set.replace('_','')) plot_set = plot_set.replace('_','') if 'sets' not in plot_set: #'sets' is top level, don't create directory or copy images files set_dir = web_dir + '/' + plot_set # Create the plot set web directory if not os.path.exists(set_dir): os.makedirs(set_dir) # Copy plots into the correct web dir for gs in glob_set: glob_string = env['test_path_diag']+'/'+gs+'*.*' imgs = glob.glob(glob_string) if imgs > 0: for img in imgs: new_fn = set_dir + '/' + os.path.basename(img) os.rename(img,new_fn) # Copy/Process html files if 'sets' in plot_set: orig_html = env['HTML_HOME']+'/'+plot_set else: orig_html = env['HTML_HOME']+'/'+plot_set+'/'+plot_set create_atm_html.create_plotset_html(orig_html,set_dir,plot_set,env,'model_vs_model') # Remove any plotvar netcdf files that exists in the diag directory if env['save_ncdfs'] == 'False': cesmEnvLib.purge(env['test_path_diag'], '.*\.nc') cesmEnvLib.purge(env['test_path_diag'], '/station_ids') # move all the plots to the diag_path with the years appended to the path endYr1 = (int(env['test_first_yr']) + int(env['test_nyrs'])) - 1 endYr2 = (int(env['cntl_first_yr']) + int(env['cntl_nyrs'])) - 1 diag_path = '{0}/diag/{1}.{2}_{3}-{4}.{5}_{6}'.format(env['OUTPUT_ROOT_PATH'], env['test_casename'], env['test_first_yr'], str(endYr1), env['cntl_casename'], env['cntl_first_yr'], str(endYr2)) move_files = True try: os.makedirs(diag_path) except OSError as exception: if exception.errno != errno.EEXIST: err_msg = 'ERROR: {0} problem accessing directory {1}'.format(self.__class__.__name__, diag_path) raise OSError(err_msg) move_files = False elif env['CLEANUP_FILES'].lower() in ['t','true']: # delete all the files in the diag_path directory for root, dirs, files in os.walk(diag_path): for f in files: os.unlink(os.path.join(root, f)) for d in dirs: shutil.rmtree(os.path.join(root, d)) elif env['CLEANUP_FILES'].lower() in ['f','false']: print('WARNING: {0} exists and is not empty and ATMDIAG_CLEANUP_FILES = False. Leaving new diagnostics files in {1}'.format(diag_path, web_dir)) diag_path = web_dir move_files = False print('DEBUG: model vs. model web_dir = {0}'.format(web_dir)) print('DEBUG: model vs. model diag_path = {0}'.format(diag_path)) # move the files to the new diag_path if move_files: try: print('DEBUG: model_vs_model renaming web files') os.rename(web_dir, diag_path) except OSError as e: print ('WARNING: Error renaming %s to %s: %s' % (web_dir, diag_path, e)) diag_path = web_dir # setup the unique ATMDIAG_WEBDIR_MODEL_VS_OBS output file env_file = '{0}/env_diags_atm.xml'.format(env['PP_CASE_PATH']) key = 'ATMDIAG_WEBDIR_{0}'.format(self._name) value = diag_path web_file = '{0}/web_dirs/{1}.{2}'.format(env['PP_CASE_PATH'], key, datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')) try: diagUtilsLib.write_web_file(web_file, 'atm', key, value) except: print('WARNING atm model_vs_model unable to write {0}={1} to {2}'.format(key, value, web_file)) print('*******************************************************************************') print('Successfully completed generating atmosphere diagnostics model vs. model plots') print('*******************************************************************************')
def run_diagnostics(self, env, scomm): """ call the necessary plotting routines to generate diagnostics plots """ super(modelVsModel, self).run_diagnostics(env, scomm) scomm.sync() # setup some global variables requested_plot_sets = list() local_requested_plots = list() local_html_list = list() # all the plot module XML vars start with 'set_' for key, value in env.iteritems(): if ("set_" in key and value == 'True'): requested_plot_sets.append(key) scomm.sync() if scomm.is_manager(): print('DEBUG model_vs_model requested_plot_sets = {0}'.format( requested_plot_sets)) # partition requested plots to all tasks # first, create plotting classes and get the number of plots each will created requested_plots = {} set_sizes = {} #plots_weights = [] for plot_set in requested_plot_sets: requested_plots.update( lnd_diags_plot_factory.LandDiagnosticPlotFactory( plot_set, env)) #for plot_id,plot_class in requested_plots.iteritems(): # if hasattr(plot_class, 'weight'): # factor = plot_class.weight # else: # factor = 1 # plots_weights.append((plot_id,len(plot_class.expectedPlots)*factor)) # partition based on the number of plots each set will create #local_plot_list = scomm.partition(plots_weights, func=partition.WeightBalanced(), involved=True) if scomm.is_manager(): print('DEBUG model_vs_model requested_plots.keys = {0}'.format( requested_plots.keys())) local_plot_list = scomm.partition(requested_plots.keys(), func=partition.EqualStride(), involved=True) scomm.sync() timer = timekeeper.TimeKeeper() # loop over local plot lists - set env and then run plotting script timer.start(str(scomm.get_rank()) + "ncl total time on task") for plot_set in local_plot_list: timer.start(str(scomm.get_rank()) + plot_set) plot_class = requested_plots[plot_set] # set all env variables (global and particular to this plot call print( 'model vs. model - Checking prerequisite for {0} on rank {1}'. format(plot_class.__class__.__name__, scomm.get_rank())) plot_class.check_prerequisites(env) # Stringify the env dictionary for name, value in plot_class.plot_env.iteritems(): plot_class.plot_env[name] = str(value) # call script to create plots for script in plot_class.ncl_scripts: print( 'model vs. model - Generating plots for {0} on rank {1} with script {2}' .format(plot_class.__class__.__name__, scomm.get_rank(), script)) diagUtilsLib.generate_ncl_plots(plot_class.plot_env, script) timer.stop(str(scomm.get_rank()) + plot_set) timer.stop(str(scomm.get_rank()) + "ncl total time on task") scomm.sync() print(timer.get_all_times()) #w = 0 #for p in plots_weights: # if p[0] in local_plot_list: # w = w + p[1] #print(str(scomm.get_rank())+' weight:'+str(w)) # set html files if scomm.is_manager(): # Create web dirs and move images/tables to that web dir for n in ('1', '2', '3', '4', '5', '6', '7', '8', '9'): web_dir = env['WKDIR'] set_dir = web_dir + '/set' + n # Create the plot set web directory if not os.path.exists(set_dir): os.makedirs(set_dir) # Copy plots into the correct web dir glob_string = web_dir + '/set' + n + '_*' imgs = glob.glob(glob_string) if len(imgs) > 0: for img in imgs: new_fn = set_dir + '/' + os.path.basename(img) os.rename(img, new_fn) # Copy the set1Diff and set1Anom plots to set_1 web dir if n == '1': glob_string = web_dir + '/set1Diff' + '_*' imgs = glob.glob(glob_string) if len(imgs) > 0: for img in imgs: new_fn = set_dir + '/' + os.path.basename(img) os.rename(img, new_fn) glob_string = web_dir + '/set1Anom' + '_*' imgs = glob.glob(glob_string) if len(imgs) > 0: for img in imgs: new_fn = set_dir + '/' + os.path.basename(img) os.rename(img, new_fn) env['WEB_DIR'] = web_dir shutil.copy2( env['POSTPROCESS_PATH'] + '/lnd_diag/inputFiles/' + env['VAR_MASTER'], web_dir + '/variable_master.ncl') if n == '9': web_script = env[ 'POSTPROCESS_PATH'] + '/lnd_diag/shared/lnd_statTable.pl' rc2, err_msg = cesmEnvLib.checkFile(web_script, 'read') if rc2: try: subprocess.check_call(web_script) except subprocess.CalledProcessError as e: print('WARNING: {0} error executing command:'.format( web_script)) print(' {0}'.format(e.cmd)) print(' rc = {0}'.format(e.returncode)) else: print('{0}... {1} file not found'.format( err_msg, web_script)) # copy the set9_statTable.html to the set9 subdir set9_statTable = web_dir + '/set9_statTable.html' rc2, err_msg = cesmEnvLib.checkFile(set9_statTable, 'read') if rc2: new_fn = web_dir + '/set9/' + os.path.basename( set9_statTable) try: os.rename(set9_statTable, new_fn) except os.OSError as e: print('WARNING: rename error for file {0}'.format( set9_statTable)) print(' rc = {0}'.format(e.returncode)) else: print('{0}... {1} file not found'.format( err_msg, set9_statTable)) web_script_1 = env[ 'POSTPROCESS_PATH'] + '/lnd_diag/shared/lnd_create_webpage.pl' web_script_2 = env[ 'POSTPROCESS_PATH'] + '/lnd_diag/shared/lnd_lookupTable.pl' print('Creating Web Pages') # set the shell environment cesmEnvLib.setXmlEnv(env) # lnd_create_webpage.pl call rc1, err_msg = cesmEnvLib.checkFile(web_script_1, 'read') if rc1: try: subprocess.check_call(web_script_1) except subprocess.CalledProcessError as e: print('WARNING: {0} error executing command:'.format( web_script_1)) print(' {0}'.format(e.cmd)) print(' rc = {0}'.format(e.returncode)) else: print('{0}... {1} file not found'.format( err_msg, web_script_1)) # lnd_lookupTable.pl call rc2, err_msg = cesmEnvLib.checkFile(web_script_2, 'read') if rc2: try: subprocess.check_call(web_script_2) except subprocess.CalledProcessError as e: print('WARNING: {0} error executing command:'.format( web_script_2)) print(' {0}'.format(e.cmd)) print(' rc = {0}'.format(e.returncode)) else: print('{0}... {1} file not found'.format( err_msg, web_script_2)) # move all the plots to the diag_path with the years appended to the path endYr1 = (int(env['clim_first_yr_1']) + int(env['clim_num_yrs_1'])) - 1 endYr2 = (int(env['clim_first_yr_2']) + int(env['clim_num_yrs_2'])) - 1 diag_path = '{0}/diag/{1}.{2}_{3}-{4}.{5}_{6}'.format( env['OUTPUT_ROOT_PATH'], env['caseid_1'], env['clim_first_yr_1'], str(endYr1), env['caseid_2'], env['clim_first_yr_2'], str(endYr2)) move_files = True try: os.makedirs(diag_path) except OSError as exception: if exception.errno != errno.EEXIST: err_msg = 'ERROR: {0} problem accessing directory {1}'.format( self.__class__.__name__, diag_path) raise OSError(err_msg) move_files = False elif env['CLEANUP_FILES'].lower() in ['t', 'true']: # delete all the files in the diag_path directory for root, dirs, files in os.walk('diag_path'): for f in files: os.unlink(os.path.join(root, f)) for d in dirs: shutil.rmtree(os.path.join(root, d)) elif env['CLEANUP_FILES'].lower() in ['f', 'false']: print( 'WARNING: {0} exists and is not empty and LNDDIAG_CLEANUP_FILES = False. Leaving new diagnostics files in {1}' .format(diag_path, web_dir)) diag_path = web_dir move_files = False # move the files to the new diag_path if move_files: try: print('DEBUG: model_vs_model renaming web files') os.rename(web_dir, diag_path) except OSError as e: print('WARNING: Error renaming %s to %s: %s' % (web_dir, diag_path, e)) diag_path = web_dir print('DEBUG: model vs. model web_dir = {0}'.format(web_dir)) print('DEBUG: model vs. model diag_path = {0}'.format(diag_path)) # setup the unique LNDDIAG_WEBDIR_MODEL_VS_MODEL output file env_file = '{0}/env_diags_lnd.xml'.format(env['PP_CASE_PATH']) key = 'LNDDIAG_WEBDIR_{0}'.format(self._name) value = diag_path ##web_file = '{0}/web_dirs/{1}.{2}-{3}'.format(env['PP_CASE_PATH'], key, scomm.get_size(), scomm.get_rank() ) web_file = '{0}/web_dirs/{1}.{2}'.format( env['PP_CASE_PATH'], key, datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')) try: diagUtilsLib.write_web_file(web_file, 'lnd', key, value) except: print( 'WARNING lnd model_vs_model unable to write {0}={1} to {2}' .format(key, value, web_file)) print( '*******************************************************************************' ) print( 'Successfully completed generating land diagnostics model vs. model plots' ) print( '*******************************************************************************' )
def run_diagnostics(self, env, scomm): """ call the necessary plotting routines to generate diagnostics plots """ super(modelVsObs, self).run_diagnostics(env, scomm) scomm.sync() # setup some global variables requested_plot_sets = list() local_requested_plots = list() local_html_list = list() # all the plot module XML vars start with 'set_' for key, value in env.iteritems(): if ("set_" in key and value == 'True'): requested_plot_sets.append(key) scomm.sync() if scomm.is_manager(): print('DEBUG model_vs_obs requested_plot_sets = {0}'.format(requested_plot_sets)) # partition requested plots to all tasks # first, create plotting classes and get the number of plots each will created requested_plots = {} set_sizes = {} #plots_weights = [] for plot_set in requested_plot_sets: requested_plots.update(lnd_diags_plot_factory.LandDiagnosticPlotFactory(plot_set,env)) #for plot_id,plot_class in requested_plots.iteritems(): # if hasattr(plot_class, 'weight'): # factor = plot_class.weight # else: # factor = 1 # plots_weights.append((plot_id,len(plot_class.expectedPlots)*factor)) # partition based on the number of plots each set will create #local_plot_list = scomm.partition(plots_weights, func=partition.WeightBalanced(), involved=True) local_plot_list = scomm.partition(requested_plots.keys(), func=partition.EqualStride(), involved=True) scomm.sync() timer = timekeeper.TimeKeeper() # loop over local plot lists - set env and then run plotting script timer.start(str(scomm.get_rank())+"ncl total time on task") for plot_set in local_plot_list: timer.start(str(scomm.get_rank())+plot_set) plot_class = requested_plots[plot_set] print('DEBUG model vs. obs - Checking prerequisite for {0} on rank {1}'.format(plot_class.__class__.__name__, scomm.get_rank())) plot_class.check_prerequisites(env) # Stringify the env dictionary for name, value in plot_class.plot_env.iteritems(): plot_class.plot_env[name] = str(value) # call script to create plots for script in plot_class.ncl_scripts: print('DEBUG model vs. obs - Generating plots for {0} on rank {1} with script {2}'.format(plot_class.__class__.__name__, scomm.get_rank(),script)) diagUtilsLib.generate_ncl_plots(plot_class.plot_env, script) timer.stop(str(scomm.get_rank())+plot_set) timer.stop(str(scomm.get_rank())+"ncl total time on task") scomm.sync() print(timer.get_all_times()) #w = 0 #for p in plots_weights: # if p[0] in local_plot_list: # w = w + p[1] #print(str(scomm.get_rank())+' weight:'+str(w)) # set html files if scomm.is_manager(): # Create web dirs and move images/tables to that web dir for n in ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'): web_dir = env['WKDIR'] set_dir = web_dir + '/set' + n # Create the plot set web directory if not os.path.exists(set_dir): os.makedirs(set_dir) # Copy plots into the correct web dir glob_string = web_dir+'/set'+n+'_*' imgs = glob.glob(glob_string) if len(imgs) > 0: for img in imgs: new_fn = set_dir + '/' + os.path.basename(img) os.rename(img,new_fn) env['WEB_DIR'] = web_dir shutil.copy2(env['POSTPROCESS_PATH']+'/lnd_diag/inputFiles/'+env['VAR_MASTER'],web_dir+'/variable_master.ncl') web_script_1 = env['POSTPROCESS_PATH']+'/lnd_diag/shared/lnd_create_webpage.pl' web_script_2 = env['POSTPROCESS_PATH']+'/lnd_diag/shared/lnd_lookupTable.pl' print('Creating Web Pages') # set the shell environment cesmEnvLib.setXmlEnv(env) # lnd_create_webpage.pl call rc1, err_msg = cesmEnvLib.checkFile(web_script_1,'read') if rc1: try: subprocess.check_call(web_script_1) except subprocess.CalledProcessError as e: print('WARNING: {0} error executing command:'.format(web_script_1)) print(' {0}'.format(e.cmd)) print(' rc = {0}'.format(e.returncode)) else: print('{0}... {1} file not found'.format(err_msg,web_script_1)) # lnd_lookupTable.pl call rc2, err_msg = cesmEnvLib.checkFile(web_script_2,'read') if rc2: try: subprocess.check_call(web_script_2) except subprocess.CalledProcessError as e: print('WARNING: {0} error executing command:'.format(web_script_2)) print(' {0}'.format(e.cmd)) print(' rc = {0}'.format(e.returncode)) else: print('{0}... {1} file not found'.format(err_msg,web_script_2)) # move all the plots to the diag_path with the years appended to the path endYr = (int(env['clim_first_yr_1']) + int(env['clim_num_yrs_1'])) - 1 diag_path = '{0}/diag/{1}-obs.{2}_{3}'.format(env['OUTPUT_ROOT_PATH'], env['caseid_1'], env['clim_first_yr_1'], str(endYr)) move_files = True try: os.makedirs(diag_path) except OSError as exception: if exception.errno != errno.EEXIST: err_msg = 'ERROR: {0} problem accessing directory {1}'.format(self.__class__.__name__, diag_path) raise OSError(err_msg) move_files = False elif env['CLEANUP_FILES'].lower() in ['t','true']: # delete all the files in the diag_path directory for root, dirs, files in os.walk(diag_path): for f in files: os.unlink(os.path.join(root, f)) for d in dirs: shutil.rmtree(os.path.join(root, d)) elif env['CLEANUP_FILES'].lower() in ['f','false']: print('WARNING: {0} exists and is not empty and LNDDIAG_CLEANUP_FILES = False. Leaving new diagnostics files in {1}'.format(diag_path, web_dir)) diag_path = web_dir move_files = False print('DEBUG: model vs. obs web_dir = {0}'.format(web_dir)) print('DEBUG: model vs. obs diag_path = {0}'.format(diag_path)) # move the files to the new diag_path if move_files: try: print('DEBUG: model_vs_obs renaming web files') os.rename(web_dir, diag_path) except OSError as e: print ('WARNING: Error renaming %s to %s: %s' % (web_dir, diag_path, e)) diag_path = web_dir # setup the LNDDIAG_WEBDIR_MODEL_VS_OBS output file env_file = '{0}/env_diags_lnd.xml'.format(env['PP_CASE_PATH']) key = 'LNDDIAG_WEBDIR_{0}'.format(self._name) value = diag_path web_file = '{0}/web_dirs/{1}.{2}'.format(env['PP_CASE_PATH'], key, datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')) try: diagUtilsLib.write_web_file(web_file, 'lnd', key, value) except: print('WARNING lnd model_vs_obs unable to write {0}={1} to {2}'.format(key, value, web_file)) print('*******************************************************************************') print('Successfully completed generating land diagnostics model vs. observation plots') print('*******************************************************************************')
def generate_plots(self, env): """generate list of NCL plotting routines """ print(' Generating diagnostic plots for : {0}'.format(self.__class__.__name__)) for ncl in self._ncl: diagUtilsLib.generate_ncl_plots(env, ncl)
def run_diagnostics(self, env, scomm): """ call the necessary plotting routines to generate diagnostics plots """ super(modelVsModel, self).run_diagnostics(env, scomm) scomm.sync() # setup some global variables requested_plot_sets = list() local_requested_plots = list() local_html_list = list() # all the plot module XML vars start with 'set_' need to strip that off for key, value in env.iteritems(): if ("PLOT_"in key and value == 'True'): ## if ("DIFF" in key or 'PLOT_REGIONS' in key): if ("DIFF" in key): requested_plot_sets.append(key) scomm.sync() # partition requested plots to all tasks # first, create plotting classes and get the number of plots each will created requested_plots = {} set_sizes = {} for plot_set in requested_plot_sets: requested_plots.update(ice_diags_plot_factory.iceDiagnosticPlotFactory(plot_set,env)) # partition based on the number of plots each set will create local_plot_list = scomm.partition(requested_plots.keys(), func=partition.EqualStride(), involved=True) timer = timekeeper.TimeKeeper() # loop over local plot lists - set env and then run plotting script #for plot_id,plot_class in local_plot_list.interitems(): timer.start(str(scomm.get_rank())+"ncl total time on task") for plot_set in local_plot_list: timer.start(str(scomm.get_rank())+plot_set) plot_class = requested_plots[plot_set] # set all env variables (global and particular to this plot call plot_class.check_prerequisites(env) # Stringify the env dictionary for name,value in plot_class.plot_env.iteritems(): plot_class.plot_env[name] = str(value) # call script to create plots for script in plot_class.ncl_scripts: diagUtilsLib.generate_ncl_plots(plot_class.plot_env,script) timer.stop(str(scomm.get_rank())+plot_set) timer.stop(str(scomm.get_rank())+"ncl total time on task") scomm.sync() print(timer.get_all_times()) # set html files if scomm.is_manager(): # Setup (local) web directories env['HTML_HOME'] = env['POSTPROCESS_PATH']+'/ice_diag/web/' web_dir = env['WKDIR']+'/yrs'+env['BEGYR_CONT']+'-'+env['ENDYR_CONT'] if env['CLEANUP_FILES'].lower() in ['t','true'] and os.path.exists(web_dir): shutil.rmtree(web_dir) if not os.path.exists(web_dir): os.mkdir(web_dir) if not os.path.exists(web_dir+'/contour'): os.mkdir(web_dir+'/contour') if not os.path.exists(web_dir+'/vector'): os.mkdir(web_dir+'/vector') if not os.path.exists(web_dir+'/line'): os.mkdir(web_dir+'/line') if not os.path.exists(web_dir+'/obs'): os.mkdir(web_dir+'/obs') # Move images tot the oppropriate directories plot_dir_map = {'icesat':'obs', 'ASPeCt':'obs', 'diff_con_':'contour', 'diff_vec_':'vector', 'line':'line', 'clim':'line'} for key,dir in plot_dir_map.iteritems(): glob_string = env['WKDIR']+'/*'+key+'*.png' imgs = glob.glob(glob_string) if imgs > 0: for img in imgs: new_fn = web_dir + '/' + dir + '/' + os.path.basename(img) os.rename(img,new_fn) # Create/format the html files and copy txt and map files shutil.copy(env['HTML_HOME']+'/ICESat.txt', web_dir+'/obs/ICESat.txt') shutil.copy(env['HTML_HOME']+'/ASPeCt.txt', web_dir+'/obs/ASPeCt.txt') glob_string = env['HTML_HOME']+'/maps/*' maps = glob.glob(glob_string) for map in maps: mn = os.path.basename(map) shutil.copy(map,web_dir+'/'+mn) print('DEBUG: model_vs_model web_dir = {0}'.format(web_dir)) html_dir = env['HTML_HOME'] var_name_type_cont = env['VAR_NAME_TYPE_CONT'] var_name_type_diff = env['VAR_NAME_TYPE_DIFF'] create_ice_html.create_plotset_html(html_dir+'/index_diff_temp.html',web_dir+'/index.html',env) if 'SIMIP' in var_name_type_cont or 'SIMIP' in var_name_type_diff: create_ice_html.create_plotset_html(html_dir+'/contour_diff_simip.html',web_dir+'/contour.html',env) else: create_ice_html.create_plotset_html(html_dir+'/contour_diff.html',web_dir+'/contour.html',env) create_ice_html.create_plotset_html(html_dir+'/timeseries_diff.html',web_dir+'/timeseries.html',env) create_ice_html.create_plotset_html(html_dir+'/regional_diff.html',web_dir+'/regional.html',env) create_ice_html.create_plotset_html(html_dir+'/vector_diff.html',web_dir+'/vector.html',env) # setup the unique ICEDIAG_WEBDIR_MODEL_VS_MODEL output file env_file = '{0}/env_diags_ice.xml'.format(env['PP_CASE_PATH']) key = 'ICEDIAG_WEBDIR_{0}'.format(self._name) value = env['WKDIR'] ##web_file = '{0}/web_dirs/{1}.{2}-{3}'.format(env['PP_CASE_PATH'], key, scomm.get_size(), scomm.get_rank() ) web_file = '{0}/web_dirs/{1}.{2}'.format(env['PP_CASE_PATH'], key, datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')) try: diagUtilsLib.write_web_file(web_file, 'ice', key, value) except: print('WARNING ice model_vs_model unable to write {0}={1} to {2}'.format(key, value, web_file)) print('*******************************************************************************') print('Successfully completed generating ice diagnostics model vs. model plots') print('*******************************************************************************')