[ncl-talk] Contour Shape gets distorted for gsn_csm_contour_map plot

Mansur Ali Jisan jisan.mansur at gmail.com
Wed Jan 2 10:45:51 MST 2019


Dear NCL Community,

I need help with contour map plot for a Hurricane wind field. At first, I
used gsn_csm_contour function for making the plot and the shape of the
storm looked correct. But when I tried to make a contour map plot using
gsn_csm_contour_map, the shape got distorted. I tried to solve this by
setting the res at mpShapeMode = "FreeAspect". While it improved the contour
plot but the map got stretched. Similarly, I set up the map projection to
cylindrical equidistant but still got the same result. I have added the
code and PrintVarSummary. Any suggestions will be very helpful.

Wishing you a Happy New Year!

--------------------------------------------------------------------------------------------------------

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
  ntim = 318
  nlat = 1202
  mlon = 1202

  f1 = addfile("bound_param_diag_var_rough.nc","r")
  u = f1->um_bot   ; 97 x 1202 x 1202
  v = f1->vm_bot
  ws = sqrt(u^2+v^2)

 lat  = fspan(36.07092, 46.86241,nlat)
  lon  = fspan(-74.25677, -70.17657,mlon)

  lat!0= "lat"                   ; name dimension
  lat at units = "degrees_north"    ; associate units attribute
  lat&lat   = lat                ; coordinate variable

  lon!0= "lon"
  lon at units = "degrees_east"
  lon&lon   = lon

  u!0 = "time"
  u!1 = "lat"
  u!2 = "lon"
  u&lat = lat
  u&lon = lon
  v!0 = "time"
  v!1 = "lat"
  v!2 = "lon"

  v&lat = lat
  v&lon = lon

  ws!0 = "time"
  ws!1 = "lat"
  ws!2 = "lon"

  ws&lat = lat
  ws&lon = lon

 printVarSummary(lat)
 print("-----")
 printVarSummary(lon)
 print("-----")
 printVarSummary(u)
 print("-----")

  ws = mask(ws,ws.lt.4,False)
  u = mask(u,u.lt.4,False)
  v = mask(v,v.lt.4,False)

  wks = gsn_open_wks("png","gsn_csm_contour_map")
  res                          = True
  res at gsnDraw        = False
  res at gsnFrame      = False
  res at gsnAddCyclic   = False
  res at gsnMaximize    = True
  res at cnFillOn            = True
  res at cnLinesOn        = False
  res at cnFillMode        = "AreaFill"
  res at cnFillPalette      = "matlab_jet"

;  res at mpShapeMode = "FreeAspect"
;  res at vpWidthF = 0.6
;  res at vpHeightF = 0.5

  res at tmXBOn = True
  res at tmYLOn = True
  res at tiMainString   = "gsn_csm_contour_map"
  res at tmXBMode = "Explicit"
  res at tmXBValues = (/-66, -67, -68, -69, -70, -71,  -72,  -73,   -74,  -75,
-76, -77/)
  res at tmXBLabels =
(/"66W","67W","68W","69W","70W","71W","72W","73W","74W","75W","76W","77W"/)

  res at tmYLMode = "Explicit"
  res at tmYLValues = (/34, 35,  36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47/)
  res at tmYLLabels =
(/"34N","35N","36N","37N","38N","39N","40N","41N","42N","43N","44N","45N","46N","47N"/)

  res at cnLevelSelectionMode = "ManualLevels"
  res at cnMinLevelValF       = 10
  res at cnMaxLevelValF       = 80
  res at cnLevelSpacingF      = 2.5

  res at mpFillOn = False
  res at mpGeophysicalLineThicknessF = 2.5
  res at mpOutlineBoundarySets     = "geophysicalandusstates"
  res at mpDataBaseVersion = "MediumRes"
  res at mpDataSetName = "Earth..4"
  res at mpGeophysicalLineColor = "Black"

  res at mpLimitMode = "LatLon"
  res at mpMinLatF = 36.0
  res at mpMaxLatF = 46.0
  res at mpMinLonF = -76.0
  res at mpMaxLonF = -70.0

  plot = gsn_csm_contour_map(wks,ws(22,:,:),res)

draw(plot)

frame(wks)

end


Variable: lat
Type: float
Total Size: 4808 bytes
            1202 values
Number of Dimensions: 1
Dimensions and sizes:   [lat | 1202]
Coordinates:
            lat: [36.07092..46.86241]
Number Of Attributes: 1
  units :       degrees_north
(0)     -----

Variable: lon
Type: float
Total Size: 4808 bytes
            1202 values
Number of Dimensions: 1
Dimensions and sizes:   [lon | 1202]
Coordinates:
            lon: [-74.25677..-70.17657]
Number Of Attributes: 1
  units :       degrees_east
(0)     -----


Variable: u
Type: float
Total Size: 1837790688 bytes
            459447672 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 318] x [lat | 1202] x [lon | 1202]
Coordinates:
            lat: [36.07091903686523..46.86241149902344]
            lon: [-74.25676727294922..-70.17656707763672]
Number Of Attributes: 1
  units :
(0)     -----


-- 
*Mansur Ali Jisan*
Ph.D. Student
URI Graduate School of Oceanography, RI 02882

<hasancee at iut-dhaka.edu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190102/7ede41e8/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gsn_csm_contour_map.png
Type: image/png
Size: 87985 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190102/7ede41e8/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gsn_csm_contour.png
Type: image/png
Size: 60704 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190102/7ede41e8/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: free_aspect_ratio.png
Type: image/png
Size: 124610 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190102/7ede41e8/attachment-0005.png>


More information about the ncl-talk mailing list