NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Harry Jenter writes: > From owner-netcdfgroup@xxxxxxxxxxxxxxxx Sun Oct 20 15:51:52 1991 > Received: by unidata.ucar.edu id AA00287 > (5.65c/IDA-1.4.4 for netcdfgroup-send); Sun, 20 Oct 1991 15:45:46 -0600 > Received: from isdres.er.usgs.gov by unidata.ucar.edu with SMTP id AA00283 > (5.65c/IDA-1.4.4 for <netcdfgroup@xxxxxxxxxxxxxxxx>); Sun, 20 Oct 1991 > 15:45:43 -0600 > Received: from stress.er.usgs.gov.noname by ISDRES.ER.USGS.GOV with SMTP; > Sun, 20 Oct 1991 17:14:45 -0400 (EDT) > Received: by stress.er.usgs.gov.noname (4.1/SMI-4.1) > id AA19222; Sun, 20 Oct 1991 17:14:01 EDT > From: hjenter@xxxxxxxxxxxxxxxxxx (Harry Jenter (x5890)) > Message-Id: <9110202114.AA19222@xxxxxxxxxxxxxxxxxx.noname> > Subject: Help! NCUNLIM question > To: netcdfgroup@xxxxxxxxxxxxxxxx > Date: Sun, 20 Oct 1991 17:14:01 EDT > X-Mailer: ELM [version 2.3 PL11] > Status: R > > I am attempting to write a hyperslab with multiple values in the > record dimension. No matter how big the hyperslab is, I only get > one value written in the array. I have written two little > programs to illustrate my problem. I'd really appreciate any > suggestions. Thanks. > > ------------------ cut here ------------------------- > THIS PIECE OF FORTRAN CODE IS NOT PRODUCING WHAT I EXPECT. > ------------------ cut here ------------------------- > Include '/usr/local/include/netcdf.inc' > Parameter (NDAT = 50) > Integer cdfid,xdim,xid,dims(1),corner(1),edges(1) > Real x(NDAT) > CDFID=NCCRE('test.cdf',NCCLOB,IRET) > xdim=NCDDEF(CDFID,'xdim',NCUNLIM,IRET) > dims(1)=xdim > xid=NCVDEF(CDFID,'level',NCFLOAT,1,dims,IRET) > Call NCENDF(CDFID,IRET) > do i=1,NDAT > x(i)=float(i) > end do > corner(1)=1 > edges(1)=NDAT > Call NCVPT(CDFID,XID,corner,edges,x,IRET) > Call NCCLOS(CDFID,IRET) > END > ------------------ cut here ------------------------- > THE OUTPUT > ------------------ cut here ------------------------- > netcdf test { > dimensions: > xdim = UNLIMITED ; // (1 currently) > > variables: > float level(xdim) ; > > data: > > level = 1 ; > } This is a bug. At the end of the is message find a patch (context diff) to netcdf/src/putget.c. This change will also appear in subsequent general releases of the netcdf. Glenn P. Davis UCAR / Unidata PO Box 3000 3300 Mitchell Lane, Suite 170 Boulder, CO 80307-3000 Boulder, CO 80301 (303) 497 8643 ------ snip snip ---- *** /tmp/RCSAa02144 Mon Oct 21 15:14:19 1991 --- putget.c Mon Oct 21 15:04:11 1991 *************** *** 2,8 **** * Copyright 1988, University Corporation for Atmospheric Research * See netcdf/README file for copying and redistribution conditions. */ ! /* $Id: putget.c,v 1.51 1991/10/08 19:20:09 davis Exp $ */ #include "local_nc.h" #include "alloc.h" --- 2,8 ---- * Copyright 1988, University Corporation for Atmospheric Research * See netcdf/README file for copying and redistribution conditions. */ ! /* $Id: putget.c,v 1.52 1991/10/21 21:03:51 davis Exp $ */ #include "local_nc.h" #include "alloc.h" *************** *** 680,685 **** --- 680,744 ---- static + NCsimplerecio(handle, vp, start, edges, values) + NC *handle ; + NC_var *vp ; + long *start ; + long *edges ; + Void *values ; + { + long offset ; + long newrecs ; + + /* 'start' should be verified as valid upon prior to entry to this + * routine + */ + if(*edges <= 0) + { + NCadvise(NC_EINVALCOORDS, "%s: Invalid edge length %ld", + vp->name->values, *edges) ; + return -1 ; + } + + /* check to see if we are trying to read beyond the end */ + newrecs = (*start + *edges) - handle->numrecs ; + if(handle->xdrs->x_op != XDR_ENCODE && newrecs > 0) + { + NCadvise(NC_EINVALCOORDS, "%s: Invalid Coordinates", + vp->name->values) ; + return -1 ; + } + + offset = NC_varoffset(handle, vp, start) ; + #ifdef VDEBUG + fprintf(stderr, "\t\t %s offset %d, *edges %lu\n", + vp->name->values, offset, *edges ) ; + arrayp("\t\t coords", vp->assoc->count, start) ; + #endif + + if(newrecs > 0) + handle->flags |= NC_NDIRTY ; + + if(!xdr_NCvdata(handle->xdrs, + offset, vp->type, + (unsigned)*edges, values)) + return(-1) ; + + if(newrecs > 0) + { + handle->numrecs += newrecs ; + if(handle->flags & NC_NSYNC) /* write out header->numrecs NOW */ + { + if(!xdr_numrecs(handle->xdrs, handle) ) + return(-1) ; + handle->flags &= ~NC_NDIRTY ; + } + } + return(0) ; + } + + + static NCvario(handle, varid, start, edges, values) NC *handle ; int varid ; *************** *** 718,723 **** --- 777,790 ---- if( !NCcoordck(handle, vp, start) ) return(-1) ; + + if( IS_RECVAR(vp) + && vp->assoc->count == 1 + && handle->recsize <= vp->len) + { + /* one dimensional && the only 'record' variable */ + return(NCsimplerecio(handle, vp, start, edges, values)) ; + } /* find max contiguous, check sanity of edges */ edp0 = NCvcmaxcontig(handle, vp, start, edges) ;
netcdfgroup
archives: