source: LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/practical/plot_output_scalar.py @ 4999

Last change on this file since 4999 was 4728, checked in by idelkadi, 11 months ago

Update of ecrad in the LMDZ_ECRad branch of LMDZ:

  • version 1.6.1 of ecrad
  • files are no longer grouped in the same ecrad directory.
  • the structure of ecrad offline is preserved to facilitate updating in LMDZ
  • cfg.bld modified to take into account the new added subdirectories.
  • the interface routines and those added in ecrad are moved to the phylmd directory
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/usr/bin/env python3
2
3def warn(*args, **kwargs):
4    pass
5   
6import os, warnings
7warnings.warn = warn
8
9from ecradplot import plot as eplt
10
11def main(input_srcfile, output_srcfiles, dstdir):
12    """
13    Plot input files
14    """
15   
16    import os
17    if not os.path.isdir(dstdir):
18        os.makedirs(dstdir)
19
20    import seaborn as sns
21    name_string  = os.path.splitext(os.path.basename(input_srcfile))[0]
22    outputs_string = "_".join([os.path.splitext(os.path.basename(f))[0] for f in output_srcfiles])
23           
24    styles = [{'lw':2, 'color':'k', 'ls':'-', 'zorder':10},
25              {'lw':4, 'color':sns.color_palette()[0], 'ls':'-'},
26              {'lw':4, 'color':sns.color_palette()[2], 'ls':'-'},
27              {'lw':2, 'color':sns.color_palette()[3], 'ls':'--'},
28              {'lw':2, 'color':sns.color_palette()[5], 'ls':'-.'},
29              {'lw':4, 'color':sns.color_palette()[6], 'ls':'-'},
30              {'lw':4, 'color':sns.color_palette()[9], 'ls':'-'}]
31       
32    dstfile = f"{dstdir}/{name_string}_{outputs_string}_surface_and_TOA.png"
33    print(f"Plotting integrated and TOA outputs to {dstfile}")
34    eplt.plot_output_scalar(input_srcfile, output_srcfiles, styles, dstfile=dstfile)
35   
36if __name__ == "__main__":
37    import argparse
38    parser = argparse.ArgumentParser(description="Plot radiative fluxes and heating rates from ecRAD output file.")
39    parser.add_argument("input",    help="ecRAD input file")
40    parser.add_argument("outputs",  help="ecRAD output files", nargs='+')
41    parser.add_argument("--dstdir", help="Destination directory for plots", default="./")
42    args = parser.parse_args()
43       
44    main(args.input, args.outputs, args.dstdir)
Note: See TracBrowser for help on using the repository browser.