[ncl-talk] variable dimension specifier

Jatin Kala jatin.kala.jk at gmail.com
Sun Feb 15 19:22:54 MST 2015


Hi Mark,
Maybe use something like getfilevardimsizes:
https://www.ncl.ucar.edu/Document/Functions/Built-in/getfilevardimsizes.shtml
That should tell you the number of dims




On 16/02/15 12:41 PM, Mark.Collier at csiro.au wrote:
> 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.
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk



More information about the ncl-talk mailing list