gsn_add_polymarker problem

From: Cecille Villanueva-Birriel <cvillanu_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 10 2012 - 18:50:44 MDT

Hello,

   I am trying to mark my locations on top of my contour map using "gsn_add_polymarker". However, for some reason is only marking a few of them and not all of them. I looked for errors and I can;t figure out why is not plotting all the locations. The only error I get is
warning:asciiread: End of file reached and only (325) elements were read from the file, filling remaining elements with the default missing value for the requested type

but I am not sure of this error is related to the markers not been plotted. I've copied my code below.

Cecille

;*************************************************
; rdm2grid_2.ncl
;*************************************************
; interpolates sparse random data to grid for smoother
; contours, written by SGLT Dec 2011
;***********************************************

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/contributed.ncl"

begin
;
;------------------------------------------------------------------
; Read data
;------------------------------------------------------------------
;
  diri = "./"
; fili = "Occurrences.txt"
; fili = "CCN.txt"
; fili = "CBtemp.txt"
; fili = "FLdepth.txt"
; fili = "WatFL.txt"
 fili = "timetoFL.txt"
; fili = "Alwc_FL.txt"
; fili = "PwcFL.txt"
; fili = "Pwc12C.txt"
; fili = "CCN_sens.txt" ;%changes
; fili = "CCN_sens_threshdelta.txt"
; fili = "Driz_FL.txt"
; fili2 = "Locations.txt"
; fili2 = "Locations_old.txt"
; data = asciiread(diri+fili,(/65,5/),"float")
; data = asciiread(diri+fili,(/65,3/),"float")
; data = asciiread(diri+fili,(/65,6/),"float") ;CCN sensitivity file %
  data = asciiread(diri+fili,(/65,7/),"float") ;CCN sensitivity file
; data = asciiread(diri+fili,(/50,5/),"float")

; below not needed if coords in data file above
; data2 = asciiread(diri+fili2,(/65,2/),"float")
; data2 = asciiread(diri+fili2,(/50,2/),"float")

  rlat = data(:,1)
  rlon = data(:,0)
; Z = data(:,2) ; # sndgs going into averaged past sndgs
; Z1 = data(:,3) ; # sndgs going into averaged future sndgs
; Z2 = data(:,4) ; # difference in past and future # sndgs
; Z = data(:,2) ; # xxx in past sndgs
; Z1 = data(:,3) ; # xxx in future sndgs
; Z2 = data(:,4) ; # difference of xxx in past and future
; Z = data(:,4) ; # xxx in past sndgs -CCN sens
; Z1 = data(:,5) ; # xxx in future sndgs -CCN sens

 Z = data(:,2) ; C values
; Z = data(:,4) ; FL depth change in m
; Z = data(:,4) ; change in w at FL in m/s
; Z = data(:,4) ; change in time to FL in s
; Z = data(:,4) ; change in alwc at FL in g/m3
; lat = data2(:,1)
; lon = data2(:,0)
;
  rlat@units = "degrees_north"
  rlon@units = "degrees_east"
; lat@units = "degrees_north"
; lon@units = "degrees_east"
;------------------------------------------------------------------
; Read grid point locations-- for interpolating data to grid
;------------------------------------------------------------------
  diri = "./"
  fil1 = "grid_lat.dat"
  fil2 = "grid_lon.dat"
  glat = asciiread(diri+fil1,30,"float")
  glon = asciiread(diri+fil2,70,"float")

  glat@units = "degrees_north"
  glon@units = "degrees_east"
;******************************************************************
; cssgrid
;******************************************************************
 zcss = cssgrid_Wrap (rlat, rlon, Z, glat,glon)
; zcss = cssgrid_Wrap (rlat, rlon, Z1, glat,glon)
; zcss = cssgrid_Wrap (rlat, rlon, Z2, glat,glon)
;------------------------------------------------------------------
; plot
;------------------------------------------------------------------

; wks = gsn_open_wks("ncgm","Occurrences_diff")
; wks = gsn_open_wks("ncgm","Occurrences_future")
; wks = gsn_open_wks("ncgm","Occurrences_past")
; wks = gsn_open_wks("ncgm","CCN_Cvalues")
; wks = gsn_open_wks("ncgm","TESTold") ; Open a workstation.
; wks = gsn_open_wks("ncgm","CBtemp_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","CBtemp_future") ; Open a workstation.
; wks = gsn_open_wks("ncgm","CBtemp_diff") ; Open a workstation.
; wks = gsn_open_wks("ncgm","FLdepth_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","FLdepth_future") ; Open a workstation.
; wks = gsn_open_wks("ncgm","FLdepth_diff") ; Open a workstation.
; wks = gsn_open_wks("ncgm","WatFL_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","WatFL_future") ; Open a workstation.
; wks = gsn_open_wks("ncgm","WatFL_diff") ; Open a workstation.
 wks = gsn_open_wks("ncgm","timetoFL_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","timetoFL_fut") ; Open a workstation.
; wks = gsn_open_wks("ncgm","timetoFL_diff") ; Open a workstation.
; wks = gsn_open_wks("ncgm","AlwcFL_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","AlwcFL_fut") ; Open a workstation.
; wks = gsn_open_wks("ncgm","AlwcFL_diff") ; Open a workstation.
; wks = gsn_open_wks("ncgm","PwcFL_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","PwcFL_fut") ; Open a workstation.
; wks = gsn_open_wks("ncgm","PwcFL_diff") ; Open a workstation.
; wks = gsn_open_wks("ncgm","Pwc12C_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","Pwc12C_fut") ; Open a workstation.
; wks = gsn_open_wks("ncgm","Pwc12C_diff") ; Open a workstation.
; wks = gsn_open_wks("ncgm","DrizFL_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","DrizFL_fut") ; Open a workstation.
; wks = gsn_open_wks("ncgm","DrizFL_diff") ; Open a workstation.
; wks = gsn_open_wks("ncgm","CCNsens_past") ; Open a workstation.
; wks = gsn_open_wks("ncgm","CCNsens_fut") ; Open a workstation.

  getvalues wks
     "wkColorMap" : cmap ; Retrieve the default color map.
  end getvalues

  cmap(0,:) = (/1.,1.,1./) ; Change background to white.
  cmap(1,:) = (/0.,0.,0./) ; and foreground to black.
  gsn_define_colormap(wks, cmap)

; gsn_define_colormap (wks,"GreenYellow")
; gsn_define_colormap (wks,"BlWhRe")
; gsn_define_colormap(wks,"amwg")
  
  res = True
;
; res@tiXAxisString = ":F25:longitude"
; res@tiYAxisString = ":F25:latitude"

  res@cnLinesOn = False ; turn off contour lines
  res@cnFillOn = True ; turn on color
  res@cnInfoLabelOn = False ; turn off info label
  res@pmLabelBarDisplayMode = "Always"
  res@lbPerimOn = False ;turn off label bar perimeter

  res@mpLimitMode = "LatLon"
  res@mpMinLonF = -127.0
  res@mpMaxLonF = -65.0
  res@mpMinLatF = 23.0
  res@mpMaxLatF = 52.0
; new
; res@sfXCStartV = -127.
; res@sfXCEndV = -58.
; res@sfYCStartV = 23.
; res@sfYCEndV = 52.
  res@gsnAddCyclic = False

  res@mpPerimOn = True ; Turn on map perimeter.

; res@vpXF = 0.1 ; Change the size and location of the
; res@vpYF = 0.9 ; plot on the viewport.
; res@vpWidthF = 0.7
; res@vpHeightF = 0.7

  res@gsnScale = True ; Force X/Y axes labels to be the same size.

  txres = True ; Set some resources
  txres@txFontHeightF = 0.010 ; for a text string.
  txres@txFontColor = 1
