- Timestamp:
- Jun 17, 2016, 7:33:43 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r851 r864 621 621 'diagnostics.inf' (reference for diagnostics.py') 622 622 [CFname], [moddiag], [varcombo] 623 [moddiag]: name of the diagnosted variable 623 [CFname]: CF name of the variable 624 [moddiag]: name of the diagnosted variable (for `diagnostic.py') 624 625 [varcombo]: combnination of variables to be used to compute diagnostic 625 626 CFvar_DIAGvar(varn) 626 627 [varn]= CF name of the variable 627 628 >>> CFvar_MODvar('pr') 628 [[' RAINC', 'RAINNC']]629 {'RAINTOT': ['RAINC', 'RAINNC']} 629 630 >>> CFvar_MODvar('hurs') 630 [[' psol', 't2m', 'q2m'], [' psfc', 't', 'q'], [' PSFC', 'T2', 'Q2']]631 {'TSrhs': ['psfc', 't', 'q'], 'LMDZrhs': ['psol', 't2m', 'q2m'], 'WRFrhs': ['PSFC', 'T2', 'Q2']} 631 632 """ 632 633 import subprocess as sub … … 642 643 643 644 infile = folder + '/diagnostics.inf' 644 645 645 if not os.path.isfile(infile): 646 646 print errormsg … … 650 650 ncf = open(infile, 'r') 651 651 652 MODvars = []652 MODvars = {} 653 653 for line in ncf: 654 654 if line[0:1] != '#': 655 655 values = line.replace('\n','').replace(' ','').split(',') 656 if values[0] == varn: MODvars .append(values[2].split('@'))656 if values[0] == varn: MODvars[values[1]] = values[2].split('@') 657 657 658 658 if len(MODvars) == 0: … … 662 662 return None 663 663 else: 664 ncf.close() 664 665 return MODvars 665 666
Note: See TracChangeset
for help on using the changeset viewer.