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

[netCDF #OLW-364027]: [netcdfgroup] nf90_put_var treatment of scalar strings

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: [netCDF #OLW-364027]: [netcdfgroup] nf90_put_var treatment of scalar strings
  • Date: Tue, 14 Jul 2009 17:12:17 -0600

Brian,

Attached is a small test program that I think demonstrates the bug
you have described.  When I run it linked against the current f90
library, I get:

  $ ./bug
 
   *** Testing netCDF text I/O with fill mode from Fortran 90.
   "abc   "
   "abc^@^@^@"
  STOP: 7

where I have substituted the two characters "^@" for a null byte that
actually gets printed.  Note that this is with nofill mode, so on my
platform it's padding with nulls anyway, although I expected garbage
padding instead from your description.

When I try the fixes you suggested to the nf90_put_var_text() function in
netcdf_text_variables.f90, running the code attached code for demonstrating
the bug, things seem to work OK:

  $ ./bug
 
   *** Testing netCDF text I/O with fill mode from Fortran 90.
   *** SUCCESS!

So I think this fixes the bug.  I'll check in the change and the fix will
be in the next release, as well as the current snapshot release.  I'll 
also put a note about the two-line patch in our "Known problems" web page,
in case anyone wants to just fix this problem before the next release ...

--Russ



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



Ticket Details
===================
Ticket ID: OLW-364027
Department: Support netCDF
Priority: Normal
Status: Closed

Attachment: bug.f90
Description: Binary data