Changeset 1193 in lmdz_wrf


Ignore:
Timestamp:
Oct 17, 2016, 6:08:12 PM (9 years ago)
Author:
lfita
Message:

Working version with differences (not understood yet, why it was not working...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/model_graphics.py

    r1188 r1193  
    10581058    Fopers = ''
    10591059    if db: print "    computing statistics of variable:'", CFvarn, "' operation '" + \
    1060       Opers + "'...'"
     1060      Opers + "' using file '" + ifilen + "...'"
    10611061    for op in opers:
    10621062
     
    38083808        op = vnop.split('_')[1]
    38093809        values = allcompvar[vnop]
    3810         VnOpS = varnoper(vn, op, opsurnames)
     3810        VnOpS = varnoper(vn, op, opersurnames)
    38113811
    38123812        # Only are reprojected that files which do contain 'lon' and 'lat',
     
    38393839            sout = sub.call('rm ' + odir+'/'+ofileop + ' >& /dev/null', shell=True)
    38403840
     3841        # List of files to re-project (first without operation)
    38413842        ifiles = [odir+'/'+ifileorig, odir+'/'+ifileop]
     3843        # List of output files after re-projection (first without operation)
    38423844        ofiles = [odir+'/'+ofileorig, odir+'/'+ofileop]
     3845
     3846        print fname + '; Lluis vn:', vn,'op:',op,'VnOpS:',VnOpS
     3847        print fname + '; Lluis ifiles:', ifiles
     3848        print fname + '; Lluis ofiles:', ofiles
     3849
    38433850
    38443851        for iif in range(2):
     
    38533860                print '  ' + fname + ": operation '" + op + "' can not be " +        \
    38543861                  "reprojected due to the lack of 'lon' or 'lat' skipping it !!"
    3855                 print "    NOTE: difference can only be computed as 'variable' " +   \
    3856                   "difference"
    3857                 print "      As operating along the differences from the original" + \
    3858                   " values from each model"
     3862                print "    NOTE: difference can only be computed as:"
     3863                print "      - 1st: compute variable's differences between models"
     3864                print "      - 2nd: Perform the operations"
    38593865
    38603866                # Building up resources to compute re-projected statistics
     
    38923898                        quit(-1)
    38933899                else:
    3894                     values = 'lon,lat,' + config['RefProjfile'] + ':'.join(CFvardims)
     3900                    # Name of the variable to reproject
     3901                    if iif == 0:
     3902                        reprjvn = vn
     3903                    else:
     3904                        reprjvn = VnOpS
     3905             
     3906                    values = 'lon,lat,' + config['RefProjfile'] + ',lon,lat,' +      \
     3907                      reprjop + ',' + ':'.join(CFvardims)
     3908                    ins= 'ncvar.reproject('+values + ', ' + ifile + ', '+ reprjvn + ')'
    38953909                    try:
    38963910                        with gen.Capturing() as output:
    3897                             sout=ncvar.reproject(values, ifile, VnOpS)
    3898                             ins = 'ncvar.reproject(' + values + ', ' + ifile + ', '+ \
    3899                               VnOpS + ')'
     3911                            sout=ncvar.reproject(values, ifile, reprjvn)
    39003912                    except:
    39013913                        print errmsg
     
    39033915                        for s1out in output: print s1out
    39043916                        quit(-1)
     3917
     3918                    sub.call('mv reproject.nc ' + ofile, shell=True)
    39053919
    39063920                if debug:
Note: See TracChangeset for help on using the changeset viewer.