; gsn_text_ndc(wks,":F25:C (cm-3)",.45,.25,txres) ; Draw a text string.
; gsn_text_ndc(wks,":F25:deg C",1.45,.25,txres) ; Draw a text string.
; gsn_text_ndc(wks,":F25:meters ",.45,.25,txres) ; Draw a text string.
; gsn_text_ndc(wks,":F25:m/s ",.45,.25,txres) ; Draw a text string.
 gsn_text_ndc(wks,":F25:seconds ",.45,.25,txres) ; Draw a text string.
; gsn_text_ndc(wks,":F25:g/m3 ",.45,.25,txres) ; Draw a text string.
                                                       ; on the viewport.

  delete(cmap)
  cmap = (/(/1.00, 1.00, 1.00/), (/0.00, 0.00, 0.00/), \
           (/.560, .500, .700/), (/.300, .300, .700/), \
           (/.100, .100, .700/), (/.000, .100, .700/), \
           (/.000, .300, .700/), (/.000, .500, .500/), \
           (/.000, .400, .200/), (/.000, .600, .000/), \
           (/.000, 1.00, 0.00/), (/.550, .550, .000/), \
           (/.570, .420, .000/), (/.700, .285, .000/), \
           (/.700, .180, .000/), (/.870, .050, .000/), \
           (/1.00, .000, .000/), (/.700, .700, .700/)/)

; gsn_define_colormap(wks, cmap) ; Define a new color map.
; gsn_define_colormap(wks, "BlueDarkOrange18") ; Define a new color map.
; gsn_reverse_colormap(wks) ; reverse the color map.
 gsn_define_colormap(wks, "BrownBlue12") ; Define a new color map.
 ;gsn_define_colormap(wks, "BlueYellowRed") ; Define a new color map.
; gsn_define_colormap(wks, "gsltod") ; Define a new color map.

  res@mpFillOn = True ; Turn on map fill.
  res@mpFillAreaSpecifiers = (/"Water","Land","USStatesWater"/)
; res@mpSpecifiedFillColors = (/17,17,17/)
 ;res@mpSpecifiedFillColors = (/1,1,1/)
  res@mpSpecifiedFillColors = (/0,0,0/)

  res@lbLabelFontHeightF = 0.008 ; label bar font height
  res@lbLabelStride = 4

  res@gsnDraw = False ;so we can add poly stuff
  res@gsnFrame = False ; Don't advance frame.

  res@mpAreaMaskingOn = True ; Indicate we want to
  res@mpMaskAreaSpecifiers = "USStatesLand" ; mask land.
  res@mpPerimOn = True ; Turn on a perimeter.
; res@mpGridMaskMode = "MaskLand" ; Mask grid over land.
  res@cnFillDrawOrder = "Predraw" ; Draw contours first.

; res@sfXArray = rlon
; res@sfYArray = rlat

  res@gsnSpreadColors = True
; res@gsnSpreadColorStart = 12 ;for Bluedarkorange18
; res@gsnSpreadColorEnd = 20 ;for Bluedarkorange18
; res@gsnSpreadColorStart = 8 ;for Bluedarkorange18
; res@gsnSpreadColorEnd = 13 ;for Bluedarkorange18
; res@gsnSpreadColorStart = 8 ;for Bluedarkorange18
; res@gsnSpreadColorEnd = 13 ;for Bluedarkorange18
   res@gsnSpreadColorStart = 2 ;for Bluedarkorange18
 res@gsnSpreadColorEnd = 13 ;for Bluedarkorange18

  res@cnLevelSelectionMode = "ExplicitLevels" ; explicit levels
  res@cnLevels = (/700.,900.,1100.,1300.,1500.,1700.,\
      1900.,2100.,2300.,2500.,2700.,2900.,3100/) ;set levels
