Re: filled spherical polygon problem

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 25 2011 - 09:55:46 MDT

Li,

I've filed an official ticket on this (NCL-1065 for your reference).

I've narrowed it down to two polygons: one that draws okay and one that doesn't. The script below illustrates this.

Unfortunately, I don't know of any simple workaround at the moment.

--Mary

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("x11", "parcel")

    res = True
    res@gsnFrame = False
    res@gsnMaximize = True
    res@mpFillOn = False
    res@mpOutlineOn = False
    res@mpGreatCircleLinesOn = True
    res@mpGridLatSpacingF = 1.5
    res@mpGridLineColor = "background"
    res@mpCenterLonF = 180
    res@mpMinLatF = -80
    res@mpMaxLatF = -30
    res@mpMinLonF = 30
    res@mpMaxLonF = 100

;---draw polygons
    gnres = True
    mkres = True

;---These values form a "nice" polygon.
    lat1 = (/-38.1,-45.1,-52.7,-60.2,-61.4,-54.8,-47.2,-39.7,-38.1/)
    lon1 = (/ 32.6, 34.5, 38.9, 45.6, 48.5, 41.6, 36.9, 33.7, 32.6/)

    res@tiMainString = "This polygon is okay"
    map = gsn_csm_map(wks,res)
    gnres@gsFillColor = "brown"
    gsn_polygon(wks, map, lon1, lat1, gnres)
    gsn_polymarker(wks, map, lon1, lat1, mkres)
    frame(wks)

;---These values do NOT form a "nice" polygon.
    lon2 = (/ 38.7, 47.3, 91.5, 96.3, 66.7, 50.0, 40.2, 38.7/)
    lat2 = (/-57.4,-65.2,-74.7,-74.4,-71.2,-65.2,-58.1,-57.4/)

    res@tiMainString = "This polygon is not okay"
    map = gsn_csm_map(wks,res)
    gnres@gsFillColor = "blue"
    gsn_polygon(wks, map, lon2, lat2, gnres)
    gsn_polymarker(wks, map, lon2, lat2, mkres)
    frame(wks)

end

On Mar 24, 2011, at 2:57 PM, Mary Haley wrote:

> Hi Li,
>
> I'm looking into this. There's something odd about the ordering of the points that causes the problem in some cases and not others.
>
> In some situtations, the problem is due to big jumps in your longitude values, which can be solved by subtracting from 360.
>
> --Mary
>
> On Mar 24, 2011, at 3:43 AM, Li Dong wrote:
>
>> Dear all,
>>
>> I want to plot many spherical polygons filled with color that cover the whole sphere, but NCL fills some polygons wrongly, that is the entire map has been filled except the polygons. I have asked this question some time ago:
>>
>> http://www.ncl.ucar.edu/Support/talk_archives/2010/2644.html
>>
>> But the problem still exists. The attachment contains the scripts and data. Can anyone solve this problem? Thanks a lot!
>>
>> Best regards,
>>
>> Li Dong
>>
>> <ncl_polygon_problem.tar.gz>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 25 09:55:52 2011

This archive was generated by hypermail 2.1.8 : Mon Mar 28 2011 - 08:51:50 MDT