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

Mansur Ali Jisan jisan.mansur at gmail.com
Thu Jan 3 13:01:25 MST 2019


Thank you for the replies and suggestions. I think the problem is with the
output data frame. It's an output from parametric wind model with moving
nest which gives only the lat-long for four corner points of the grid as a
separate text file. I suspect there's something wrong with the calculation
of those corner points. Thank you again!

Regards,
Mansur

On Wed, Jan 2, 2019 at 5:04 PM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Mansur,
>
> 1.  I strongly advise against generating your own lat and lon coordinates
> when valid coordinates are provided with the input data.  Regeneration can
> easily lead to blatant or subtle map registration errors, if there are any
> mistakes.
>
> 2.  Your script uses the cylindrical equidistant projection by default.
> This will produce distortion everywhere except near the equator.  To
> minimize distortion elsewhere, please use a locally conformal map
> projection.  For minimal distortion in a small circular region of the
> globe, I recommend Azimuthal Equidistant with the tangent point at the
> center of the region.  Lambert Conformal Conic is a good compromise
> projection, commonly used, for larger mid-latitude regions that are wider
> east to west, such as continental USA.  There are other good choices for
> small and medium regions.
>
> https://www.ncl.ucar.edu/Document/Graphics/map_projections.shtml
>
> --Dave
>
>
> On Wed, Jan 2, 2019 at 11:23 AM Rick Brownrigg <brownrig at ucar.edu> wrote:
> >
> > Hi,
> >
> > Given the aspect ratio of the underlying data (range of -74.25...-70.17
> in lon, 36...46.9 in lat), it seems like the plot produced via
> gsn_csm_contour_map is about what one would expect ?  I see you manually
> assigned those geographic coordinates to the grid. Are those correct?  Do
> you have other reasons to believe the storm shape should be more circular,
> rather than elongated?
> >
> > Not sure what to suggest here...
> >
> > Rick
> >
> >
> > On Wed, Jan 2, 2019 at 10:46 AM Mansur Ali Jisan <jisan.mansur at gmail.com>
> wrote:
> >>
> >> 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
>


-- 
*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/20190103/dc37cea0/attachment-0001.html>


More information about the ncl-talk mailing list