Re: Re: Re: Re: [ncl-talk] Reducing the rank of an arbitrary variable

From: Jan Ploski <Jan.Ploski_at_nyahnyahspammersnyahnyah>
Date: Thu, 6 Dec 2007 09:35:07 +0100

ncl-talk-bounces_at_ucar.edu schrieb am 12/06/2007 02:21:13 AM:

> Jan,
>
> > newvar = var would work if newdims had fewer elements than
> > dimsizes(var)... I thought NCL would complain about mismatched
> > dimensionality of the left-hand and right-hand side of the assignment
in
> > that case?
>
> I thought Dennis explained this very well (please see Dennis mail
related to
> this thread)
>
> Here is an example.
>
> var=new( (/20,30,1/), "float")
> var=1.0
> var!0="x"
> var!1="y"
> var!2="z"
> printVarSummary(var)
> newvar=removeRedundantDimsOf(var)
> printVarSummary(newvar)
...
> I don't know if it may suit your needs. What it does is the following.
> If the size of one the data dimensions is 1, it identifies that
> dimension and removes it. For example data(lat,lon,time).. if there
> is only one latitude values (dimsizes(lat) = 1), it reduces the
> size of the array by removing the "lat" dimension.

Thanks, now I understand. The dimension from which I want to extract data
doesn't have rank = 1, so I'll keep your code snippet for later :-)

-JPL
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 06 2007 - 01:35:07 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 11 2007 - 14:19:21 MST