From c497fb3a2265856655b52d51c8d9347bd9b7719e Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Wed, 13 Oct 2021 19:20:19 +0000 Subject: [PATCH 1/9] initial commit --- LAMDA/minimization_plots.py | 109 ++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 LAMDA/minimization_plots.py diff --git a/LAMDA/minimization_plots.py b/LAMDA/minimization_plots.py new file mode 100644 index 0000000..8bd2e35 --- /dev/null +++ b/LAMDA/minimization_plots.py @@ -0,0 +1,109 @@ +import numpy as np +from datetime import datetime +import matplotlib.pyplot as plt +from pyGSI.gsi_stat import GSIstat +from emcpy.plots.plots import LinePlot +from emcpy.plots import CreatePlot + +__all__ = ['plot_minimization'] + + +def _plot_cost_single_cycle(cost_df, cyclestr, plotdir): + """ + Uses cost dataframe to plot a single cycle of cost. + """ + j = cost_df['J'].to_numpy() + iterations = np.arange(len(j)) + + cost_plot = LinePlot(iterations, j) + cost_plot.linewidth = 2 + cost_plot.label = 'cost' + + myplot = CreatePlot() + myplot.draw_data([cost_plot]) + myplot.set_yscale('log') + myplot.add_grid() + myplot.set_xlim(0, len(j)-1) + myplot.add_xlabel('Iterations') + myplot.add_ylabel('log (J)') + myplot.add_legend(loc='upper right', + fontsize='large') + myplot.add_title('FV3LAM Cost', loc='left') + myplot.add_title(cyclestr, loc='right', + fontweight='semibold') + + fig = myplot.return_fig() + + plt.savefig(plotdir + f"single_cycle_cost_plot_{cyclestr}.png", + bbox_inches='tight', pad_inches=0.1) + plt.close('all') + + +def _plot_gnorm_single_cycle(cost_df, cyclestr, plotdir): + """ + Uses cost dataframe to plot a single cycle of gnorm. + """ + gj = cost_df['gJ'].to_numpy() + gj = np.log(gj/gj[0]) + x = np.arange(len(j)) + + cost_plot = LinePlot(x, gj) + cost_plot.linewidth = 2 + cost_plot.label = 'gnorm' + + myplot = CreatePlot() + myplot.draw_data([cost_plot]) + myplot.add_grid() + myplot.set_xlim(0, len(j)-1) + myplot.add_xlabel('Iterations') + myplot.add_ylabel('log (gnorm)') + myplot.add_legend(loc='upper right', + fontsize='large') + myplot.add_title('FV3LAM gnorm', loc='left') + myplot.add_title(cyclestr, loc='right', + fontweight='semibold') + + fig = myplot.return_fig() + + plt.savefig(plotdir + f"single_cycle_gnorm_plot_{cyclestr}.png", + bbox_inches='tight', pad_inches=0.1) + plt.close('all') + + +def plot_minimization(inputfile, cyclestr, plotdir): + """ + Create minimization plots from gsistat file. + + Args: + inputfile : (str) path to GSI stat file + cyclestr : (str) cycle from GSI stat file + plotdir : (str) Path to output plot directory + """ + cycle = datatime.strptime(cyclestr, '%Y%m%d%H') + + # Get gdas object and extract cost info + gdas = GSIstat(inputfile, cyclestr) + cost_df = gdas.extract('cost') + + # Plot single cycle cost + _plot_cost_single_cycle(cost_df, cyclestr, plotdir) + + # Plot single cycle gnorm + _plot_gnorm_single_cycle(cost_df, cyclestr, plotdir) + + # Need to add features that will plot 7 day average + # with last 4 cycles + + +if __name__ == '__main__': + # called from command line + ap = argparse.ArgumentParser() + ap.add_argument("-i", "--input", help="Path to GSI stat file", + required=True) + ap.add_argument("-c", "--cycle", help="YYYYMMDDHH analysis cycle", + required=True) + ap.add_argument("-p", "--plotdir", help="Path to output plot dir", + default='./') + MyArgs = ap.parse_args() + + plot_minimization(MyArgs.input, MyArgs.cycle, MyArgs.plotdir) From 63422395411b7b53a7572378465ba36b3f28f732 Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Wed, 13 Oct 2021 19:22:48 +0000 Subject: [PATCH 2/9] remove plot_features? --- LAMDA/minimization_plots.py | 17 --- LAMDA/plot_features.py | 287 ------------------------------------ 2 files changed, 304 deletions(-) delete mode 100644 LAMDA/plot_features.py diff --git a/LAMDA/minimization_plots.py b/LAMDA/minimization_plots.py index 8bd2e35..2bd9967 100644 --- a/LAMDA/minimization_plots.py +++ b/LAMDA/minimization_plots.py @@ -90,20 +90,3 @@ def plot_minimization(inputfile, cyclestr, plotdir): # Plot single cycle gnorm _plot_gnorm_single_cycle(cost_df, cyclestr, plotdir) - - # Need to add features that will plot 7 day average - # with last 4 cycles - - -if __name__ == '__main__': - # called from command line - ap = argparse.ArgumentParser() - ap.add_argument("-i", "--input", help="Path to GSI stat file", - required=True) - ap.add_argument("-c", "--cycle", help="YYYYMMDDHH analysis cycle", - required=True) - ap.add_argument("-p", "--plotdir", help="Path to output plot dir", - default='./') - MyArgs = ap.parse_args() - - plot_minimization(MyArgs.input, MyArgs.cycle, MyArgs.plotdir) diff --git a/LAMDA/plot_features.py b/LAMDA/plot_features.py deleted file mode 100644 index 33d6a52..0000000 --- a/LAMDA/plot_features.py +++ /dev/null @@ -1,287 +0,0 @@ -from datetime import datetime -import numpy as np -from textwrap import TextWrapper -import matplotlib.pyplot as plt -from emcpy.plots.plots import Scatter, Histogram, VerticalLine -from emcpy.plots.map_plots import MapScatter -from emcpy.plots import CreateMap, CreatePlot, VariableSpecs -from emcpy.plots.map_tools import Domain, MapProjection -import matplotlib -matplotlib.use('agg') - -__all__ = ['get_obs_type', 'get_bins', 'calculate_stats', - 'get_labels', 'varspecs_name'] - - -def qc_flag_colors(qcflag): - """ - Dictionary of colors to use for specific QC flag numbers. - - Args: - qcflag : (int) qc flag number - Returns: - color : (str) color based on qc flag number - """ - qc_flag_colors = { - 0: 'tab:green', - 1: 'black', - 2: 'tab:pink', - 3: 'tab:red', - 4: 'tab:orange', - 5: 'tab:brown', - 6: 'tab:olive', - 7: 'skyblue', - 8: 'tab:blue', - 9: 'maroon', - 10: 'tab:cyan', - 12: 'navy', - 50: 'indigo', - 51: 'tab:purple', - 52: 'magenta', - 53: 'cornflowerblue', - 54: 'pink', - 55: 'lightgrey', - 56: 'darkgrey', - 57: 'dimgrey' - } - - return qc_flag_colors[qcflag] - - -def get_obs_type(obs_id): - """ - Grabs the full name of a specific observation. - - Args: - obs_id: (list of ints) ID number(s) for conventional - diagnostic - Returns: - list of observation names. If ID in the list, it will return, - the proper name. If no observation ID, returns 'All Observations'. - If ID not in the list, returns list of string of the ID number. - """ - - obs_indicators = { - 120: "Rawinsonde", - 126: "RASS", - 130: "Aircraft: AIREP and PIREP", - 131: "Aircraft: AMDAR", - 132: "Flight-Level Reconnaissance and Profile Dropsonde", - 133: "Aircraft: MDCRS ACARS", - 134: "Aircraft: TAMDAR", - 135: "Aircraft: Canadian AMDAR", - 153: "GPS-Integrated Precipitable Water", - 180: ("Surface Marine w/ Station Pressure (Ship, Buoy, C-MAN, " - "Tide Guage)"), - 181: "Surface Land w/ Station Pressure (Synoptic, METAR)", - 182: "Splash-Level Dropsonde Over Ocean", - 183: "Surface Marine or Land - Missing Station Pressure", - 187: "Surface Land - Missing Station Pressure", - 210: "Synthetic Tropical Cyclone", - 220: "Rawinsonde", - 221: "PIBAL", - 224: "NEXRAD Vertical Azimuth Display", - 228: "Wind Profiler: JMA", - 229: "Wind Profiler: PIBAL", - 230: "Aircraft: AIREP and PIREP", - 231: "Aircraft: AMDAR", - 232: "Flight-Level Reconnaissance and Profile Dropsonde", - 233: "Aircraft: MDCRS ACARS", - 234: "Aircraft: TAMDAR", - 235: "Aircraft: Canadian AMDAR", - 242: ("JMA IR (Longwave) and Visible Cloud Drift Below 850mb " - "(GMS, MTSAT, HIMAWARI)"), - 243: ("EUMETSAT IR (Longwave) and Visible Cloud Drift Below " - " 850mb (METEOSAT)"), - 244: "AVHRR/POES IR (Longwave) Cloud Drift", - 245: "NESDIS IR (Longwave) Cloud Drift (All Levels)", - 246: "NESDIS Imager Water Vapor (All Levels) - Cloud Top (GOES)", - 250: ("JMA Imager Water Vapor (All Levels) - Cloud Top & Deep " - "Layer (GMS, MTSAT, HIMAWARI)"), - 251: "NESDIS Visible Cloud Drift (All Levels) (GOES)", - 252: ("JMA IR (Longwave) and Visible Cloud Drift Above 850mb " - "(GMS, MTSAT, HIMAWARI)"), - 253: ("EUMETSAT IR (Longwave) and Visible Cloud Drift Above " - "850mb (METEOSAT)"), - 254: ("EUMETSAT Imager Water Vapor (All Levels) - Cloud Top " - " & Deep Layer (METEOSAT)"), - 257: ("MODIS/POES IR (Longwave) Cloud Drift (All Levels) " - "(AQUA, TERRA)"), - 258: ("MODIS/POES Imager Water Vapor (All Levels) - Cloud Top " - "(AQUA, TERRA)"), - 259: ("MODIS/POES Imager Water Vapor (All Levels) - Deep Layer " - "(AQUA, TERRA)"), - 280: ("Surface Marine w/ Station Pressure (Ship, Buoy, C-MAN, " - "Tide Guage)"), - 281: "Surface Land w/ Station Pressure (Synoptic, METAR)", - 282: "ATLAS Buoy", - 284: "Surface Marine or Land - Missing Station Pressure", - 287: "Surface Land (METAR) - Missing Station Pressure", - 289: "SUPEROBED (1.0 Lat/Lon) Scatterometer Winds over Ocean", - 290: "Non-SUPEROBED Scatterometer Winds over Ocean" - } - - descripts = list() - if obs_id is None: - return ['All Observations'] - - else: - for ids in obs_id: - if ids in obs_indicators.keys(): - descripts.append(obs_indicators[ids]) - - else: - descripts.append(str(ids)) - - return descripts - - -def get_bins(eval_type, stats): - """ - Calculates bins to use for histogram plot. - - Args: - eval_type : (str) determines how to create bins - whether 'diff' or 'magnitude' - stats : (dict) dictionary of stats from - `calculate_stats()` - Returns: - bins : (array-like) - """ - binsize = stats['Std']/5 - - if eval_type == 'diff': - bins = np.arange(0-(4*stats['Std']), - 0+(4*stats['Std']), - binsize) - - else: - bins = np.arange(stats['Mean']-(4*stats['Std']), - stats['Mean']+(4*stats['Std']), - binsize) - - return bins - - -def calculate_stats(data): - """ - Calculates n, mean, min, max, - standard deviation, and RMSE. - Returns dictionary with stats. - - Args: - data : (array-like) array of data to calculate - stats - Returns: - stats : (dict) dictionary of stats - """ - - n = np.count_nonzero(~np.isnan(data)) - - mean = np.nanmean(data) - std = np.nanstd(data) - mx = np.nanmax(data) - mn = np.nanmin(data) - - rmse = np.sqrt(np.nanmean(np.square(data))) - - stats = {'Nobs': n, - 'Min': np.round(mn, 3), - 'Max': np.round(mx, 3), - 'Mean': np.round(mean, 3), - 'Std': np.round(std, 3), - 'RMSE': np.round(rmse, 3) - } - - return stats - - -def get_labels(metadata): - """ - Creates a dictionary of title, date title, and the save - file name using information from the metadata. - - Args: - metadata : (dict) metadata dictionary created by diags.py - Returns: - labels : (dict) dictionary of labels - """ - - var = metadata['Satellite'] if 'Satellite' in metadata \ - else metadata['Variable'] - - # Get title and save file name - if metadata['Anl Use Type'] is not None: - title = (f"{metadata['Obs Type']}: {var} - {metadata['Diag Type']}" - f" - Data {metadata['Anl Use Type']}") - - save_file = (f"{metadata['Date']:%Y%m%d%H}_{metadata['Obs Type']}_" - f"{var}_{metadata['Diag Type']}_" - f"{metadata['Anl Use Type']}") - - else: - title = f"{metadata['Obs Type']}: {var} - {metadata['Diag Type']}" - save_file = (f"{metadata['Date']:%Y%m%d%H}_{metadata['Obs Type']}_" - f"{var}_{metadata['Diag Type']}_") - - # Adds on specific obsid, channel, or layer info to title/save file - if metadata['Diag File Type'] == 'conventional': - title = title + '\n%s' % '\n'.join(metadata['ObsID Name']) - save_file = save_file + '%s' % '_'.join( - str(x) for x in metadata['ObsID Name']) - - elif metadata['Diag File Type'] == 'radiance': - if metadata['Channels'] == 'All Channels': - title = title + '\nAll Channels' - save_file = save_file + 'All_Channels' - - else: - title = title + '\nChannels: %s' % ', '.join( - str(x) for x in metadata['Channels']) - save_file = save_file + 'channels_%s' % '_'.join( - str(x) for x in metadata['Channels']) - - else: - layer = metadata['Layer'] - title = title + f'\nLayer: {layer}' - save_file = save_file + '%s' % layer - - # Get date label - date_title = metadata['Date'].strftime("%d %b %Y %Hz") - - labels = { - 'title': title, - 'date title': date_title, - 'save file': save_file - } - - return labels - - -def varspecs_name(variable): - """ - Grabs the specific variable name to utlitize emcpy's VariableSpecs. - - Args: - variable : (str) variable name - Returns: - spec_variable : (str) name of spec variable - """ - vardict = { - 'temperature': ['air temperature', 'tmp', 'temp', 't'], - 'specific humidity': ['q', 'spfh'], - 'u': ['eastward wind', 'ugrd', 'zonal wind'], - 'v': ['northward wind', 'vgrd', 'meridional wind'], - 'wind speed': ['windspeed'], - 'brightness temperature': ['bt'], - 'integrated layer ozone in air': ['ozone', 'o3'] - } - - # makes lower case and replaces underscore with space - spec_variable = variable.lower().replace('_', ' ') - - for key in vardict.keys(): - spec_variable = key if spec_variable in vardict[key] \ - else spec_variable - - return spec_variable From f19f76a9cc7e58f9a094d98715d40812cd045938 Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Tue, 26 Oct 2021 14:40:41 +0000 Subject: [PATCH 3/9] updates to plot_features.py --- LAMDA/plot_features.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/LAMDA/plot_features.py b/LAMDA/plot_features.py index 799a8a5..65b0377 100644 --- a/LAMDA/plot_features.py +++ b/LAMDA/plot_features.py @@ -16,7 +16,6 @@ def qc_flag_colors(qcflag): """ Dictionary of colors to use for specific QC flag numbers. - Args: qcflag : (int) qc flag number Returns: @@ -55,7 +54,6 @@ def qc_flag_colors(qcflag): def get_obs_type(obs_id): """ Grabs the full name of a specific observation. - Args: obs_id: (list of ints) ID number(s) for conventional diagnostic @@ -143,7 +141,6 @@ def get_obs_type(obs_id): def get_bins(eval_type, stats): """ Calculates bins to use for histogram plot. - Args: eval_type : (str) determines how to create bins whether 'diff' or 'magnitude' @@ -172,7 +169,6 @@ def calculate_stats(data): Calculates n, mean, min, max, standard deviation, and RMSE. Returns dictionary with stats. - Args: data : (array-like) array of data to calculate stats @@ -204,7 +200,6 @@ def get_labels(metadata): """ Creates a dictionary of title, date title, and the save file name using information from the metadata. - Args: metadata : (dict) metadata dictionary created by diags.py Returns: @@ -265,7 +260,6 @@ def get_labels(metadata): def varspecs_name(variable): """ Grabs the specific variable name to utlitize emcpy's VariableSpecs. - Args: variable : (str) variable name Returns: From c4bb16a0a1062eb9f91a031e197cbe7e37ab65b6 Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Mon, 15 Nov 2021 20:12:35 +0000 Subject: [PATCH 4/9] minimization updates to include experiment and tm info --- LAMDA/minimization_plots.py | 34 +++++++++++++++++---------- LAMDA/scripts/LAMDA_stats_workflow.py | 8 ++++++- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/LAMDA/minimization_plots.py b/LAMDA/minimization_plots.py index 49679cc..b27e6da 100644 --- a/LAMDA/minimization_plots.py +++ b/LAMDA/minimization_plots.py @@ -8,7 +8,7 @@ __all__ = ['plot_minimization'] -def _plot_cost_function(df, outdir): +def _plot_cost_function(df, config, outdir): """ Use data from dataframe to plot the cost function. """ @@ -48,18 +48,22 @@ def _plot_cost_function(df, outdir): myplot.add_ylabel('log (J)') myplot.add_legend(loc='upper right', fontsize='large') - myplot.add_title('FV3LAM Cost', loc='left') + + title = f"{config['experiment']} Cost - {config['tm']}" + myplot.add_title(title, loc='left') myplot.add_title(cyclestr, loc='right', fontweight='semibold') fig = myplot.return_figure() - plt.savefig(outdir + f"{cyclestr}_cost_function.png", - bbox_inches='tight', pad_inches=0.1) + savefile = (f"{cyclestr}_{config['experiment']}_" + + f"tm0{config['tm']}_cost_function.png") + plt.savefig(outdir + savefile, bbox_inches='tight', + pad_inches=0.1) plt.close('all') -def _plot_gnorm(df, outdir): +def _plot_gnorm(df, config, outdir): """ Use date from dataframe to plot gnorm. """ @@ -97,23 +101,27 @@ def _plot_gnorm(df, outdir): myplot.draw_data([gnorm, avg_gnorm]) # myplot.set_yscale('log') myplot.add_grid() - myplot.set_xlim(0, len(j)-1) + myplot.set_xlim(0, len(gJ)-1) myplot.add_xlabel('Iterations') myplot.add_ylabel('log (gnorm)') myplot.add_legend(loc='upper right', fontsize='large') - myplot.add_title('FV3LAM gnorm', loc='left') + + title = f"{config['experiment']} gnorm - {config['tm']}" + myplot.add_title(title, loc='left') myplot.add_title(cyclestr, loc='right', fontweight='semibold') fig = myplot.return_figure() - plt.savefig(outdir + f"{cyclestr}_gnorm.png", - bbox_inches='tight', pad_inches=0.1) + savefile = (f"{cyclestr}_{config['experiment']}_" + + f"tm0{config['tm']}_gnorm.png") + plt.savefig(outdir + savefile, bbox_inches='tight', + pad_inches=0.1) plt.close('all') -def plot_minimization(df, outdir): +def plot_minimization(df, plotting_config, outdir): """ Plot minimization plots including gnorm and cost function and save them to outdir. @@ -121,8 +129,10 @@ def plot_minimization(df, outdir): Args: df : (pandas dataframe) dataframe with appropriate information from GSI Stat file + plotting_config : (dict) dictionary with information about + minimization period outdir : (str) path to output diagnostics """ - _plot_gnorm(df, outdir) - _plot_cost_function(df, outdir) + _plot_gnorm(df, plotting_config, outdir) + _plot_cost_function(df, plotting_config, outdir) \ No newline at end of file diff --git a/LAMDA/scripts/LAMDA_stats_workflow.py b/LAMDA/scripts/LAMDA_stats_workflow.py index 427926b..bfc3c22 100644 --- a/LAMDA/scripts/LAMDA_stats_workflow.py +++ b/LAMDA/scripts/LAMDA_stats_workflow.py @@ -122,9 +122,15 @@ def create_minimization_plots(data_dict, outdir): # Concatenate all files into one dataframe fits2_df = concatenate_dfs(fits2_data, 'cost', cycles, data_type='cost') + + # Get plotting information + plotting_config = {} + plotting_config['tm'] = tm + current_file = fits2_data[-1].split('/')[-1] + plotting_config['experiment'] = current_file.split('.')[0] # Create plot by calling plotting script - minimization_plots(fits2_df, outdir) + minimization_plots(fits2_df, plotting_config outdir) def stats_workflow(config_yaml, nprocs, outdir): From a84ff7e240bd4b4c15a8f4383abb874a4463270b Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Mon, 15 Nov 2021 20:15:33 +0000 Subject: [PATCH 5/9] pycodestyle --- LAMDA/scripts/LAMDA_stats_workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LAMDA/scripts/LAMDA_stats_workflow.py b/LAMDA/scripts/LAMDA_stats_workflow.py index bfc3c22..8ebea33 100644 --- a/LAMDA/scripts/LAMDA_stats_workflow.py +++ b/LAMDA/scripts/LAMDA_stats_workflow.py @@ -122,7 +122,7 @@ def create_minimization_plots(data_dict, outdir): # Concatenate all files into one dataframe fits2_df = concatenate_dfs(fits2_data, 'cost', cycles, data_type='cost') - + # Get plotting information plotting_config = {} plotting_config['tm'] = tm From 98bd242176107acfe47f74d83c0643134a963a77 Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Mon, 15 Nov 2021 20:17:26 +0000 Subject: [PATCH 6/9] pycodestyle --- LAMDA/minimization_plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LAMDA/minimization_plots.py b/LAMDA/minimization_plots.py index b27e6da..d9c0b95 100644 --- a/LAMDA/minimization_plots.py +++ b/LAMDA/minimization_plots.py @@ -135,4 +135,4 @@ def plot_minimization(df, plotting_config, outdir): """ _plot_gnorm(df, plotting_config, outdir) - _plot_cost_function(df, plotting_config, outdir) \ No newline at end of file + _plot_cost_function(df, plotting_config, outdir) From 868f14923d99c00ac8fdc63ffd3de94cc1c53e8c Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Mon, 15 Nov 2021 20:36:19 +0000 Subject: [PATCH 7/9] add experiment to yaml --- LAMDA/scripts/LAMDA_stats_workflow.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/LAMDA/scripts/LAMDA_stats_workflow.py b/LAMDA/scripts/LAMDA_stats_workflow.py index 8ebea33..d60d082 100644 --- a/LAMDA/scripts/LAMDA_stats_workflow.py +++ b/LAMDA/scripts/LAMDA_stats_workflow.py @@ -99,13 +99,15 @@ def plotting(config, data_dict, outdir, data_type, ob_type): plot_dict[plot_type](fits_df, plotting_config, outdir) -def create_minimization_plots(data_dict, outdir): +def create_minimization_plots(data_dict, experiment_type, outdir): """ Since it is stand alone from other plotting scripts, this functions purpose is to generate the minimization plots. Args: data_dir : (dict) dictionary that includes fits2 data + experiment_type : (str) the type of experiment i.e. + FV3LAMDA, LAMDAX, etc. outdir : (str) path to where figures should be outputted """ @@ -124,10 +126,10 @@ def create_minimization_plots(data_dict, outdir): data_type='cost') # Get plotting information - plotting_config = {} - plotting_config['tm'] = tm - current_file = fits2_data[-1].split('/')[-1] - plotting_config['experiment'] = current_file.split('.')[0] + plotting_config = { + 'tm': tm, + 'experiment': experiment_type + } # Create plot by calling plotting script minimization_plots(fits2_df, plotting_config outdir) @@ -153,8 +155,9 @@ def stats_workflow(config_yaml, nprocs, outdir): statdir = config_yaml['stat']['stat dir'] data_type = config_yaml['stat']['data type'] + experiment_type = config_yaml['stat']['experiment type'] ob_type = config_yaml['stat']['ob type'] - plot_types = config_yaml['plot types'] + plot_types = config_yaml['stat']['plot types'] # Grabs all subdirectories of stats files (in date subdirectory) subdirs = sorted([f.path for f in os.scandir(statdir) if f.is_dir()]) @@ -175,7 +178,7 @@ def stats_workflow(config_yaml, nprocs, outdir): # remove from plot list and then call function to plot if 'minimization' in plot_types: plot_types.remove('minimization') - create_minimization_plots(data_dict, outdir) + create_minimization_plots(data_dict, experiment_type, outdir) # Create multiprocessing lists if data_type == 'conventional': From 858b33c19943509ac8650865006b54fa580a68ef Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Mon, 15 Nov 2021 20:42:50 +0000 Subject: [PATCH 8/9] experiment type to experiment name --- LAMDA/scripts/LAMDA_stats_workflow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LAMDA/scripts/LAMDA_stats_workflow.py b/LAMDA/scripts/LAMDA_stats_workflow.py index d60d082..c5ae3ad 100644 --- a/LAMDA/scripts/LAMDA_stats_workflow.py +++ b/LAMDA/scripts/LAMDA_stats_workflow.py @@ -99,7 +99,7 @@ def plotting(config, data_dict, outdir, data_type, ob_type): plot_dict[plot_type](fits_df, plotting_config, outdir) -def create_minimization_plots(data_dict, experiment_type, outdir): +def create_minimization_plots(data_dict, experiment_name, outdir): """ Since it is stand alone from other plotting scripts, this functions purpose is to generate the minimization plots. @@ -155,7 +155,7 @@ def stats_workflow(config_yaml, nprocs, outdir): statdir = config_yaml['stat']['stat dir'] data_type = config_yaml['stat']['data type'] - experiment_type = config_yaml['stat']['experiment type'] + experiment_type = config_yaml['stat']['experiment name'] ob_type = config_yaml['stat']['ob type'] plot_types = config_yaml['stat']['plot types'] @@ -178,7 +178,7 @@ def stats_workflow(config_yaml, nprocs, outdir): # remove from plot list and then call function to plot if 'minimization' in plot_types: plot_types.remove('minimization') - create_minimization_plots(data_dict, experiment_type, outdir) + create_minimization_plots(data_dict, experiment_name, outdir) # Create multiprocessing lists if data_type == 'conventional': From 640261517ffc8787d1a3a479db3856ce8be2d611 Mon Sep 17 00:00:00 2001 From: Kevin Dougherty Date: Mon, 15 Nov 2021 20:44:35 +0000 Subject: [PATCH 9/9] whoopsies --- LAMDA/scripts/LAMDA_stats_workflow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LAMDA/scripts/LAMDA_stats_workflow.py b/LAMDA/scripts/LAMDA_stats_workflow.py index c5ae3ad..157008f 100644 --- a/LAMDA/scripts/LAMDA_stats_workflow.py +++ b/LAMDA/scripts/LAMDA_stats_workflow.py @@ -106,7 +106,7 @@ def create_minimization_plots(data_dict, experiment_name, outdir): Args: data_dir : (dict) dictionary that includes fits2 data - experiment_type : (str) the type of experiment i.e. + experiment_name : (str) the type of experiment i.e. FV3LAMDA, LAMDAX, etc. outdir : (str) path to where figures should be outputted """ @@ -128,7 +128,7 @@ def create_minimization_plots(data_dict, experiment_name, outdir): # Get plotting information plotting_config = { 'tm': tm, - 'experiment': experiment_type + 'experiment': experiment_name } # Create plot by calling plotting script @@ -155,7 +155,7 @@ def stats_workflow(config_yaml, nprocs, outdir): statdir = config_yaml['stat']['stat dir'] data_type = config_yaml['stat']['data type'] - experiment_type = config_yaml['stat']['experiment name'] + experiment_name = config_yaml['stat']['experiment name'] ob_type = config_yaml['stat']['ob type'] plot_types = config_yaml['stat']['plot types']