; res@cnLevels = (/10.,12.,14.,16.,18.,20.,22./) ;CB temp
; res@cnLevels = (/0.5,1.,1.5,2.,2.5,3./) ;CB temp diff
; res@cnLevels = (/0.,100.,200.,300.,400.,500.,600.,\
; 700,800,900.,1000.,1100.,1200.,1300.,1400.,1500./) ;set levels
; res@cnLevels = (/400.,500.,600.,700.,900.,1000.,\
; 1200,1500,2000.,2500.,3000.,4000./) ;set levels
; res@cnLevels = (/1500.,2000.,2500.,3000.,3500.,4000.,\
; 4500.,5000.,5500.,6000./) ;FL depth
; res@cnLevels = (/300.,400.,500.,600.,700.,800.,900./) ;FL depth diffs
; res@cnLevels = (/8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20./)
; res@cnLevels = (/1.,1.5,2.,2.5,3.,3.5,4./) ;w diffs
; res@cnLevels = (/-2.,-1.5,-1.,-0.5,0.,0.5,1.,1.5,2.,2.5,3./)
; res@cnLevels = (/0.,1.,2.,3.,4./)
; res@cnLevels = (/2.,2.5,3.,3.5,4.,4.5,5.,5.5,6.,6.5,7./) ;alwc
; res@cnLevels = (/0.2,0.4,0.6,0.8,1./) ;alwc diff
; res@cnLevels = (/0.5,1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.,5.5,6.,6.5/) ;pwc
; res@cnLevels = (/0.5,1.,1.5,2.,2.5/) ;pwc diff
; res@cnLevels = (/0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.,1.1,1.2/) ;driz
; res@cnLevels = (/0.001,0.01,0.03,0.05,0.07,0.09,0.1/) ;driz diffs
; res@cnLevels = (/-100.,-10.,-1.,-0.1,0.1/) ;CCN sensitivity%
; res@cnLevels = (/-1.,-0.75,-0.5,-0.25,0./) ;CCN sensitivity delta

  res@pmLabelBarSide = "Bottom"
  res@lbOrientation = "Horizontal"
  res@lbLabelFontHeightF = 0.01
; res@tiMainString = "# Sndgs going into avgd profiles"
; res@tiMainString = "C values for CCN"
; res@tiMainString = "Temp at CB"
; res@tiMainString = "Depth to FL"
; res@tiMainString = "Vertical velocity at FL"
; res@tiMainString = "Change in parcel ascent time to FL"
; res@tiMainString = "ALWC at FL"
; res@tiMainString = "PWC at FL"
; res@tiMainString = "Driz at FL"
; res@tiMainString = "PWC at -12C"
; res@tiMainString = "PWC sensitivity to CCN ,% change from C=700 to 2000"
; res@tiMainString = "PWC sensitivity to CCN , delta values"
  res@tiMainString = "Time to FL"
  map = gsn_csm_contour_map_ce(wks,zcss,res)
; --------------plot sites--------
  res_mark = True
; res_mark@gsMarkerIndex = 17 ; Filled circle
 ;res_mark@gsMarkerIndex = 16 ; dots
  res_mark@gsMarkerIndex = 2 ; crosses
  res_mark@gsMarkerSizeF = 15.
; res_mark@gsMarkerColor = "White"
  res_mark@gsMarkerColor = "Black"

; add polymarkers
  dum = gsn_add_polymarker(wks, map, rlon, rlat, res_mark)
; dum = gsn_add_polymarker(wks, map, lon, lat, res_mark)
  draw(map)
  frame(wks)
  end

> ********************************************************
> Cecille M. Villanueva Birriel
> Graduate Research Assistant
> Cloud Microphysics Research Group
> Purdue University
> Department of Earth and Atmospheric Sciences
> 550 Stadium Mall Drive, West Lafayette, IN 47907-2051
> email: cvillanu@purdue.edu
> ********************************************************

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 10 18:51:01 2012

This archive was generated by hypermail 2.1.8 : Fri Apr 13 2012 - 13:37:52 MDT