Changeset 1270 in lmdz_wrf for trunk


Ignore:
Timestamp:
Nov 4, 2016, 4:47:40 PM (9 years ago)
Author:
lfita
Message:

Adding the removing of the file if certain functions fail

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/model_graphics.py

    r1268 r1270  
    890890                    print 'WRF_toCF('+ values +', ' + ifilen + ')'
    891891                    for s1out in output: print s1out
     892                    # Removing file in order to make sure that it will be redone
     893                    print '  ' + fname + " removing file '" + ifilen + "' ..."
     894                    sub.call('rm ' + ifilen + ' >& /dev/null', shell=True)
    892895                    quit(-1)
    893896                if db:
     
    901904                    print 'LMDZ_toCF('+ Tunits +'!since!'+ Tref + ', ' + ifilen + ')'
    902905                    for s1out in output: print s1out
     906                    # Removing file in order to make sure that it will be redone
     907                    print '  ' + fname + " removing file '" + ifilen + "' ..."
     908                    sub.call('rm ' + ifilen + ' >& /dev/null', shell=True)
    903909                    quit(-1)
    904910                if db:
     
    949955            print 'time_reset(' + minf.timemodif + ', ' + fileon + ', time)'
    950956            for s1out in output: print s1out
     957            # Removing file in order to make sure that it will be redone
     958            print '  ' + fname + " removing file '" + fileon + "' ..."
     959            sub.call('rm ' + fileon + ' >& /dev/null', shell=True)
    951960            quit(-1)
    952961        if db:
     
    11581167            # pinterp: pressure interpolation (to the given $plevels)
    11591168            vals=plevels + ',1,1'
    1160             print fname + '; Lluis vals:', vals, 'plevels:', plevels
    11611169            if dofile:
    11621170                try:
     
    11821190
    11831191                # adding CF lon,lat,time in WRF files
    1184                 if minf.name == 'WRF':
     1192                if minf.name == 'WRF' or minf.name == 'WRF_LMDZ':
    11851193                    values = vdnx + ':' + vdny + ':'+ Tref + ':' + Tunits
    1186                     ncvar.WRF_toCF(values, fileon)
     1194                    try:
     1195                        with gen.Capturing() as output:
     1196                            ncvar.WRF_toCF(values, fileon)
     1197                    except:
     1198                        print errmsg
     1199                        print 'ncvar.WRF_toCF(' + values+ ', ' + fileon + ')'
     1200                        for s1out in output: print s1out
     1201                        # Removing file in order to make sure that it will be redone
     1202                        print '  ' + fname + " removing file '" + fileon + "' ..."
     1203                        sub.call('rm ' + fileon + ' >& /dev/null', shell=True)
     1204                        quit(-1)
    11871205
    11881206            # vertical interpolation variables are no more needed
     
    14401458                print 'ivars('+fileon+')'
    14411459                for s1out in output: print s1out
     1460                # Removing file in order to make sure that it will be redone
     1461                print '  ' + fname + " removing file '" + fileon + "' ..."
     1462                sub.call('rm ' + fileon + ' >& /dev/null', shell=True)
    14421463                quit(-1)
    14431464
     
    14521473                        print errmsg
    14531474                        print 'fvaradd(' + prevfile + ',' + CFvn +', '+fileon+')'
     1475                        ncvar.fvaradd(prevfile+','+CFvn, fileon)
    14541476                        for s1out in output: print s1out
     1477                        # Removing file in order to make sure that it will be redone
     1478                        print '  ' + fname + " removing file '" + fileon + "' ..."
     1479                        #sub.call('rm ' + fileon + ' >& /dev/null', shell=True)
    14551480                        quit(-1)
    14561481
     
    14651490                print errmsg
    14661491                print 'cleaning_varsfile('+totalvarkeeps+','+fileon+')'
     1492                ncvar.cleaning_varsfile(totalvarkeeps,fileon)
    14671493                for s1out in output: print s1out
     1494                # Removing file in order to make sure that it will be redone
     1495                print '  ' + fname + " removing file '" + fileon + "' ..."
     1496                sub.call('rm ' + fileon + ' >& /dev/null', shell=True)
    14681497                quit(-1)
    14691498
     
    33023331                print 'ivars('+fileon+')'
    33033332                for s1out in output: print s1out
     3333                # Removing file in order to make sure that it will be redone
     3334                print '  ' + fname + " removing file '" + fileon + "' ..."
     3335                sub.call('rm ' + fileon + ' >& /dev/null', shell=True)
    33043336                quit(-1)
    33053337
     
    33153347                        print 'fvaradd(' + prevfile + ',' + CFvn +', ' + fileon + ')'
    33163348                        for s1out in output: print s1out
     3349                        # Removing file in order to make sure that it will be redone
     3350                        print '  ' + fname + " removing file '" + fileon + "' ..."
     3351                        sub.call('rm ' + fileon + ' >& /dev/null', shell=True)
    33173352                        quit(-1)
    33183353
     
    33283363                print 'cleaning_varsfile('+totalvarkeeps+','+fileon+')'
    33293364                for s1out in output: print s1out
     3365                # Removing file in order to make sure that it will be redone
     3366                print '  ' + fname + " removing file '" + fileon + "' ..."
     3367                sub.call('rm ' + fileon + ' >& /dev/null', shell=True)
    33303368                quit(-1)
    33313369
     
    39704008                        print 'ncvar.CDO_toCF(' + ofile + ')'
    39714009                        for s1out in output: print s1out
     4010                        # Removing file in order to make sure that it will be redone
     4011                        print '  ' + fname + " removing file '" + ofile + "' ..."
     4012                        sub.call('rm ' + ofile + ' >& /dev/null', shell=True)
    39724013                        quit(-1)
    39734014
Note: See TracChangeset for help on using the changeset viewer.