Hi again,
Dave Brown pointed out that the example I pointed Haibin to may not be
very useful if you have 2D lat/lon arrays, which is likely the case
here.
So, here's a script that shows a very basic way to add lat/lon lines
(represented by 2D arrays) to your map. Note that I don't draw every
single line, because it would be too cluttered in this case.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/pop.nc","r")
lat2d = a->lat2d
lon2d = a->lon2d
wks = gsn_open_wks("x11","map")
res = True
res_at_gsnFrame = False ; Don't draw plot or advance frame just yet.
res_at_gsnDraw = False
plot = gsn_csm_map(wks,res) ; Create map.
nlat = dimsizes(lat2d(:,0)) ; Get size of lat/lon arrays.
nlon = dimsizes(lat2d(0,:))
dum1 = new(nlat,graphic) ; Create arrays to hold dummy objects.
dum2 = new(nlon,graphic)
gsres = True
;
; Add every 5th latitude line.
;
do i=0,nlat-1,5
dum1(i) = gsn_add_polyline(wks,plot,lon2d(i,:),lat2d(i,:),gsres)
end do
;
; Add every 10th longitude line.
;
do i=0,nlon-1,10
dum2(i) = gsn_add_polyline(wks,plot,lon2d(:,i),lat2d(:,i),gsres)
end do
;
; Now draw the plot, which has the lat/lon lines added.
;
draw(plot)
frame(wks)
end
--Mary
On Wed, 28 Mar 2007, Mary Haley wrote:
>
>
> On Wed, 28 Mar 2007, Haibin Li wrote:
>
>> Hello there,
>> Thanks to the sample code provided on the UCAR NARR data website, I
>> was able to plot the NARR data in the original Lambert Conformal map
>> projection. But I would like to further plot/delineate the grid lines
>> (277*349 ) for the Lambert Conformal projection of NARR data. I just
>> wonder whether there is a way to do it and how. The reason I want to
>> do this is that I have some station data and I want to identify those
>> grids corresponding to known (lat,lon) stations and extract those grid
>> values.
>> Thanks.
>>
>> Regards,
>> Haibin
>
> Dear Haibin,
>
> The way to do this is by using gsn_add_polyline to add lat/lon polylines to
> your map before you draw it. Please see example 6 at:
>
> http://www.ncl.ucar.edu/Applications/polyg.shtml
>
> This should work for any map projection.
>
> --Mary
>
>
>> 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 Wed Mar 28 2007 - 16:51:26 MDT
This archive was generated by hypermail 2.2.0 : Sun Apr 01 2007 - 11:52:46 MDT