def do_L3_batch(cf_level): #logger = pfp_log.change_logger_filename("pfp_log", "L3") for i in list(cf_level.keys()): cf_file_name = os.path.split(cf_level[i]) msg = "Starting L3 processing with " + cf_file_name[1] logger.info(msg) try: cf = pfp_io.get_controlfilecontents(cf_level[i]) infilename = pfp_io.get_infilenamefromcf(cf) ds2 = pfp_io.nc_read_series(infilename) if ds2.returncodes["value"] != 0: return ds3 = pfp_levels.l3qc(cf, ds2) outfilename = pfp_io.get_outfilenamefromcf(cf) nc_file = pfp_io.nc_open_write(outfilename) if nc_file is None: return pfp_io.nc_write_series(nc_file, ds3) msg = "Finished L3 processing with " + cf_file_name[1] logger.info(msg) logger.info("") except Exception: msg = "Error occurred during L3 processing " + cf_file_name[1] logger.error(msg) error_message = traceback.format_exc() logger.error(error_message) continue return
def do_run_l3(cfg=None): """ Purpose: Top level routine for running the L23 post-processing. Usage: pfp_top_level.do_l3() Side effects: Creates an L3 netCDF file. Author: PRI Date: Back in the day Mods: December 2017: rewrite for use with new GUI """ try: logger.info("Starting L3 processing") if not cfg: cfg = pfp_io.load_controlfile() if len(cfg) == 0: logger.info("Quiting L3 processing (no control file)") return in_filepath = pfp_io.get_infilenamefromcf(cfg) if not pfp_utils.file_exists(in_filepath): in_filename = os.path.split(in_filepath) logger.error("File " + in_filename[1] + " not found") return ds2 = pfp_io.nc_read_series(in_filepath) ds3 = pfp_levels.l3qc(cfg, ds2) if ds3.returncodes["value"] != 0: logger.error("An error occurred during L3 processing") logger.error("") return out_filepath = pfp_io.get_outfilenamefromcf(cfg) nc_file = pfp_io.nc_open_write(out_filepath) pfp_io.nc_write_series(nc_file, ds3) logger.info("Finished L3 processing") if "Plots" in list(cfg.keys()): logger.info("Plotting L3 data") for nFig in cfg['Plots'].keys(): plt_cf = cfg['Plots'][str(nFig)] if 'Type' in plt_cf.keys(): if str(plt_cf['Type']).lower() == 'xy': pfp_plot.plotxy(cfg, nFig, plt_cf, ds2, ds3) else: pfp_plot.plottimeseries(cfg, nFig, ds2, ds3) else: pfp_plot.plottimeseries(cfg, nFig, ds2, ds3) logger.info("Finished plotting L3 data") except Exception: msg = " Error running L3, see below for details ..." logger.error(msg) error_message = traceback.format_exc() logger.error(error_message) logger.info("") return
def do_L3_batch(cf_level): for i in cf_level.keys(): cf_file_name = os.path.split(cf_level[i]) msg = "Starting L3 processing with " + cf_file_name[1] logger.info(msg) try: cf = pfp_io.get_controlfilecontents(cf_level[i]) infilename = pfp_io.get_infilenamefromcf(cf) ds2 = pfp_io.nc_read_series(infilename) ds3 = pfp_levels.l3qc(cf, ds2) outfilename = pfp_io.get_outfilenamefromcf(cf) outputlist = pfp_io.get_outputlistfromcf(cf, "nc") ncFile = pfp_io.nc_open_write(outfilename) pfp_io.nc_write_series(ncFile, ds3, outputlist=outputlist) msg = "Finished L3 processing with " + cf_file_name[1] logger.info(msg) logger.info("") except Exception: msg = "Error occurred during L3 processing " + cf_file_name[1] logger.error(msg) error_message = traceback.format_exc() logger.error(error_message) continue return