Re: removing degenerate dimensions

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 16 2010 - 16:05:21 MDT

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:05:31 2010

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