Re: about gsn_add_polymarker and gsn_add_polyline

From: Mary Haley (haley AT ucar.edu)
Date: Wed Jun 22 2005 - 09:15:04 MDT

  • Next message: Mary Haley: "Re: NCL and NCEP-DOE Reanalysis (R2) GRIB files"

    Dear Jing,

    In order to use gsn_add_polymarker and gsn_add_polyline, the X/Y
    coordinates of the lines and markers
    must be in the same coordinate space as the plot you just created. In
    your case, your plot is a cylindrical
    equidistant map that goes from 0 to 40 latitude, and 100 to 140
    longitude, so your X/Y values need to
    be in the range 100 to 140 for X, and 0 to 40 for Y.

    In your script below, you are using values of x1 = (/32,29,24,21/) for
    your X values, and these are well
    outside the range 100 to 140, so that's why you are not seeing the
    lines or markers.

    I'm not sure what your x1/y1 values are supposed to represent, but you
    need to translate them to lat/lon
    coordinates. If they are already lat/lon values, then you need to
    either change the mpMin/MaxLon/LatF
    resources so that your map range includes the range of your x1/y1
    values, or you need to change your x1/y1 values to
    be in the correct range.

    --Mary

    On Jun 21, 2005, at 9:31 PM, Jing YANG wrote:

    > Hi, Everybody
    >
    > Now I am trying to mark tropical cyclone track overlaid on some shaded
    > fields with "gsn_add_polymarker" and "gsn_add_polyline"
    > But I am puzzled why I can not add dots and lines on the plot. My NCL
    > scripit is as follows:
    > ***********************************************************************
    > ************
    > .....
    >
    > sst!0= "lat"
    > sst&lat = f1->lat
    > sst!1 = "lon"
    > sst&lon = f1->lon
    > sst!2 = "mo"
    >
    > wks = gsn_open_wks("ps","tt-98-jul") ; open a ps file
    > gsn_define_colormap(wks,"wh-bl-gr-ye-re") ; choose a colormap
    > res = True ; use plot options
    > res@gsnDraw = False
    > res@gsnFrame = False
    > res@cnFillOn = True ; Fill contours
    > res@gsnSpreadColors = True ; use full range of colors
    >
    > res@mpMaxLatF = 40.
    > res@mpMinLatF = 0.
    > res@mpMaxLonF = 140.
    > res@mpMinLonF = 100.
    >
    > ;adding TC track
    > y1 = (/17,20,23,25/)
    > x1 = (/32,29,24,21/)
    >
    > dot = new(4,graphic)
    > dot_line = new(4,graphic)
    >
    > polyres = True
    > polyres@gsLineThicknessF = 8.0 ; 2.0 thickness of lines
    > polyres@gsLineColor = "white" ; color of lines
    > polyres@gsMarkerColor = "white" ; color of lines
    > polyres@xyMarker = 16 ; 14 polymarker style
    > polyres@gsMarkerIndex = 14 ; 14 polymarker style
    > polyres@gsMarkerSizeF = 0.1 ; polymarker size
    >
    > plot = gsn_csm_contour_map_ce(wks,sst(:,:,1),res)
    >
    > do i = 0,2
    > dot(i)=gsn_add_polymarker(wks,plot,x1(i:i+1),y1(i:i+1),polyres)
    > dot_line(i)=gsn_add_polyline(wks,plot,x1(i:i+1),y1(i:i+1),plres)
    > end do
    >
    > draw(plot)
    > frame(wks)
    > #######################################################################
    > ############
    >
    > whatever I change y1 and x1 to, it failed to mark TC on the panel.
    > Thanks for your help!
    >
    > Jing
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk@ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk

    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Wed Jun 22 2005 - 10:01:59 MDT