Re: ndtooned out

From: Saji Njarackalazhikam Hameed <saji_at_nyahnyahspammersnyahnyah>
Date: Fri, 07 Apr 2006 11:36:02 -1000

Scott,

There is a function called mask. I think you would be able to do this
sort of thing efficiently with mask.

http://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml

something like
u_asc=mask(u_asc,wvc_asc.eq.0 .and. u_asc.eq.0, False)

may work...

saji

---
* Scott Capps <scapps_at_uci.edu> [2006-04-07 14:08:19 -0700]:
> Greetings,
> I am trying to place a FillValue where bad data is residing.  The 
> wvc_asc array (same size and shape as u_asc) determines where bad data 
> is located.  For all u_asc indicies with zero wind speeds, check to see 
> if wvc_asc is also zero.  If it is, place a @_FillValue at that index of 
> the u_asc array.
> This works just fine but, I want to limit my use of do....loops within NCL:
>    u_asc@_FillValue = -999.0
>    if (any(u_asc.eq.0)) then
>      ds = dimsizes(u_asc)
>      do idxlat=0,ds(0)-1
>        do idxlon=0,ds(1)-1
>          if (u_asc(idxlat,idxlon).eq.0) then
>            if (wvc_asc(idxlat,idxlon).eq.0) then
>              u_asc(idxlat,idxlon)=-999.0
>            end if
>          end if
>        end do
>      end do
>   end if
> Here is a more effecient way that I am trying to accomplish this but, it 
> is not producing the same results as the do....loop above:
>   if (any(u_asc.eq.0)) then
>      u_asc1D   = ndtooned (u_asc)   ;convert to 1D array
>      wvc_asc1D = ndtooned (wvc_asc) ;convert to 1D array
>      i0        = ind(u_asc1D.eq.0)  ;all indices eq 0
>      if (any(wvc_asc1D(i0).eq.0)) then
>        iwvc0          = ind(wvc_asc1D(i0).eq.0)
>       u_asc1D(iwvc0) = -999.0
>      end if
>      u_asc = onedtond(u_asc1D, dimsizes(u_asc));return to the original 
> array
>      delete (wvc_asc1D)
>      delete (u_asc1D)
>      delete (i0)
>      delete (iwvc0)
>    end if
> Any suggestions?
> Thank you,
> Scott Capps
> scapps_at_uci.edu
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- 
Saji N. Hameed,
Assistant Researcher,			Tel:808 9569534
International Pacific Research Center,	email:saji_at_hawaii.edu
2525 Correa Rd, Honolulu, HI 96822	http://iprc.soest.hawaii.edu/~saji
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 07 2006 - 15:36:02 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 07 2006 - 16:57:37 MDT