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

[netCDF #KRE-382151]: NF_PUT_ATT_type



Hi Julian,

> I think I found a bug in the NF_PUT_ATT_type routine or in your
> description thereof
> 
> (http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f77/NF_005fPUT_005fATT_005f-type.html#NF_005fPUT_005fATT_005f-type):
> 
> When I use the function NF_PUT_ATT_TEXT as you suggest, I obtain no
> error message, but the text attribute is not being written to the NetCDF
> file. Only if I either use NF_PUT_ATT (without the _TEXT) or if I leave
> out the INTEGER XTYPE argument, the function works.

I cannot duplicate the error you are reporting.  Could you please try comiling
and linking the following netCDF Fortran-77 program, which defines two simple
text attributes and writes them to a file named "pa.nc".  Then look at the
output of running the command "ncdump pa.nc" to see if it is what you expect.

If not, please send a small program that demonstrates the problem that we can
use to duplicate it here.  Thanks!

--Russ

      program main
      implicit none
      include 'netcdf.inc'
      integer stat
      integer ncid
      integer var_id

      stat = nf_create("pa.nc", NF_CLOBBER, ncid)
      if(stat .ne. NF_NOERR) call handle_err(stat)

      stat = nf_def_var(ncid, "var", NF_INT, 0, 0, var_id)
      if(stat .ne. NF_NOERR) call handle_err(stat)

      stat = nf_put_att_text(ncid, NF_GLOBAL, "gatt1", 8, "a string")
      if(stat .ne. NF_NOERR) call handle_err(stat)

      stat = nf_put_att_text(ncid, var_id, "att1", 9, "some text")
      if(stat .ne. NF_NOERR) call handle_err(stat)

      stat = nf_enddef (ncid)
      if(stat .ne. NF_NOERR) call handle_err(stat)

      stat = nf_close(ncid)
      if(stat .ne. NF_NOERR) call handle_err(stat)

      end

      subroutine handle_err(errcode)
      implicit none
      include 'netcdf.inc'
      integer errcode

      print *, 'Error: ', nf_strerror(errcode)
      stop 2
      end



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



Ticket Details
===================
Ticket ID: KRE-382151
Department: Support netCDF
Priority: Normal
Status: Closed