Changeset 2346 in lmdz_wrf


Ignore:
Timestamp:
Feb 18, 2019, 4:47:59 PM (6 years ago)
Author:
lfita
Message:

Adding on `WRFbnds', checking if there is 'XLONG' or 'XLONG_M'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diagnostics.py

    r2285 r2346  
    960960        newnc.sync()
    961961
    962         ovar = newnc.variables['XLONG']
    963         ovar.setncattr('bounds', 'lon_bnds lat_bnds')
    964         ovar = newnc.variables['XLAT']
    965         ovar.setncattr('bounds', 'lon_bnds lat_bnds')
     962        if newnc.variables.has_key('XLONG'):
     963            ovar = newnc.variables['XLONG']
     964            ovar.setncattr('bounds', 'lon_bnds lat_bnds')
     965            ovar = newnc.variables['XLAT']
     966            ovar.setncattr('bounds', 'lon_bnds lat_bnds')
     967        elif newnc.variables.has_key('XLONG_M'):
     968            ovar = newnc.variables['XLONG_M']
     969            ovar.setncattr('bounds', 'lon_bnds lat_bnds')
     970            ovar = newnc.variables['XLAT_M']
     971            ovar.setncattr('bounds', 'lon_bnds lat_bnds')
     972        else:
     973            print errormsg
     974            print '  ' + fname + ": error computing diagnostic '" + diagn + "' !!"
     975            print "    neither: 'XLONG', 'XLONG_M' have been found"
     976            quit(-1)
    966977
    967978# mrso: total soil moisture SMOIS, DZS
Note: See TracChangeset for help on using the changeset viewer.