[ncl-talk] variable dimension specifier

Mark.Collier at csiro.au Mark.Collier at csiro.au
Sun Feb 15 18:41:57 MST 2015


Hi,
is it possible to reference an input variable dimension list with a variable, for example

data=fh->pr(colons)

where the variable pr is defined in the data file pointed to be the file handle fh.

where colons is a list that could vary in length, e.g. “:,:,:” or “:,:” depending on whether it was a 3,2 or n dimensioned quantity?

The reason for this, is sometimes it is necessary to specify the colon list without knowing the variables dimension, and without having to result to if, else if control flow for each dimension case…

Ideally colons could be a function taking an integer argument to specify the list

e.g. colons(3) would reflect “:,:,:”

I’ve tried to do this but I guess the : are a unique quantity not able to be defined by a simple string argument…

Thanks,
Mark.


More information about the ncl-talk mailing list