Sean,
I highly recommend upgrading your version of NCL, since 4.3.0 is
already 2 versions old. However, if you can't upgrade for some
reason, and if the only thing you are missing is the "where" function,
then you can rewrite the "where" code below using "ind" and
"ind_resolve". Note that I'm assuming "lu" is 2D:
ii = ind(ndtooned(lu).eq.itype) ; Get indices where lu == itype
if(.not.all(ismissing(ii))) then
dsizes_lu = dimsizes(lu)
data = new(dsizes_lu,typeof(lu),lu@_FillValue)
iir = ind_resolve(ii,dsizes_lu) ; Resolve indices to their 2D
; representations.
do i=0,dimsizes(ii)-1
data(iir(i,0),iir(i,1)) = lu(iir(i,0),iir(i,1))
end do
end if
If lu were 3D, then you would need to change the code inside the loop
to:
data(iir(i,0),iir(i,1),iir(i,2)) = lu(iir(i,0),iir(i,1),iir(i,2))
and so on.
--Mary
On Tue, 4 Sep 2007, Sean Heuser wrote:
> Soyoung,
> Thank you for the code. Unfortunately I do not have the updated version,
> that's why I was hoping there could be a way to do it via an if loop or a
> do loop or something. Anyone out there know if this is possible for my
> land use filter? Thanks.
>
> -Sean
>
>> Sean Heuser wrote:
>>> Hello,
>>> I am trying to plot land use using the WRF ARW package. However, I
>>> would
>>> only like to plot the areas that have a land_use equal to a certain
>>> value(say 7 for this case). Is there any simple way to do it? I was
>>> thinking I need an if loop but I'm not sure how to set it up. Thanks
>>> for
>>> any help.
>>>
>>> -Sean
>>>
>>>
>>>
>> a=addfile("wrfout_d01_2006-10-07_12:00:00.nc","r")
>> lu=a->LU_INDEX(0,:,:)
>> lu@_FillValue=-999 ; Missing value
>>
>> itype=7 ; Landuse index to plot
>> data=where(lu.eq.itype,lu,lu@_FillValue)
>> ndata=num(.not.ismissing(data)) ; Just to check how many non-missing
>> data we've got here.
>> print(ndata)
>>
>> wks=gsn_open_wks("ncgm","luidx"+itype)
>> gsn_define_colormap(wks,"rainbow")
>>
>> res = True
>> res_at_cnFillOn = True
>> res_at_cnLinesOn = False
>> ....
>> plot = gsn_csm_contour_map(wks,data,res)
>> ------------------------------------------------------------------
>> Here, to use "where" function, you should use a version 4.3.0 or higher.
>>
>> Good luck,
>>
>>
>> Soyoung
>>
>
>
> --
> Sean Heuser
> Masters Student
> Department of Marine, Earth & Atmospheric Sciences
> North Carolina State University
> spheuser_at_ncsu.edu
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 04 2007 - 16:03:49 MDT
This archive was generated by hypermail 2.2.0 : Wed Sep 05 2007 - 07:49:00 MDT