IODA Bundle
test_wrfdadiag.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 # script to run to test if the WRFDA ncdiag converters are still working
3 import sys
4 import argparse
5 from pathlib import Path
6 
7 IODA_CONV_PATH = Path(__file__).parent/"@SCRIPT_LIB_PATH@"
8 if not IODA_CONV_PATH.is_dir():
9  IODA_CONV_PATH = Path(__file__).parent/'..'/'lib-python'
10 sys.path.append(str(IODA_CONV_PATH.resolve()))
11 
12 import wrfda_ncdiag as wrfdad
13 
14 parser = argparse.ArgumentParser(
15  description=('Test for WRFDA netCDF diag file to IODA Obs files converters'))
16 parser.add_argument('-i', '--input',
17  help="name of input file",
18  type=str, required=True)
19 parser.add_argument('-o', '--output',
20  help="output directory",
21  type=str, required=True)
22 parser.add_argument('-t', '--type',
23  help="type of input file",
24  type=str, required=True)
25 args = parser.parse_args()
26 
27 infile = args.input
28 outdir = args.output
29 if (args.type == 'rad'):
30  diag = wrfdad.Radiances(infile)
31 else:
32  raise ValueError
33 diag.read()
34 diag.toIODAobs(outdir)