[ncl-talk] Sub: How to choose Lat & Lon?

Mary Haley haley at ucar.edu
Wed Dec 9 09:56:25 MST 2015


If you don't need a lambert conformal plot, then I suggest doing a simple
lat/lon plot.  Instead of

  res at mpProjection                = "LambertConformal"
  res at mpLambertParallel1F         = tlat1
  res at mpLambertParallel2F         = tlat2
  res at mpLambertMeridianF          = clon

  res at mpLimitMode                 = "Corners"
  res at mpLeftCornerLatF            = lat2d(20,18)
  res at mpLeftCornerLonF            = lon2d(20,18)
  res at mpRightCornerLatF           = lat2d(58,52)
  res at mpRightCornerLonF           = lon2d(58,52)

I suggest:

  res at mpMinLatF                 = min(lat)
  res at mpMaxLatF                 = max(lat)
  res at mpMinLonF                 = min(lon)
  res at mpMaxLonF                 = max(lon)

You can also put in whatever lat/lon values you want for the above four
resources, instead of using min/max. Sometimes I like to add a little bit
of a margin so I can see the plot better:

  res at mpMinLatF                 = min(lat)-1
  res at mpMaxLatF                 = max(lat)+1
  res at mpMinLonF                 = min(lon)-1
  res at mpMaxLonF                 = max(lon)+1

On Tue, Dec 8, 2015 at 10:48 AM, Adv <advita6 at gmail.com> wrote:

> Hi,
> I have been trying to modify this code
> https://www.ncl.ucar.edu/Applications/Scripts/station_1.ncl  to plot data
> set with four states station data. I don't know how to select values for
>
> tlat1 = 60.0
> tlat2 = 30.0
> clon  = -98.5
> clat  =  36.3
>
> and also for
> res at mpLeftCornerLatF            = lat2d(20,18)
>   res at mpLeftCornerLonF            = lon2d(20,18)
>   res at mpRightCornerLatF           = lat2d(58,52)
>   res at mpRightCornerLonF           = lon2d(58,52)
>
> I attached here a file i use to plot.
> begin
>  strll  = asciiread("stationmac.txt", -1, "string") ;
>   print(strll)   ; STATION","STATION_NAME", "LAT", "LON"
>   print("=====")
>
> sloc = str_get_field(strll , 2, ",")
>   lat  = tofloat( str_get_field(strll , 3, ",")  )
>   lon  = tofloat( str_get_field(strll , 4, ",")  )
>   print(sloc +" : "+lat+" "+lon)
> dimsizes(lat)
> dimsizes(lon)
>  NOBS  = 65
> diri="/home/dailysimms/prec-obs/01/"
> z1 = asciiread(diri+"PrecJan1965-2014",-1,"float")
> print(z1)
> printVarSummary(z1)
> ;a = (/1,2,3,4,5,6,7,8/)
> ;391 rows by 50 columns
> a0 = onedtond(z1,(/391,50/))
> ;print(a0)
> x=dim_avg(a0)
> print(x)
> ;
> ; This second file is not so tricky.  The 2D lat/lon data is sorted with
> ; lat values first, and then lon values.
> ;
>   nlat     = 70
>   nlon     = 70
>   latlon2d = asciiread("stn_latlon.dat",(/2,nlat,nlon/),"float")
>   lat2d    = latlon2d(0,:,:)
>   lon2d    = latlon2d(1,:,:)
>
>   delete(latlon2d)
>
>   tlat1 = 60.0
>   tlat2 = 30.0
>   clon  = -98.5
>   clat  =  36.3
>
> ;***********************************************
> ; Plot
> ;***********************************************
>  pltDir = "./"
> ;  wks = gsn_open_wks("x11",pltDir+pltNam)
>     wks = gsn_open_wks("x11","god")
>  gsn_define_colormap(wks,"WhViBlGrYeOrRe")
>
>   res                             = True
>   res at gsnFrame                    = False   ; So we can draw markers
>   res at gsnMaximize                 = True
>
> res at gsnSpreadColors             = True
>   res at gsnSpreadColorEnd           = 90
>
> res at trGridType                  = "TriangularMesh"
>
> res at cnLevelSelectionMode        = "ManualLevels"
>   res at cnMinLevelValF              = 15          ; 15.25
>   res at cnMaxLevelValF              = 20          ; 49.75
>   res at cnLevelSpacingF             = 0.125
>
> res at cnFillOn                    = True
>   res at cnLinesOn                   = False
> res at cnLineLabelsOn              = True
>   res at cnLevelFlags                = new(139,"string")
>   res at cnLevelFlags(:)             = "NoLine"
>     res at cnLevelFlags(0::20)         = "LineAndLabel"
>
> res at lbLabelAutoStride           = True
>   res at lbBoxLinesOn                = False
>   res at tiMainString                = "XX"
>
> res at sfXArray                    = lon
>   res at sfYArray                    = lat
>
> res at mpProjection                = "LambertConformal"
>   res at mpLambertParallel1F         = tlat1
>   res at mpLambertParallel2F         = tlat2
>   res at mpLambertMeridianF          = clon
>
> res at mpLimitMode                 = "Corners"
>   res at mpLeftCornerLatF            = lat2d(20,18)
>   res at mpLeftCornerLonF            = lon2d(20,18)
>   res at mpRightCornerLatF           = lat2d(58,52)
>   res at mpRightCornerLonF           = lon2d(58,52)
>
>   res at mpFillOn                    = False
>   res at mpOutlineDrawOrder          = "PostDraw"
>     res at mpFillDrawOrder             = "PreDraw"
> ;  res at mpOutlineBoundarySets       = "GeophysicalAndUSStates"
> res at mpOutlineBoundarySets= "USStates"
> ;  res at mpUSStateLineColor          = "Gray10"
> ;  res at mpUSStateLineDashPattern    = 2
>
>   res at pmTickMarkDisplayMode       = "Always"
>   map = gsn_csm_contour_map(wks,x,res)
>
>
>   frame(wks)
> end
>
> I would appreciate any help and suggestion to understand and fix this issue.
>
> Thank you,
>
> Adv
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151209/d7662297/attachment-0001.html 


More information about the ncl-talk mailing list