Re: removing degenerate dimensions

From: Rob Nicholas <rnicholas_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 16 2010 - 16:12:40 MDT

Thanks Mary -- that works well.

On Fri, Apr 16, 2010 at 3:05 PM, Mary Haley <haley@ucar.edu> wrote:
> Hi Rob,
>
> There's no automatic way to do this. The simple way, that doesn't retain
> metadata, is
> to simply use onetodond and ndtooned to reshape your array:
>
>  ii = ind(dims.ne.1)    ; Get non-degenerate dimensions.
>  new_dims = dims(ii)    ; New dimension sizes.
>
> ;--Reshape array to new dimension sizes
>  x2 = onedtond(ndtooned(x),new_dims)
>
> If you need to retain metadata, this is a little more complicated.
> See the attached "rm_degen_dims" function with a test
> driver.
>
> --Mary
>
>
>
>
> On Apr 16, 2010, at 2:24 PM, Rob Nicholas wrote:
>
>> Is there a *general* way to remove degenerate dimensions from a
>> variable?  In other words, is it possible to remove all degenerate
>> dimensions without having to know which dimensions might be degenerate
>> or even how many dimensions a variable has?
>>
>> Thanks,
>> Rob
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 16 16:16:07 2010

This archive was generated by hypermail 2.1.8 : Fri Apr 16 2010 - 16:21:29 MDT