Re: [netcdfgroup] Naming conflict using python netCDF4 module

On 11/16/11 9:31 AM, Pan, Jianfu (GSFC-610.2)[ADNET SYSTEMS INCORPORATE] wrote:

Hi,

I use python netCDF4 module to read a netCDF file. One of the attributes of the variables in the netCDF file is called "filters", and this conflicts with the built-in method of the variable object of netCDF4 module. It looks like this attribute is ignored when netCDF4 load my file, and I'm unable to access my "filters" attribute. Anyone might have an idea how to deal with this? Thanks.

Jianfu Pan



Jianfu:  If 'var' is your variable object, you can do

var.getncattr('filters')

instead of

var.filters

and you will get the netcdf attribute instead of the filters method.

-Jeff

--
Jeffrey S. Whitaker         Phone  : (303)497-6313
Meteorologist               FAX    : (303)497-6449
NOAA/OAR/PSD  R/PSD1        Email  : Jeffrey.S.Whitaker@xxxxxxxx
325 Broadway                Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web    : http://tinyurl.com/5telg

  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: