Re: ncl - no data value interpolation

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 09 Dec 2005 15:21:41 -0700

Hi Micah,

The solution to your issue can be quite complex. Reading your two emails
though I believe you are OK with a simple approach, so I wrote up a
short code filling in the values based on the 2 grid points east of the
missing gridbox. (Things can get quite complex if you wanted to take
into account say the 9 closest pts latitudinally/longitudinally.) Thus,
this will work for the east coast of continents only. It could be easily
applied to other coasts though if desired. Also, make sure you limit the
input data going into this to just the east coast of the US.

(untested) starting with array arr dimensioned lat x lon

arr = linmsg(arr,(/0,3/)) ; to fill in Cape Cod Bay area
do gg = 0,dimsizes(arr&lon)-1
    temp = ind(.not.ismissing(arr(gg,:)))
    arr(gg,temp(0)-1)=(/ ((arr(gg,temp(0))*2))-arr(gg,temp(0)+1) /)
    delete(temp)
end do

The linmsg line will fill in all areas longitudinally that have more
than 3 consecutive missing values. Documentation:
http://www.ncl.ucar.edu/Document/Functions/Built-in/linmsg.shtml
(See example 3)

Note, that if we have grid points x1 x2 x3 , and x1 is missing,
I am using the formula x1 = 2*x2 - x3

You might have to run your array thru the above code a few times to fill
in all the data that you want. Then, when plotting, set mpFillDrawOrder
= "PostDraw"...

Hope that helps...
Adam

Micah Sklut wrote:
> Following up on my previous email for dealing with the no data values...
>
> Here is an example image:
> http://udel.edu/~micahs/wna_ne00.gif
> code:
> http://udel.edu/~micahs/wna_ne.ncl
>
> As you can see by the image, my contours are smooth (non raster), but
> the no data
> values along the coastline become blocky.
>
> I understand this is the nature of the dataset, but I'm looking for a
> technique to interpolate the data values into the no data areas (however
> un-scientific that may be...).
>
> Thanks.
>
> Micah
>
>
> On 12/9/05, *Dennis Shea* <shea_at_cgd.ucar.edu <mailto:shea_at_cgd.ucar.edu>>
> wrote:
>
> >I am working with ocean data sets at resolutions of .25 - 1.0
> degrees. When
> >I make plots of small areas, the no data
> >values around the coastlines remain in raster format - appear blocky.
>
> >Are there techniques out there to avoid this visual impairment ?
>
> >I was thinking maybe interpolating the no data values to surrounding
> values..?
>
> Hi Micah
>
> offline
>
> Perhaps u could make a figure which could be seen via the WWW?
>
> D
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Dec 09 2005 - 15:21:41 MST

This archive was generated by hypermail 2.2.0 : Sun Dec 11 2005 - 21:54:52 MST