Re: Why does Fortran NCVPT not act as it should?

>I hope this is a case of my being relentlessly dense rather than what I consid-
>er to be unexpected behavior from NCVPT and/or the concept of hyperslabs.
>
>Suppose I have array X(10,10,10), the element going from 1 to 1000 in the stan-
>dard Fortran order, and I want to write out the first 5x5x5 "subcube" of X.
>
>So, I set start (dimension 3) to (1,1,1) and count (dim 3) to (5,5,5), and then
>call NCVPT as follows:
>
>call ncvpt(ncid,varid,start,count,X,rcode)
>
>*But*, when I do an 'ncdump', the list of X contains the first 125 elements, 
>(ie, 5x5x5 elements), numbering from 1 to 125, not what I would expect, namely,
>1-5, then 11-15, then 21-25, and so on.

The ncvpt subroutine does not know, for most implementations of fortran, the
actual array size in the calling fortran program.  The "start" and "count"
variables are *output* only and are always from the point of view of the
packed array in the c output file.

An argument could have (and was made) some time ago that the fortran array
dimensions should be included in the routine's arguments so that more intuitive
actions could happen within a fortran context.

If you really only need the primary array to be 5x5x5, then with Fortran 90
you could use dynamic memory allocation to specify just the array size you
need.


  • 1995 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: