Hi Liz,
I don't think that NCL has an automatic way to restict interpolation
based on the distance to nearest data pt.
However, you can apply a distance restriction yourself by creating a
filter that uses gc_latlon. You would only have to run the filter once.
Unfortunately, there will be a triple do loop, so restricting your 2x2
grid to around Europe would speed things up.
http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml
(If anyone can come up with a faster way to do this please do...)
; Untested!
; cssout contains the output from cssgrid (2x2 grid), oldlat = 1D array
; of station latitudes, oldlon = 1D array of station longitudes.
;
distance = 500 ; set maximum distance in kilometers
lat = cssout&lat
lon = cssout&lon
temp = oldlat ; preallocate space for float array
do gg = 0,dimsizes(lat)-1
do hh = 0,dimsizes(lon)-1
do ii = 0,dimsizes(oldlat)-1
temp(ii) = gc_latlon(lat(gg),lon(hh),oldlat(ii),oldlon(ii),2,4)
end do
if (all(temp.gt.distance)) then
cssout(gg,hh) = cssout@_FillValue
end if
end do
end do
If multiple maps (on the same 2x2 grid based on the same stations)
require filtering, use the mask function to apply the same masking to
other maps. Applying the filtering to cssout2:
cssout2 = mask(cssout2,ismissing(cssout),False)
Hope that helps.
Adam
Liangying Zhang wrote:
> Dear all,
>
> I would like to interpolate some data from observation stations to
> regular grid box(2x2) and then plot it as contour lines. I found a
> function called "cssgrid" to do interpolation. But for those grid boxes
> which have no data nearby, I rather have missing value other than doing
> interpolation (It gave me very unreasonable data). Is there any way to
> put distance restriction for interpolation? Or NCL provides other
> functions which can do this?
>
> Attached is a plot with polymarkers on observation stations.
>
> Thanks a lot!
> Liz
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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-talkReceived on Thu Dec 29 2005 - 16:56:42 MST
This archive was generated by hypermail 2.2.0 : Sat Dec 31 2005 - 15:17:46 MST