Last change
on this file since 5423 was
4773,
checked in by idelkadi, 13 months ago
|
- Update of Ecrad in LMDZ
The same organization of the Ecrad offline version is retained in order to facilitate the updating of Ecrad in LMDZ and the comparison between online and offline results.
version 1.6.1 of Ecrad (https://github.com/lguez/ecrad.git)
- Implementation of the double call of Ecrad in LMDZ
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Rev | Line | |
---|
[4773] | 1 | #!/usr/bin/env python3 |
---|
| 2 | |
---|
| 3 | def warn(*args, **kwargs): |
---|
| 4 | pass |
---|
| 5 | |
---|
| 6 | import os, warnings |
---|
| 7 | warnings.warn = warn |
---|
| 8 | |
---|
| 9 | from ecradplot import plot as eplt |
---|
| 10 | |
---|
| 11 | def main(input_srcfile, output_srcfile, dstdir): |
---|
| 12 | """ |
---|
| 13 | Plot radiation fields (fluxes, CRE, and heating rates) |
---|
| 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 | output_string = os.path.splitext(os.path.basename(output_srcfile))[0] |
---|
| 22 | |
---|
| 23 | dstfile = os.path.join(dstdir, f"{name_string}_{output_string}.png") |
---|
| 24 | |
---|
| 25 | print(f"Plotting output to {dstfile}") |
---|
| 26 | eplt.plot_output(input_srcfile, output_srcfile, dstfile=dstfile); |
---|
| 27 | |
---|
| 28 | if __name__ == "__main__": |
---|
| 29 | import argparse |
---|
| 30 | parser = argparse.ArgumentParser(description="Plot radiative fluxes and heating rates from ecRAD output file.") |
---|
| 31 | parser.add_argument("input", help="ecRAD input file") |
---|
| 32 | parser.add_argument("output", help="ecRAD output file") |
---|
| 33 | parser.add_argument("--dstdir", help="Destination directory for plots", default="./") |
---|
| 34 | args = parser.parse_args() |
---|
| 35 | |
---|
| 36 | main(args.input, args.output, args.dstdir) |
---|
Note: See
TracBrowser
for help on using the repository browser.