Re: polygon problem

From: Michael Notaro <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Wed, 21 Jan 2009 13:24:52 -0600

Thanks for your email Adam.

I am trying to plot the distribution of a certain plant species.
The data consists of maybe 200 different polygon shapes,
some small and some larger. This particular polygon won't
plot and results in the entire map turning black. I agree this
particular polygon is small, but it still should work, since it
has 8 points and is a closed shape. Is this some sort of
NCL glitch, and if so, is there a way to work around it?
Ultimately, I want to plot all 200 polygons on one map, but if
some of the polygons cause a giant black box, then it won't work.

Mike

On Jan 21, 2009, at 1:13 PM, Adam Phillips wrote:

> Hi Michael,
>
> Your list of lat/lon points are over a very, very small area
> (latitude varies by ~.01 degrees) By enlarging your coordinate box
> I got a polygon to draw. I also switched your color map to rainbow
> so you can get a green like color. If I'm off base as to what you
> are looking for let me know.. Adam
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> begin
>
> wks = gsn_open_wks ("ps", "test")
> plot=new(1,graphic)
> setvalues wks
> "wkColorMap" : "rainbow"
> end setvalues
> res = True
> res_at_gsnFrame=False
> res_at_tiMainFontHeightF = 0.033
> res_at_tiMainString = "Plant Distribution"
> res_at_tmYROn = False
> res_at_tmXTOn = False
> res_at_mpOceanFillColor = -1
> res_at_mpLandFillColor = -1
> res_at_mpMinLonF = -180.00
> res_at_mpMaxLonF = -50.00
> res_at_mpCenterLonF = -115.
> res_at_mpMinLatF = 10.
> res_at_mpMaxLatF = 75.
> res_at_mpOutlineBoundarySets = "AllBoundaries"
> res_at_mpGeophysicalLineThicknessF = 2.5
> res_at_mpOutlineOn = True
> plot = gsn_csm_map(wks,res)
>
> lat=new((/8/),double)
> lon=new((/8/),double)
> lat=(/
> 59.4126815796,59.4171485901,54.4163818359,54.4119338989,54.4063796997,
> 59.4074935913,59.4108200073,59.4126815796/)
> lon=
> (/-130.6879730225,-135.674041748,-135.6725158691,-130.6683349609,-125.
> 6688842773,-125.6794433594,-130.686126709,-130.6879730225/)
>
> lat!0="lat"
> lat_at_units="degrees_north"
> lat&lat=lat
> lon!0="lon"
> lon_at_units="degrees_east"
> lon&lon=lon
> res1=True
> res1_at_gsFillScaleF = 3.0
> res1_at_gsFillColor = "forestgreen"
> gsn_polygon(wks,plot,lon,lat,res1)
> frame(wks)
> end
>
>
> Michael Notaro wrote:
>> This is a simpler version of the code. It just gives a map fully
>> covered in black.
>> For some reason, that set of lats/lons results in a problem.
>> Mike
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>> begin
>> wks = gsn_open_wks ("ps", "test")
>> plot=new(1,graphic)
>> setvalues wks
>> "wkColorMap" : "BlWhRe"
>> end setvalues
>> res = True
>> res_at_gsnFrame=False
>> res_at_tiMainFontHeightF = 0.033
>> res_at_tiMainString = "Plant Distribution"
>> res_at_tmYROn = False
>> res_at_tmXTOn = False
>> res_at_mpOceanFillColor = -1
>> res_at_mpLandFillColor = -1
>> res_at_mpMinLatF = 10.
>> res_at_mpMaxLatF = 75.
>> res_at_mpMinLonF = -180.00
>> res_at_mpMaxLonF = -50.00
>> res_at_mpCenterLonF = -115.
>> res_at_mpOutlineBoundarySets = "AllBoundaries"
>> res_at_mpGeophysicalLineThicknessF = 2.5
>> res_at_mpOutlineOn = True
>> plot = gsn_csm_map(wks,res)
>> lat=new((/8/),double)
>> lon=new((/8/),double)
>> lat=(/
>> 54.4126815796,54.4171485901,54.4163818359,54.4119338989,54.4063796997
>> ,54.4074935913,54.4108200073,54.4126815796/) lon=
>> (/-130.6879730225,-130.674041748,-130.6725158691,-130.6683349609,-130
>> .6688842773,-130.6794433594,-130.686126709,-130.6879730225/) lat!
>> 0="lat"
>> lat_at_units="degrees_north"
>> lat&lat=lat
>> lon!0="lon"
>> lon_at_units="degrees_east"
>> lon&lon=lon
>> res1=True
>> res1_at_gsFillScaleF = 1.0
>> res1_at_gsFillColor = "forestgreen"
>> gsn_polygon(wks,plot,lon,lat,res1)
>> frame(wks)
>> end
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> 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
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 21 2009 - 12:24:52 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 21 2009 - 13:09:22 MST