Re: removing degenerate dimensions

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 16 2010 - 16:48:53 MDT

I had started the following but someone came to my office.
I saw Mary's reply and Rob's response. Basicaly, this was
the same approach suggested by MH.

=========================================

In what context? reading from a file?

http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml
has an option for GRIB files "SingleElementDimensions"

Otherwise ... *untested*

undef("elimDimOne")
function elimDimOne (x)
local dimx, i
begin
   dimx = dimsizes(x)
   i = ind(dimx.ne.1)
   if (.not.ismissing(i(0))) then
       return( onedtond(ndtooned(x),dimx(i)) )
   else
       return( x )
   end if
end

On 04/16/2010 02: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

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 16 16:50:26 2010

This archive was generated by hypermail 2.1.8 : Fri Apr 23 2010 - 14:40:07 MDT