<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>The most important rule of data processing is to <b>look at your data</b>. <br></div><div>In your case 'u' has the following structure and contents.<br></div><div><br></div><div><div>Variable: u</div><div>Dimensions and sizes:   [time | 97] x [lat | 1202] x [lon | 1202]</div><div>Coordinates:</div><div>            time: [ 0.. 0]</div><div><span style="color:rgb(255,0,0)"><b>            lat: [   1..1202]     <=== This is wrong<br></b></span></div><div><b><span style="color:rgb(255,0,0)">            lon: [   1..1202]    <=== This is wrong</span><br></b></div><div><b><br></b></div></div><div><b><span style="color:rgb(255,0,0)">These are sequential integer values not latitudes and longitudes.</span></b></div><div><br></div><div>If you want a basic contour map with no georeferencing, then use:</div><div><br></div><div>  <span class="gmail-im">plot = <a href="http://test.www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_contour.shtml"><b>gsn_csm_contour</b></a>(wks,u(3,:,:),res)</span></div><div>=========================================<br></div><div><br></div><div>Since, you are plotting over a map</div><div><br></div><div>  <span class="gmail-im">plot = <a href="http://test.www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_contour_map.shtml"><b>gsn_csm_contour_map</b></a>(wks,u(3,:,:),res)</span></div><div><br></div><div>The <b>function is looking for lat/lon coordinate variables with appropriate units.</b></div><div><br></div><div>============================================</div><div>Try something like:</div><div>++++++++++++++++++++++++++++++++++++++++<br></div><div>;;u   = f1->u10   ;g different variables 97 x 1202 x 1202<br>  <br>  ntim = 97<br>  nlat = 1202<br>  mlon = 1202<br>  u    = random_normal(-10,50,(/ntim,nlat,mlon/))<br>  lat  = fspan(13,47,nlat)<br>  lon  = fspan(-95,-48,mlon)<br><br>  lat!0= "lat"                   ; name dimension<br>  lat@units = "degrees_north"    ; associate units attribute<br>  lat&lat   = lat                ; coordinate variable<br><br>  lon!0= "lon"<br>  lon@units = "degrees_east"<br>  lon&lon   = lon<br><br>  u!0 = "time"<br>  u!1 = "lat"<br>  u!2 = "lon"<br><br>  u&lat = lat<br>  u&lon = lon<br><br> printVarSummary(lat)<br> print("-----")<br> printVarSummary(lon)<br> print("-----")<br> printVarSummary(u)<br> print("-----")<br></div><div>++++++++++++++++++++++++</div><div>OUTPUT: Please examine</div><div>+++++++++++++++++++++++++</div><div>Variable: lat<br>Type: float<br>Total Size: 4808 bytes<br>            1202 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [lat | 1202]<br><span style="color:rgb(0,0,255)"><b>Coordinates: <br>            lat: [13..47]</b></span><br>Number Of Attributes: 1<br>  <span style="color:rgb(0,0,255)"><b>units :    degrees_north</b><br>(0)    -----</span><br><br>Variable: lon<br>Type: float<br>Total Size: 4808 bytes<br>            1202 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [lon | 1202]<br><span style="color:rgb(0,0,255)"><b>Coordinates: <br>            lon: [-95..-48]</b></span><br>Number Of Attributes: 1<br>  <span style="color:rgb(0,0,255)">units :    degrees_east</span><br>(0)    -----<br><br><b>Variable: u</b><br>Type: float<br>Total Size: 560583952 bytes<br>            140145988 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [time | 97] x [lat | 1202] x [lon | 1202]<br><span style="color:rgb(0,0,255)"><b>Coordinates: <br>            lat: [13..47]<br>            lon: [-95..-48]</b></span><br>(0)    -----<br><br></div><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Dec 3, 2018 at 1:30 PM Mansur Ali Jisan <<a href="mailto:jisan.mansur@gmail.com">jisan.mansur@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear Mary,<div><br></div><div>Thank you for the suggestions. I made modifications according to the suggestion but now the storm center is not showing in the domain (figure attached). It looks to me that the lat long values are still not attached with the variable u that I'm trying to plot. I also looked at the example plots in the NCL website but couldn't able to figure it out. </div><div><br></div><div>The <b>PrintVarSummary</b> for <b>u </b>variable is: </div><div><br></div><div><div>Variable: u</div><div>Type: float</div><div>Total Size: 560583952 bytes</div><div>            140145988 values</div><div>Number of Dimensions: 3</div><div>Dimensions and sizes:   [time | 97] x [lat | 1202] x [lon | 1202]</div><div>Coordinates:</div><div>            time: [ 0.. 0]</div><div>            lat: [   1..1202]</div><div>            lon: [   1..1202]</div><div>Number Of Attributes: 1</div><div>  units :       m/s</div></div><div><br></div><div>The <b>PrintVarSummary </b>for <b>lat </b>is:</div><div><br></div><div><div><div>Variable: lat</div><div>Type: float</div><div>Total Size: 4808 bytes</div><div>            1202 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:   [1202]</div><div>Coordinates:</div></div></div><div><br></div><div><div>The <b><span class="m_2435826323110861247gmail-gr_ m_2435826323110861247gmail-gr_987 m_2435826323110861247gmail-gr-alert m_2435826323110861247gmail-gr_spell m_2435826323110861247gmail-gr_inline_cards m_2435826323110861247gmail-gr_disable_anim_appear m_2435826323110861247gmail-ContextualSpelling m_2435826323110861247gmail-ins-del m_2435826323110861247gmail-multiReplace" id="m_2435826323110861247gmail-987" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">PrintVarSummary</span> </b>for <b>lon </b>is:</div><br class="m_2435826323110861247gmail-Apple-interchange-newline"></div><div><div>Variable: lon</div><div>Type: float</div><div>Total Size: 4808 bytes</div><div>            1202 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:   [1202]</div><div>Coordinates:</div></div><div><br></div><div><br></div><div><br></div><div>And here's the <b>modified code</b>:</div><div><br></div><div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>begin</div><div>;---Read data</div></div><div><div>  f1    = addfile("<a href="http://boundary_parametric.nc" target="_blank">boundary_parametric.nc</a>","r")</div><div>  u     = f1->u10   ; 97 x 1202 x 1202</div><div>  lat   = fspan(13,47,1202)</div><div>  lon  = fspan(-95,-48,1202)</div></div><div><br></div><div><div> printVarSummary(lat)</div><div> printVarSummary(lon)</div><div><br></div><div>  u!1="lat"<br></div><div>  u!2="lon"</div><div><br></div><div>  u&lat@units = "degrees_north"</div><div>  u&lon@units = "degrees_east"</div></div><div><br></div><div><div> printVarSummary(u)</div></div><div><br></div><div><div>;---Start the graphics</div></div><div>  wks = gsn_open_wks("png","irma-u10")<br></div><div><div>  gsn_define_colormap(wks,"matlab_jet")</div></div><div><br></div><div><div>;---Set some resources</div><div>  res                = True</div><div>  res@gsnMaximize    = True     ; maximize plot in frame</div><div>  res@gsnAddCyclic   = False</div><div>  res@cnFillOn       = True     ; turn on contour fill</div><div>  res@cnLinesOn      = False    ; turn off contour lines</div><div>  res@cnLineLabelsOn = False    ; turn off contour line labels</div><div>  res@gsnScalarContour            = True          ; contours desired</div><div>  res@tiMainString   = "Hurricane Irma"</div><div>  res@trGridType           = "TriangularMesh"</div><div>  res@gsnScalarContour = True</div><div>  res@cnLevelSelectionMode = "ManualLevels"</div><div>  res@cnMinLevelValF       = 0</div><div>  res@cnMaxLevelValF       = 40</div><div>  res@cnLevelSpacingF      = 5</div><div><br></div><div>  res@mpProjection                = "CylindricalEquidistant"      ; projection</div><div>  res@mpDataBaseVersion           = "MediumRes"          </div></div><div><br></div><div><br></div><div><div>  res@mpLimitMode = "LatLon"</div><div>  res@mpMinLatF = 13.0</div><div>  res@mpMaxLatF = 47.0</div><div>  res@mpMinLonF = -95.0</div><div>  res@mpMaxLonF = -48.0</div></div><div><br></div><div><br></div><div><div>  plot = gsn_csm_contour_map(wks,u(3,:,:),res)</div></div><div><br></div><div>end<br></div><div> </div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Dec 3, 2018 at 11:10 AM Mary Haley <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Dear Mansur,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">There are a couple of issues with your script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The first is that you are setting:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div>  res@tfDoNDCOverlay              = True                 ; do not transform data</div><br class="m_2435826323110861247m_-301003383454849628gmail-Apple-interchange-newline"></div><div class="gmail_default" style="font-size:small">This tells NCL to ignore any lat/lon information attached to your data, and to instead assume that the map resources (res@mpXXXX) have been set up exactly to match the projection of your data.  Remove that line.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The second is that you are providing conflicting information to the plotting program by adding too much lat/lon information to your data variable.  You have:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"> lat2d   = fspan(13,47,1202)</div><div class="gmail_default">  lon2d   = fspan(-95,-58,1202)</div><div class="gmail_default"> printVarSummary(u)</div><div class="gmail_default"> printVarSummary(lat2d)</div><div class="gmail_default"> printVarSummary(lon2d)</div><div class="gmail_default">  u!1="lat2d"</div><div class="gmail_default">  u!2="lon2d"</div><div class="gmail_default"><br></div><div class="gmail_default">  u@lat2d=lat2d</div><div class="gmail_default">  u@lon2d=lon2d</div><div class="gmail_default"><br></div><div class="gmail_default">  u&lat2d@units = "degrees_north"</div><div class="gmail_default">  u&lon2d@units = "degrees_east"'</div><div class="gmail_default"><br></div><div class="gmail_default">The first issue is that these two lines should NOT be set at all:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default">  u@lat2d=lat2d</div><div class="gmail_default">  u@lon2d=lon2d</div><div class="gmail_default"><br></div><div class="gmail_default">They are only to be used in the case where you have curvilinear data, which is data represented by two-dimensional lat/lon arrays. The way you are setting up your lat/lon arrays is for rectilinear data, which means you have one-dimensional latitudes for all your Y locations, and one-dimensional longitudes for your X locations.</div><div class="gmail_default"><br></div><div class="gmail_default">While it's not wrong, I suggest not using "lat2d" and "lon2d" for your lat / lon variable names, because this is misleading.  Instead, I suggest:</div><div class="gmail_default"><br></div></div></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"> lat   = fspan(13,47,1202)</div><div class="gmail_default"> lon   = fspan(-95,-58,1202)</div><div class="gmail_default"> printVarSummary(u)</div><div class="gmail_default"> printVarSummary(lat)</div><div class="gmail_default"> printVarSummary(lon)</div><div class="gmail_default"> u!1="lat"</div><div class="gmail_default"> u!2="lon"</div><div class="gmail_default"><br></div><div class="gmail_default">  u&lat@units = "degrees_north"</div><div class="gmail_default">  u&lon@units = "degrees_east"'</div></div></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To learn more about rectilinear versus curvilinear, you might want to see the "plotting data on a map" examples page:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml" target="_blank">http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml</a><br></div><div><br></div><div><div class="gmail_default" style="font-size:small">Regards,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><br></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Dec 2, 2018 at 9:28 PM Mansur Ali Jisan <<a href="mailto:jisan.mansur@gmail.com" target="_blank">jisan.mansur@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear NCL Community,<div><br></div><div>I'm facing some problems in projecting my data properly on a map. I'm working with a NetCDF file from a parametric wind model for the case of Hurricane Irma. The variable that I'm trying to plot is u10. The problem is that it doesn't have any coordinate values attached to it. But from the input data, I know the extent of latitude and longitude. So, I defined that in the NCL script but from the visualization, the location of the center position was shown in a wrong position.</div><div><br></div><div>Following is the script that I tried:</div><div><br></div><div><b>load </b>"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div><b>load</b> "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>begin</div><div>;---Read data</div><div>  f1    = addfile("<a href="http://boundary_parametric.nc" target="_blank">boundary_parametric.nc</a>","r")</div><div>  u = f1->u10   ; 97 x 1202 x 1202</div><div>  lat2d   = fspan(13,47,1202)</div><div>  lon2d   = fspan(-95,-58,1202)</div><div> printVarSummary(u)<br></div><div> printVarSummary(lat2d)</div><div> printVarSummary(lon2d)</div><div>  u!1="lat2d"<br></div><div>  u!2="lon2d"</div><div><br></div><div>  u@lat2d=lat2d</div><div>  u@lon2d=lon2d</div><div><br></div><div>  u&lat2d@units = "degrees_north"</div><div>  u&lon2d@units = "degrees_east"</div><div><br></div><div><div>  printVarSummary(u)</div><div><br></div><div><br></div><div>;---Start the graphics</div><div>  wks = gsn_open_wks("png","irma-u10")</div><div>  gsn_define_colormap(wks,"matlab_jet")</div><div>;---Set some resources</div><div>  res                = True</div><div>  res@gsnMaximize    = True     ; maximize plot in frame</div><div>  res@gsnAddCyclic   = False</div><div>  res@cnFillOn       = True     ; turn on contour fill</div><div>  res@cnLinesOn      = False    ; turn off contour lines</div><div>  res@cnLineLabelsOn = False    ; turn off contour line labels</div><div>  res@gsnScalarContour            = True          ; contours desired</div><div>  res@tiMainString   = "Hurricane Irma"</div><div>  res@trGridType           = "TriangularMesh"</div><div>  res@gsnScalarContour = True</div><div>  res@cnLevelSelectionMode = "AutomaticLevels"</div><div>  res@mpProjection                = "CylindricalEquidistant"      ; projection<br></div><div>  res@mpDataBaseVersion           = "MediumRes"          ; use more detailed maps</div></div><div>  res@mpLimitMode = "LatLon"<br></div><div><div>  res@mpMinLatF = 13.0</div><div>  res@mpMaxLatF = 47.0</div><div>  res@mpMinLonF = -95.0</div><div>  res@mpMaxLonF = -58.0</div><div>  res@tfDoNDCOverlay              = True                 ; do not transform data</div><div><br></div><div>  plot = gsn_csm_contour_map(wks,u(3,:,:),res)</div><div><br></div><div>end</div></div><div><br></div><div><b>NCL_Filedump</b> for the input file is the following:</div><div><br></div><div><div>Variable: f</div><div>Type: file</div><div>filename:       boundary_parametric</div><div>path:   <a href="http://boundary_parametric.nc" target="_blank">boundary_parametric.nc</a></div><div>   file global attributes:</div><div>      time-units : start time: 2017-09-10 00:06:00 +00:00</div><div>   dimensions:</div><div>      y_axis = 1202</div><div>      x_axis = 1202</div><div>      time = 97  // unlimited</div><div>   variables:</div><div>      double y_axis ( y_axis )</div><div>         units :        unit-less</div><div><br></div><div>      double x_axis ( x_axis )</div><div>         units :        unit-less</div><div><br></div><div>      float time ( time )</div><div>         units :        hours</div><div><br></div><div>        float utx ( time )</div></div><div><div>         units :</div><div><br></div><div>      float uty ( time )</div><div>         units :</div><div><br></div><div>      float rmax ( time )</div><div>         units :</div><div><br></div><div>      float wsmax ( time )</div><div>         units :</div><div><br></div><div>      float u10 ( time, y_axis, x_axis )</div><div>         units :        m/s</div><div><br></div><div>      float v10 ( time, y_axis, x_axis )</div><div>         units :        m/s</div><div><br></div><div>      float utop ( time, y_axis, x_axis )</div><div>         units :        m/s</div><div><br></div><div>      float vtop ( time, y_axis, x_axis )</div><div>         units :        m/s</div><div> <br></div></div><div>Please let me know if any additional information needed. </div><div><br></div><div>Thanks in advance!</div><div><br></div><div>Mansur</div><div><br></div><div>-- <br><div dir="ltr" class="m_2435826323110861247m_-301003383454849628gmail-m_-8249571406907405157gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><b style="font-family:Cambria;font-size:12pt"><span style="font-size:9pt;font-family:Arial">Mansur Ali Jisan</span></b></div><div><span style="font-family:Cambria;font-size:12pt"><span style="font-size:9pt;font-family:Arial">Ph.D. Student</span></span></div><div><span style="font-family:Cambria;font-size:12pt"><span style="font-size:9pt;font-family:Arial">URI Graduate School of Oceanography, RI 02882</span></span></div><div><br></div><div><div><div><a rel="nofollow" href="mailto:hasancee@iut-dhaka.edu" target="_blank"></a></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_2435826323110861247gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><b style="font-family:Cambria;font-size:12pt"><span style="font-size:9pt;font-family:Arial">Mansur Ali Jisan</span></b></div><div><span style="font-family:Cambria;font-size:12pt"><span style="font-size:9pt;font-family:Arial">Ph.D. Student</span></span></div><div><span style="font-family:Cambria;font-size:12pt"><span style="font-size:9pt;font-family:Arial">URI Graduate School of Oceanography, RI 02882</span></span></div><div><font face="Arial"><span style="font-size:12px"><a href="http://jisan-mansur.com/" target="_blank">http://jisan-mansur.com/</a></span></font><br></div><div><b style="font-family:Cambria;font-size:12pt"><span style="font-size:9pt;font-family:Arial"><br></span></b></div><div><div><div><a rel="nofollow" href="mailto:hasancee@iut-dhaka.edu" target="_blank"></a></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>