nfmpi_put_var_char expected behavior?
Jim Edwards
edwards.jim at gmail.com
Thu Aug 2 09:26:42 CDT 2012
Hi Wei-keng,
In standard netcdf I set NC_NO_FILL when I open the file and I still get
this behavior. I think that you just need to null terminate the string
when you pass it from fortran to c.
Jim
On Wed, Aug 1, 2012 at 7:58 PM, Wei-keng Liao
<wkliao at ece.northwestern.edu>wrote:
> Hi, Jim
>
> NetCDF's default for fill mode is NC_FILL and the default fill value for
> char type
> is NC_FILL_CHAR == (char)0. See netCDF user guide below.
>
> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c.html#nc_005fset_005ffill
> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c.html#Fill-Values
>
> In PnetCDF, only NC_NOFILL is implemented. So, for those spaces that were
> not
> written by the application, their contents are undefined.
>
>
> Wei-keng
>
> On Aug 1, 2012, at 11:27 AM, Jim Edwards wrote:
>
> > If I declare a character string variable with a length x and then write
> a string of length y<x using nfmpi_put_var_char
> > what is the expected behavior? I think that what I am getting is
> incorrect (a bunch of garbage in the string from y:x )
> >
> > So for example I want to write string './none/foo.009.nc' into a
> variable of length 80. In the file I am getting:
> >
> > './none/foo.009.nc 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0'
> >
> >
> > I think that this is a bug.
> >
> >
> > This is happening with the latest pnetcdf svn trunk code on jaguarpf
> compiled using:
> >
> > Currently Loaded Modulefiles:
> > 1) modules/3.2.6.6 10)
> xpmem/0.1-2.0400.31280.3.1.gem 19) DefApps
> > 2) xtpe-network-gemini 11) xe-sysroot/4.0.46
> 20) altd/1.0
> > 3) pgi/12.5.0 12) xt-asyncpe/5.11
> 21) subversion/1.6.17
> > 4) xt-libsci/11.1.00 13) atp/1.4.1
> 22) szip/2.1
> > 5) udreg/2.3.2-1.0400.5038.0.0.gem 14) PrgEnv-pgi/4.0.46
> 23) hdf5/1.8.7
> > 6) ugni/2.3-1.0400.4374.4.88.gem 15) xt-mpich2/5.5.0
> 24) netcdf/4.1.3
> > 7) pmi/3.0.0-1.0000.8661.28.2807.gem 16) xtpe-interlagos
> 25) esmf/5.2.0rp1
> > 8) dmapp/3.2.1-1.0400.4782.3.1.gem 17) eswrap/1.0.9
> > 9) gni-headers/2.1-1.0400.4351.3.1.gem 18) lustredu/1.0
> >
> > --
> > Jim Edwards
> >
> > CESM Software Engineering Group
> > National Center for Atmospheric Research
> > Boulder, CO
> > 303-497-1842
> >
>
>
--
Jim Edwards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/parallel-netcdf/attachments/20120802/cee30bc4/attachment.html>
More information about the parallel-netcdf
mailing list