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

Re: Variable stride in array indices and other enhancements

Jack Saba wrote:
> I agree. The format that worked is not only REALLY ugly, it's unwieldy.
> It's also more difficult than necessary to figure out the correct syntax
> for any individual case.

No argument from me.

In many cases, I suspect people just want to do what Ken asked: extract
every nth element along each dimension. Perhaps we could come up with a
specification for an array dicing routine.

The closest paradigm in IDL that I'm aware of is the netCDF routine
NCDF_VARGET (see the Scientific Data Formats documentation). It is a
general purpose routine for reading multi-dimensional arrays from netCDF
files. It also recognizes that users might want to read subsets of an
array, including skipping elements along each dimension. The following
optional keywords to NCDF_VARGET are allowed in IDL 5.2:

An optional vector containing the counts to be used in reading Value.
COUNT is a 1-based vector with an element for each dimension of the data
to be written.The default matches the size of the variable so that all
data is written out.

An optional vector containing the starting position for the read. The
default start position is [0, 0, ...].

An optional vector containing the strides, or sampling intervals,
between accessed values of the netCDF variable. The default stride
vector is that for a contiguous read, [1, 1, ...].

Perhaps we could design a specification for a function to dice an
existing array in memory which accepted similar keywords.


Liam E. Gumley
Space Science and Engineering Center, UW-Madison