Re: RE : [ncl-talk] Re: adding a rectangle to a map

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 13 Dec 2007 09:05:27 -0700 (MST)

Hi Louis,

The method that Jamie showed you is correct. When you use
gsn_add_polyline, it actually attaches the lines to your plot, so in
order for the boxes to show up, you need to draw the plot:

begin
...
    res = True ; mods desdired
    res_at_gsnDraw = False ; Turn off draw of plot
                                              ; until we add boxes.
    res_at_mpOceanFillColor = 5 ; array index in color map
    res_at_mpLandFillColor = 164 ; for land, ocean, and inland h20
    res_at_mpInlandWaterFillColor = 54

    plot = gsn_csm_map_ce(wks,res) ; draw global map

    <use Jamie's code to attach boxes>

    draw(plot)
    frame(wks)
end

Also, you need to make sure that the "xptsa" points are the longitude
values, and the "yptsa" are the latitude values.

If you are doing all of this and still having a problem, then feel
free to email me your code and I'll take a look.

--Mary

On Thu, 13 Dec 2007, louis Vonder wrote:

> Thanks,
> Despite the suggestion of James I am not able to add boxes on map.
>
> Thank yoou for your time
>
> Jamie Scott <James.D.Scott_at_noaa.gov> a écrit : Add this after your call to gsn_csm_map_ce:
>
> ; add boxes for regional averages
> ; add the box
> ;************************************************
> resb = True ; polyline mods desired
> resb_at_gsLineColor = "black" ; color of lines
> resb_at_gsLineThicknessF = 2.5 ; thickness of lines
>
>
>
> rega=new(4,graphic) ; new graphic variable -- one for each line in rectangle
>
>
> yptsa = (/25., -25., -25., 25.,25./) ;define lat points for each line
> xptsa = (/310., 310., 360., 360.,310./) ; define lon points for each line
>
>
> ;draw each line on plot
> do i = 0,3
> rega(i)=gsn_add_polyline(wks,plot,xptsa(i:i+1),yptsa(i:i+1),resb) ;draw line from start point to end point
>
> end do
> ;;;;;;;;;;;;;;;;;;
>
>
>
> Jamie Scott
> NOAA/ESRL/PSD
> james.d.scott_at_noaa.gov
>
>
> On Dec 12, 2007, at 9:31 AM, ncl-talk-request_at_ucar.edu wrote:
>
> Dear NCL users,
>
>
> I am trying to add rectagle on a map.
>
>
> There is way to modify the following NCL example to perform it?
>
>
> To add for exemple a rectangle bounded by coordinates
>
>
> (-50°, 0°) Longitude and (-25°, 25°) latitude.
>
>
>
>
> ;================================================;
> ; maponly_3.ncl
> ;================================================;
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ; ================================================;
> begin
>
>
> wks = gsn_open_wks("ps","maponly") ; open a ps file
> gsn_define_colormap(wks,"wh-bl-gr-ye-re") ; choose a colormap
>
>
> res = True ; mods desdired
> res_at_mpOceanFillColor = 5 ; array index in color map
> res_at_mpLandFillColor = 164 ; for land, ocean, and inland h20
> res_at_mpInlandWaterFillColor = 54
>
>
> plot = gsn_csm_map_ce(wks,res) ; draw global map
>
>
> end
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> ---------------------------------
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 13 2007 - 09:05:27 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 13 2007 - 09:06:05 MST