X = V(i,:,:,...,:)
printVarSummary(X)
Note_1: X has one less dimension. NCL *automatically* does
"rank reduction". NCL would call this a variable to
variable transfer. All of V meta data is copied to X.
One additional attributemay be added .... For
example, if the index "i" corresponded to a dimension
named "time" then a time attribute will be added.
No information would be lost.
Note_2: General NCL comments.
To override NCL's automatic rank reduction and
retain the rank of V when performing the copy use
X = V(i:i,:,:,...,:)
The dimensionality (rank) of any variable in memory may be
determined via:
dimV = dimsizes( V )
rankV = dimsizes( dimV )
or, equivalently
rankV = dimsizes( dimsizes(V) )
To determine the rank of a variable on a file
without reading the variable to memory
f = addfile ("foo.nc/grb/hdf/hdfeos", "r")
rankV = dimsizes( filevardimsizes(f, "V") )
http://www.ncl.ucar.edu/Document/Functions/Built-in/filevardimsizes.shtml
Ummm, "filevardimsizes" is long enough to qualify as a German word! :-)
Jan Ploski wrote:
> Hello,
>
> A few days ago I learned from Dennis how to increase dimensionality
> (rank), and now I am running into trouble with the opposite procedure.
> Given a variable V, which has n dimensions (n is not known until run time)
> and an index i, how can I efficiently copy V(i,:,:,...,:) to a new
> variable X with n-1 dimensions?
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 05 2007 - 07:32:35 MST
This archive was generated by hypermail 2.2.0 : Wed Dec 05 2007 - 10:17:04 MST