ncl-talk-bounces_at_ucar.edu schrieb am 12/05/2007 03:37:56 PM:
> Hi Jan,
>
> Don't know if this will help..I use this to reduce the
> dimensionality of an array when
> the size of the array element is less than 1. It also returns the
> modified dimension
> names array.
>
> function removeRedundantDimsOf(var)
> begin
> var_dims=dimsizes(var)
> dim_names=getvardims(var)
> new_indcs=ind(var_dims.gt.1)
> newdims=var_dims(new_indcs)
> new_dimnames=(dim_names(new_indcs))
> ndims=dimsizes(newdims)
> newvar=new(newdims,typeof(var))
> newvar=var
> do i=0,ndims-1
> newvar!i=new_dimnames(i)
> end do
> return(newvar)
> end
Saji,
Could you please post print(var) and print(newvar) for a little example of
what the function is supposed to do? I am confused why the assignment
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?
Regards,
Jan Ploski
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 05 2007 - 08:28:25 MST
This archive was generated by hypermail 2.2.0 : Wed Dec 05 2007 - 10:17:04 MST