Changeset 1013 in lmdz_wrf for trunk


Ignore:
Timestamp:
Aug 12, 2016, 3:38:52 PM (9 years ago)
Author:
lfita
Message:

Adding `_FillValue' if on 'WRF_toCF' when new variables are created

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r1010 r1013  
    1657416574                        newdim = newonc.createDimension(oldd, len(odim))
    1657516575
    16576             newvar = newonc.createVariable(oldv, nctype(vinf.dtype), vinf.dimns)
     16576            if vinf.FillValue is not None:
     16577                newvar = newonc.createVariable(oldv, nctype(vinf.dtype), vinf.dimns, \
     16578                  fill_value=vinf.FillValue)
     16579            else:
     16580                newvar = newonc.createVariable(oldv, nctype(vinf.dtype), vinf.dimns)
    1657716581            newvar[:] = oldov[:]
    1657816582            for attrn in vinf.attributes:
    16579                 attrv = oldov.getncattr(attrn)
    16580                 newattr = set_attribute(newvar,attrn,attrv)
     16583                if vinf.FillValue is not None and attrn != '_FillValue':
     16584                    attrv = oldov.getncattr(attrn)
     16585                    newattr = set_attribute(newvar,attrn,attrv)
    1658116586
    1658216587        newonc.sync()
Note: See TracChangeset for help on using the changeset viewer.