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

Re: 950509: question



>Organization: .
>Keywords: 199505091712.AA04662

Hi Mark,

>       I am using the routine NCVGT to input a "slab" of values.  In some
> cases the size of the array is (21,nrec) and other times it is (22,nrec).
> It seems that I should be able to use the above hyperslab routine to
> correctly place the values into the (22,nrec) array even if the stored
> array is dimensioned differently (21,nrec).  But I am having problems
> getting the values to be stored correctly.
> 
> Below, is a code segment which I believe should handle both cases - but it 
> does not.  Can NCVGT() do what I have described?  If so, what am I doing
> wrong?
> 
> Thanks.
> 
>                                                       - Mark
> 
> ****************************** CODE *************************************
> 
>       CALL NCVINQ(NCID,varnum,DUMMY,NTP,NVDIM,VDIMS,NVS,RCODE)
>       LENSTR=1
>       DO 160 J=1,NVDIM
>       CALL NCDINQ(NCID,VDIMS(J),DUMMY,NDSIZE,RCODE)
>       LENSTR=LENSTR*NDSIZE
>       START(J)=1
>       COUNT(J)=NDSIZE
>  160  CONTINUE
>       CALL NCVGT(NCID,varnum,START,COUNT,presMan,RCODE)
> 
> 
> 
> 
>       In this example, presMan is declared to be (22,nrec) but the data
> can be either (21,nrec) or (22,nrec).

Since the leading dimension of the presMan array isn't passed to NCVGT, it
doesn't know its value and can't use it to compute where to store data.

NCVGT and all the netCDF Fortran interfaces deal with consecutive blocks of
data, as if the Fortran variables were dimensioned exactly the same as the
netCDF variables.  Otherwise we would have had to include extra arguments
for the leading dimensions that were used in the Fortran variable
declarations, and we would have had to provide separate functions for 1D, 2D,
3D, ... variables, greatly increasing the number of functions in the netCDF
Fortran interface.

By the way, this would have worked OK if presMan had instead been
dimensioned (nrec,21) or (nrec,22), since the last dimension plays no part
in indexing calculations.

--Russ

______________________________________________________________________________

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