[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #VKP-631083]: error modifying existing attribute



Jeff,

> > Russ/Dennis:  I've filed two tickets on support-netcdf,  I think they
> > both represent bugs in 4.2rc1.  I hope you can find the time to take a
> > look at them before 4.2 is released.  One (netCDF #VKP-631083) has to do
> > with changing an existing attribute in a netcdf4 file, and the other
> > (netCDF #XHX-254015) is a regression from 4.1.3 that occurs when trying
> > to read opendap aggregation datasets.
> 
> Thanks, Jeff, I've reproduced the bug in a C program.  You can monitor this
> Jira issue to see when it's fixed:
> 
> https://www.unidata.ucar.edu/jira/browse/NCF-156

Fixed.

> Thanks for reporting the bug and providing a reproducible example program.
> 
> --Russ
> 
> > If I open a NETCDF4 file in "append" mode and immediately try to modify
> > an existing attribute, I get this error
> >
> > NetCDF: Operation not allowed in data mode
> >
> > However, if I first create a new attribute, before trying to modify an
> > existing one, all is well.  Here is a python script that triggers the
> > error with netcdf 4.1.3/hdf5 1.8.8
> >
> > from netCDF4 import Dataset
> > f = Dataset('pv.nc','w')
> > lat = f.createDimension('lat',181)
> > lon = f.createDimension('lon',360)
> > lev = f.createDimension('lev',60)
> > pv = f.createVariable('PV','f',('lev','lat','lon'),fill_value=-999)
> > pv.units="K m**2 kg**-1 s**-1"
> > pv.longname = 'Potential Vorticity'
> > f.close()
> > f = Dataset('pv.nc','a')
> > pv = f.variables['PV']
> > pv.longname = 'Ertel Potential Vorticity'  ==> error occurs here
> > f.close()
> >
> > Here is the workaround:
> >
> > pv.testatt = 'test'
> > pv.longname = 'Ertel Potential Vorticity'
> > del pv.testatt
> > f.close()
> >
> > I can create a C program to trigger the error if you like.
> >
> > Regards,
> >
> > Jeff
> >
> >
> >
> 
> Russ Rew                                         UCAR Unidata Program
> address@hidden                      http://www.unidata.ucar.edu
> 
> 

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: VKP-631083
Department: Support netCDF
Priority: Urgent
Status: Closed