<div dir="ltr">Kerwyn,<div><br></div><div>(1)  In NCL, metadata is lost when using normal math operators.  You are creating the variables spd and temp1 without metadata.</div><div><br></div><div>There is an easy method to preserve metadata when doing math operations on arrays.  Simply assign one of the input arrays first, and then the metadata will be preserved &quot;on the left hand side&quot; when you use a math expression.  For example:</div><div><br></div><div>    spd = u_wund</div><div><span style="font-size:14px">    spd = (u_wind*u_wind + v_wind*v_wind)^(0.5) ; m/s</span><br style="font-size:14px"><br>    temp1 = temp<br style="font-size:14px"><span style="font-size:14px">    temp1 = temp - 273</span><br style="font-size:14px"></div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">You will now see that these new variables have proper coordinates and metadata, when you do printVarSummary AFTER these lines of code.</span></div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">(2)  I think you added the following lines in an attempt to add the missing metadata.  In the case of  GFS Grib files, all of the necessary metadata should already be attached to the input variables.  Therefore you do not need to do any of the following, and they are possibly creating more problems.  I recommend removing all of these lines unless you have a good reason to keep some of them.</span></div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">Do not worry about coordinate names such as lat_3 and lon_3.  That is normal with Grib files, and NCL should handle this just fine:</span></div><div><span style="font-size:14px"><br></span></div><div>temp1!0=&quot;lat&quot;<br>temp1!1=&quot;lon&quot;<br><br>;temp1@lat1d = lat1d<br>;temp1@lon1d = lon1d<br><br>;temp1&amp;lat@units=&quot;degrees_nort<wbr>h&quot;<br>;temp1&amp;lon@units=&quot;degrees_east<wbr>&quot;<br><br>hgt!0=&quot;lat&quot;<br>hgt!1=&quot;lon&quot;<br>hgt&amp;lat@units=&quot;degrees_north&quot;<br>hgt&amp;lon@units=&quot;degrees_east&quot;<br><br>u_wind!0=&quot;lat&quot;<br>u_wind!1=&quot;lon&quot;<br>u_wind&amp;lat@units=&quot;degrees_nort<wbr>h&quot;<br>u_wind&amp;lon@units=&quot;degrees_east<wbr>&quot;<br><br>v_wind!0=&quot;lat&quot;<br>v_wind!1=&quot;lon&quot;<br>v_wind&amp;lat@units=&quot;degrees_nort<wbr>h&quot;<br>v_wind&amp;lon@units=&quot;degrees_east<wbr>&quot;<br><br>Also remove:<br><br>;spd!0=&quot;lat&quot;<br>;spd!1=&quot;lon&quot;<br>;spd&amp;lat@units=&quot;degrees_north&quot;<br>;spd&amp;lon@units=&quot;degrees_east&quot;<span style="font-size:14px"><br></span></div><div><br></div><div>(3)  Here is a debugging tip.  Overlay plots are harder to debug because there is a lot going on at the same time.  Temporarily set these resources to True until you get individual plots working properly.  Then set them back to false to get only the final overlay plot:</div><div><br></div><div>    res@gsnDraw</div>    res@gsnFrame<br><div><br></div><div>--Dave</div><div><span style="font-size:14px"><br></span></div><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 30, 2016 at 7:50 PM, Kerwyn Texeira <span dir="ltr">&lt;<a href="mailto:ktish86@gmail.com" target="_blank">ktish86@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi ncl-talk,<br><br></div>I getting some errors while plotting GFS analysis data.  I  believe that there is some confusion with the lat, lon and rest of the data.  The lat and lon have a 1-dimensional array while the other set of data has a 2-dimensional array.  However, I am getting a plot though but I would like to know how to correct the errors below:  I&#39;ll appreciate whatever help that I can get.  <br><br>Thanks in advance!<br></div><div><br></div>Error message:<br> <br>(0)     check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn&#39;t contain one at all.<br>(0)     A valid latitude coordinate array should have a &#39;units&#39; attribute equal to one of the following values:<br>(0)         &#39;degrees_north&#39; &#39;degrees-north&#39; &#39;degree_north&#39; &#39;degrees north&#39; &#39;degrees_N&#39; &#39;Degrees_north&#39; &#39;degree_N&#39; &#39;degreeN&#39; &#39;degreesN&#39; &#39;deg north&#39;<br>(0)     check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn&#39;t contain one at all.<br>(0)     A valid longitude coordinate array should have a &#39;units&#39; attribute equal to one of the following values:<br>(0)         &#39;degrees_east&#39; &#39;degrees-east&#39; &#39;degree_east&#39; &#39;degrees east&#39; &#39;degrees_E&#39; &#39;Degrees_east&#39; &#39;degree_E&#39; &#39;degreeE&#39; &#39;degreesE&#39; &#39;deg east&#39;<br><br></div>Variable outputs:<br>Variable: u_wind<br>Type: float<br>Total Size: 260640 bytes<br>            65160 values<br>Number of Dimensions: 2<br>Dimensions and sizes:   [lat_3 | 181] x [lon_3 | 360]<br>Coordinates:<br>            lat_3: [90..-90]<br>            lon_3: [ 0..359]<br>Number Of Attributes: 13<br>  lv_ISBL3 :    200<br>  center :      US National Weather Service - NCEP (WMC)<br>  long_name :   u-component of wind<br>  units :       m/s<br>  _FillValue :  1e+20<br>  level_indicator :     100<br>  grid_number : 3<br>  parameter_table_version :     2<br>  parameter_number :    33<br>  model :       Analysis from GFS (Global Forecast System)<br>  forecast_time :       0<br>  forecast_time_units : hours<br>  initial_time :        01/10/2014 (18:00)<br><br>Variable: v_wind<br>Type: float<br>Total Size: 260640 bytes<br>            65160 values<br>Number of Dimensions: 2<br>Dimensions and sizes:   [lat_3 | 181] x [lon_3 | 360]<br>Coordinates:<br>            lat_3: [90..-90]<br>            lon_3: [ 0..359]<br>Number Of Attributes: 13<br>  lv_ISBL3 :    200<br>  center :      US National Weather Service - NCEP (WMC)<br>  long_name :   v-component of wind<br>  units :       m/s<br>  _FillValue :  1e+20<br>  level_indicator :     100<br>  grid_number : 3<br>  parameter_table_version :     2<br>  parameter_number :    34<br>  model :       Analysis from GFS (Global Forecast System)<br>  forecast_time :       0<br>  forecast_time_units : hours<br>  initial_time :        01/10/2014 (18:00)<br><br>Variable: hgt<br>Type: float<br>Total Size: 260640 bytes<br>            65160 values<br>Number of Dimensions: 2<br>Dimensions and sizes:   [lat_3 | 181] x [lon_3 | 360]<br>Coordinates:<br>            lat_3: [90..-90]<br>            lon_3: [ 0..359]<br>Number Of Attributes: 13<br>  lv_ISBL3 :    200<br>  center :      US National Weather Service - NCEP (WMC)<br>  long_name :   Geopotential height<br>  units :       gpm<br>  _FillValue :  1e+20<br>  level_indicator :     100<br>  grid_number : 3<br>  parameter_table_version :     2<br>  parameter_number :    7<br>  model :       Analysis from GFS (Global Forecast System)<br>  forecast_time :       0<br>  forecast_time_units : hours<br>  initial_time :        01/10/2014 (18:00)<br><br>Variable: lat1d<br>Type: float<br>Total Size: 724 bytes<br>            181 values<br>Number of Dimensions: 1<br>Dimensions and sizes:   [lat_3 | 181]<br>Coordinates:<br>            lat_3: [90..-90]<br>Number Of Attributes: 3<br>  long_name :   latitude<br>  grid_description :    65160-point (181x360) global longitude-latitude grid.  (0,0) at 0E, 90N, matrix layout.  N.B.: prime meridian not duplicated.<br>  units :       degrees_north<br><br>Variable: lon1d<br>Type: float<br>Total Size: 1440 bytes<br>            360 values<br>Number of Dimensions: 1<br>Dimensions and sizes:   [lon_3 | 360]<br>Coordinates:<br>            lon_3: [ 0..359]<br>Number Of Attributes: 3<br>  long_name :   longitude<br>  grid_description :    65160-point (181x360) global longitude-latitude grid.  (0,0) at 0E, 90N, matrix layout.  N.B.: prime meridian not duplicated.<br>  units :       degrees_east<br><br>Variable: temp1<br>Type: float<br>Total Size: 260640 bytes<br>            65160 values<br>Number of Dimensions: 2<br>Dimensions and sizes:   [181] x [360]<br>Coordinates:<br>Number Of Attributes: 1<br>  _FillValue :  1e+20<br><br>Variable: spd<br>Type: float<br>Total Size: 260640 bytes<br>            65160 values<br>Number of Dimensions: 2<br>Dimensions and sizes:   [181] x [360]<br>Coordinates:<br>Number Of Attributes: 1<br>  _FillValue :  1e+20<br><br></div>My Script:<br><br>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl&quot;<br><br>begin<br><br>a = addfile(&quot;./gfsanl_3_20140110_1<wbr>800_000.grb&quot;, &quot;r&quot;)<br><br>wks_type = &quot;png&quot;<br>wks_type@wkWidth = 2500<br>wks_type@wkHeight = 2500<br><br>wks= gsn_open_wks(wks_type, &quot;speed_narr&quot;)<br>gsn_define_colormap(wks,&quot;matla<wbr>b_jet&quot;)<br><br>lat1d = a-&gt;lat_3<br>lon1d = a-&gt;lon_3<br>hgt = a-&gt;HGT_3_ISBL({200},:,:)<br>temp = a-&gt;TMP_3_ISBL({200},:,:)<br>u_wind = a-&gt;U_GRD_3_ISBL({200},:,:)<br>v_wind = a-&gt;V_GRD_3_ISBL({200},:,:)<br><br>;printVarSummary(temp)<br>printVarSummary(u_wind)<br>printVarSummary(v_wind)<br>printVarSummary(hgt)<br>printVarSummary(lat1d)<br>printVarSummary(lon1d)<br><br><br>spd = (u_wind*u_wind + v_wind*v_wind)^(0.5) ; m/s<br><br><br>u_wind = u_wind*1.94384449<br>v_wind = v_wind*1.94384449<br><br>temp1 = temp - 273<br>printVarSummary(temp1)<br>temp1!0=&quot;lat&quot;<br>temp1!1=&quot;lon&quot;<br><br>;temp1@lat1d = lat1d<br>;temp1@lon1d = lon1d<br><br>;temp1&amp;lat@units=&quot;degrees_nort<wbr>h&quot;<br>;temp1&amp;lon@units=&quot;degrees_east<wbr>&quot;<br><br>hgt!0=&quot;lat&quot;<br>hgt!1=&quot;lon&quot;<br>hgt&amp;lat@units=&quot;degrees_north&quot;<br>hgt&amp;lon@units=&quot;degrees_east&quot;<br><br>u_wind!0=&quot;lat&quot;<br>u_wind!1=&quot;lon&quot;<br>u_wind&amp;lat@units=&quot;degrees_nort<wbr>h&quot;<br>u_wind&amp;lon@units=&quot;degrees_east<wbr>&quot;<br><br>v_wind!0=&quot;lat&quot;<br>v_wind!1=&quot;lon&quot;<br>v_wind&amp;lat@units=&quot;degrees_nort<wbr>h&quot;<br>v_wind&amp;lon@units=&quot;degrees_east<wbr>&quot;<br><br>spd = spd*1.94384449<br>printVarSummary(spd)<br><br>;spd!0=&quot;lat&quot;<br>;spd!1=&quot;lon&quot;<br>;spd&amp;lat@units=&quot;degrees_north&quot;<br>;spd&amp;lon@units=&quot;degrees_east&quot;<br><br><br>res = True<br>res@gsnDraw = False<br>res@gsnFrame = False<br>res@cnLineLabelsOn =False<br>res@cnFillOn = True<br>res@mpOutlineBoundarySets = &quot;geophysicalandusstates&quot;<br>res@mpGeophysicalLineThickness<wbr>F =5.0<br>res@mpUSStateLineThicknessF = 5.0<br>res@mpNationalLineThicknessF = 5.0<br>res@tiMainString = &quot;Winds (kts) at 200hpa on Jan 11 at 12:00UTC&quot;<br>res@tiMainFont = &quot;helvetica&quot;<br>res@tiMainFontHeightF = 0.022<br>res@pmTickMarkDisplayMode = &quot;Always&quot;<br>res@mpProjection = &quot;CylindricalEquidistant&quot;<br>res@mpDataBaseVersion = &quot;MediumRes&quot;<br>res@mpOutlineOn = False<br>res@lbOrientation = &quot;Vertical&quot;<br>;res@tiMainOffsetYF = -0.03<br>res@mpFillOn  = False<br>res@mpOutlineOn = True<br>;res@tfDoNDCOverlay = True<br>res@mpMinLatF = 18.0<br>res@mpMaxLatF = 48.0<br>res@mpMinLonF = -160.0<br>res@mpMaxLonF = -114.5<br>res@gsnLeftString = &quot;Geopotential Height (gpm) and Winds (kts)&quot;<br>res@gsnStringFontHeightF = 0.020<br>res@gsnRightString = &quot;&quot;<br>res@gsnMaximize = True<br>res@mpShapeMode = &quot;FreeAspect&quot;<br>res@lbTitleString = &quot;Winds (kts)&quot;<br>res@lbTitleDirection = &quot;Across&quot;<br>res@lbTitleAngleF = 90<br>res@lbTitlePosition = &quot;Right&quot;<br>res@lbTitleFontHeightF = 0.020<br>res@gsnAddCyclic = False<br>;res@cnLevelSelectionMode = &quot;ManualLevels&quot;<br>;res@cnMinLevelValF = 10<br>;res@cnMaxLevelValF =130<br>;res@cnLevelSpacingF =10.0<br><br>res1 = True<br>res1@gsnDraw = False<br>res1@gsnFrame = False<br>res1@cnLineColor = &quot;Black&quot;<br>res1@gsnContourLineThicknesses<wbr>Scale = 7.5<br>res1@gsnAddCyclic = False<br>;res1@tfDoNDCOverlay = True<br>res1@gsnLeftString = &quot;&quot;<br>res1@gsnRightString = &quot;&quot;<br>res1@cnInfoLabelOn = False<br>res1@cnLineLabelBackgroundColo<wbr>r = &quot;white&quot;<br>res1@cnLineLabelInterval = 1.0<br>res1@cnLevelSelectionMode = &quot;EqualSpacedLevels&quot;<br><br><br>res2 = True<br>res2@gsnDraw = False<br>res2@gsnFrame = False<br>res2@vcWindBarbLineThicknessF = 3.0<br>res2@vcRefLengthF =0.018<br>res2@vcRefMagnitudeF = 10<br>;res2@tfDoNDCOverlay = True<br>res2@vcMinDistanceF = 0.025<br>res2@vcGlyphStyle = &quot;WindBarb&quot;<br>res2@gsnRightString =&quot;&quot;<br>res2@gsnLeftString = &quot;&quot;<br>res2@vcRefAnnoOn = False<br>res2@gsnAddCyclic = False<br><br><br>geo = gsn_csm_contour(wks, hgt, res1)<br><br>speed = gsn_csm_contour_map(wks, spd, res)<br><br>vector = gsn_csm_vector(wks, u_wind, v_wind, res2)<br><br>overlay(speed, geo)<br>overlay(speed, vector)<br><br>draw(speed)<br>frame(wks)<br><br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;<br> <br>end<br></div></blockquote></div></div></div>