Changeset 1115 in lmdz_wrf


Ignore:
Timestamp:
Sep 22, 2016, 3:54:39 PM (9 years ago)
Author:
lfita
Message:

Adding matrix output in `field_stats' (preceded by 'MAT:' string

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r1114 r1115  
    1078010780
    1078110781        counts = []
    10782         if countVals is not None:
     10782        if countV is not None:
    1078310783            for icV in range(NcountV):
    1078410784                cV = countV[icV].split('@')[0]
     
    1080610806            print '    Fstats mean2:', mean2v
    1080710807            print '    Fstats variability:', varv
    10808             if countVals is not None:
     10808            if countV is not None:
    1080910809                for icV in range(NcountV):
    1081010810                    convals = counts[icV]
     
    1081310813                    contvalsS = 'count(', + convals[1] + ',',convals[2],')'
    1081410814            else:
    10815                 convals = ['-']
     10815                convals = [int(0)]
    1081610816                convalsS = ''
     10817                print fname + '; Lluis here convals:', convals
    1081710818            statsvariable[vn] = [minv, maxv, meanv, mean2v, varv, convals[0]]
    1081810819        else:
     
    1082310824
    1082410825    ncobj.close()
    10825     print '  Matrix of the statisitcs _______'
     10826    stsn = ['varn', 'min', 'max', 'mean', 'mean2', 'var', convalsS]
     10827    Sm = 'MAT:  '
    1082610828    print '  '
    10827     print '  varn    min       max       mean      mean2     var       ' + convalsS
     10829    print Sm + 'Matrix of the statisitcs _______'
     10830    print Sm + ' '.join('{:<15}'.format(vn) for vn in stsn)
    1082810831    for key in statsvariable.keys():
    10829         print statsvariable[key]
     10832        vals = statsvariable[key]
     10833        print Sm+'{:<15}'.format(key)+' '+' '.join('{:<15g}'.format(v) for v in vals)
    1083010834
    1083110835    return
Note: See TracChangeset for help on using the changeset viewer.