source: LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/practical/plot_input_profile.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.1 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(latitude, input_srcfile, dstdir):
12    """
13    Plot input files
14    """
15   
16    import os
17    if not os.path.isdir(dstdir):
18        os.makedirs(dstdir)
19
20    name_string = os.path.splitext(os.path.basename(input_srcfile))[0]
21       
22    dstfile = os.path.join(dstdir, name_string + f"_profile_{eplt.unfancy_format_latitude(latitude)}.png")
23
24    print(f"Plotting inputs profile to {dstfile}")
25    eplt.plot_input_profile(latitude, input_srcfile, dstfile=dstfile);
26   
27if __name__ == "__main__":
28    import argparse
29    parser = argparse.ArgumentParser(description="Plot profiles of atmospheric composition and clouds from input file to ecRAD.")
30    parser.add_argument("latitude", help="Latitude at which to extract profiles", type=float)
31    parser.add_argument("input",  help="ecRAD input file")
32    parser.add_argument("--dstdir", help="Destination directory for plots", default="./")
33    args = parser.parse_args()
34   
35    main(args.latitude, args.input, args.dstdir)
Note: See TracBrowser for help on using the repository browser.