source: trunk/UTIL/PYTHON/api_wrapper.py @ 445

Last change on this file since 445 was 392, checked in by aslmd, 13 years ago

PYTHON: quite a lot of modifs and tests. extended multivar subplot capabilities + cosmetic changes + general cleaning. corrected some stuff that were not working with mesoscale. and there is now a common script for meso and gcm svn status -uq! it is named pp.py [stands for: planetoplot]. put some examples in README file. testing is probably a bit necessary for most complex options.

File size: 1.7 KB
Line 
1
2### A. Spiga -- LMD -- 03/07/2011
3
4def api_onelevel (  path_to_input   = './', \
5                    input_name      = 'wrfout_d0?_????-??-??_??:00:00', \
6                    path_to_output  = None, \
7                    output_name     = None, \
8                    process         = 'list', \
9                    fields          = 'tk,W,uvmet,HGT', \
10                    debug           = False, \
11                    bit64           = False, \
12                    oldvar          = True, \
13                    interp_method   = 4, \
14                    extrapolate     = 0, \
15                    unstagger_grid  = False, \
16                    interp_level    = [-9999.], \
17                    onelevel        = 0.020, \
18                    nocall          = False ):
19    import api
20    import numpy as np
21
22    if not path_to_output:  path_to_output = path_to_input
23
24    if not output_name:
25        if interp_method <= 2:    output_name = input_name+'_p'
26        if interp_method == 3:    output_name = input_name+'_z'
27        if interp_method == 4:    output_name = input_name+'_zabg'
28
29    if interp_level[0] == -9999.: 
30        interp_level = np.arange(299)
31    else:                 
32        zelen = len(interp_level)
33        zetemp = np.zeros(299)
34        zetemp[0:zelen] = interp_level[0:zelen]
35        zetemp[zelen] = -99999.
36        interp_level = zetemp
37        onelevel = -99999.
38
39    print input_name, output_name
40
41    if nocall:     pass
42    else:          api.api_main ( path_to_input, input_name, path_to_output, output_name, \
43                   process, fields, debug, bit64, oldvar, interp_level, \
44                   interp_method, extrapolate, unstagger_grid, onelevel )
45
46    return output_name
Note: See TracBrowser for help on using the repository browser.