<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><br class=""></div>Hi there, <div class=""><br class=""></div><div class="">can you print out:</div><div class=""><br class=""></div><div class="">printVarSummary(data)</div><div class=""><br class=""></div><div class="">?</div><div class=""><br class=""></div><div class="">are lat and lon really included in the matrix called “data”?</div><div class="">The way you define “templat” and “templon”, they should have the same dimension. (Is said dimension nlat x nlon?)</div><div class=""><br class=""></div><div class="">At any rate, lon and lat should be 1-dimensional. </div><div class=""><br class=""><div class="">Rule #0 of ncl-talk is that you should have an idea of the structure of your data…</div><div class="">Maybe you do, but you are not telling us!</div><div class=""><br class=""></div><div class="">warm regards, alessandra</div><div class=""><br class=""></div><div class=""><br class=""><div class=""><br class=""></div><div class=""><br class="">
<div><br class=""><blockquote type="cite" class=""><div class="">On Mar 30, 2021, at 1:45 PM, dale zuri via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" class="">ncl-talk@mailman.ucar.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi Adam,</div><div class="">I would appreciate any help to plot this ASCII data. <br class=""></div><div class=""><br class=""></div><div class="">Thanks</div><div class="">DZ<br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br class="">From: <b class="gmail_sendername" dir="auto">dale zuri</b> <span dir="auto" class=""><<a href="mailto:dalezuri@gmail.com" class="">dalezuri@gmail.com</a>></span><br class="">Date: Tue, Mar 30, 2021 at 10:24 AM<br class="">Subject: sub: read ascii error<br class="">To: Ncl-talk <<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a>><br class=""></div><br class=""><br class=""><div dir="ltr" class=""><div class="">Dear NCL user,</div><div class="">I would appreciate any help to plot this data. I'm getting this error. <br class=""></div><div class=""><br class=""></div><div class="">Thanks in advance</div><div class="">DZ<br class=""></div><div class=""><br class=""></div><div class="">fatal:Variable (lat) is undefined<br class="">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 18 in file test.ncl<br class=""><br class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">begin<br class="">nlat=720<br class="">nlon=1440<br class=""><br class="">ncol  = 6<br class="">nhead = 1<br class=""><br class="">fname = "avhrr_seaice"<br class="">data = readAsciiTable("avhrr_seaice", ncol, "float", nhead)<br class="">temp12D = onedtond(data(2,:),(/nlat,nlon/)) ; convert 1D array to a 2D array<br class="">temp22D = onedtond(data(3,:),(/nlat,nlon/)) ; convert 1D array to a 2D array<br class="">templat = data(0,:) ; convert 1D array to a 2D array<br class="">templon = data(1,:) ; convert 1D array to a 2D array<br class="">; Assign named dimensions<br class="">  temp12D!0 = "lat"<br class="">  temp12D!1 = "lon"<br class="">  temp12D&lat =  templat               ; assign coord variables<br class="">  temp12D&lon =  templon <br class="">  temp22D!0 = "lat"<br class="">  temp22D!1 = "lon"<br class="">  temp22D&lat =  templat               ; assign coord variables<br class="">  temp22D&lon =  templon  <br class="">    temp12D&lat@units = "degrees_north"<br class="">    temp12D&lon@units = "degrees_east" <br class="">    temp22D&lat@units = "degrees_north"<br class="">    temp22D&lon@units = "degrees_east"<br class="">; Assign coordinate variables<br class="">  printVarSummary(temp12D) <br class="">  printVarSummary(temp22D) <br class=""><br class="">wks = gsn_open_wks("x11","test")               ; send graphics to PNG file<br class=""><br class=""> plot = new(2,graphic)<br class="">  cmap = read_colormap_file("UKM_hadcrut"); choose colormap<br class="">;<br class=""><br class="">res                      = True               ; plot mods desired<br class="">  res@cnFillOn             = True               ; turn on color<br class="">;res@mpShapeMode  = "FreeAspect"<br class="">res@vpWidthF      = 0.3<br class="">res@vpHeightF     = 0.2<br class="">;  res@cnFillPalette  2     = "grads_rainbow"     ; choose colormap<br class="">  res@cnFillPalette        = cmap     ; choose colormap<br class="">  res@gsnPolar           = "NH"               ; specify the hemisphere<br class="">res@gsnDraw              = False<br class=""> res@gsnFrame    = False<br class=""> res@gsnTickMarksOn         = False<br class="">  res@mpMinLatF            = 50                 ; specify min lat<br class="">;  res@mpMinLatF            = minlatt                 ; specify min lat<br class="">;res@mpMaxLatF            = maxlatt <br class="">  res@trGridType           = "TriangularMesh"<br class="">  res@cnLinesOn            = False        ; True is default<br class="">;res@mpFillOn             = False              ; turns off continent gray<br class="">  res@cnLineLabelsOn       = False        ; True is default<br class="">res@mpGridAndLimbOn = False<br class="">res@mpLabelFontHeightF = "22"<br class="">res@mpPerimLineThicknessF = 2<br class="">res@mpOutlineOn           = True<br class="">; res@mpLandFillColor       = "tan"<br class="">;res@tiMainString    = ""+type+"-"+mon+""<br class="">  res@lbLabelBarOn         = False        ; turn off individual lb's<br class=""><br class=""> res@gsnLeftString    = ""    ; no titles<br class="">  res@gsnRightString   = ""<br class="">  res@tiXAxisString    = ""<br class="">  res@tiYAxisString    = ""<br class="">  res@cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels<br class="">  res@cnMinLevelValF       =  0;0              ; set min contour level<br class="">  res@cnMaxLevelValF       = 100 ;6                ; set max contour level<br class="">  res@cnLevelSpacingF      =  10;0.5              ; set contour spacing<br class=""><br class=""><br class="">;res@lbOrientation        = "Horizontal"<br class="">;res@lbLabelFontHeightF = 0.014 <br class="">;res@lbLabelFont = "22"<br class="">;  res@lbTitleString    = ""+type+""<br class="">;  res@lbTitleString        = " (deg C)" ; bar title<br class="">;  res@lbTitlePosition      = "Right"                           ; title location<br class="">;  res@lbTitleDirection     = "Across"                          ; letter angle<br class="">;  res@lbTitleAngleF        = 90.                               ; title angle<br class="">;  res@lbTitleFontHeightF   = 0.02                              ; font height<br class=""> res@gsnStringFont              = "helvetica-bold"  ; will be used for gsnCenterString later<br class="">    res@gsnCenterStringFontHeightF = 0.014<br class="">res@gsnCenterString    = "NDJFM"<br class="">  plot(0) = gsn_csm_contour_map_polar(wks,temp12D(:,0),res)<br class="">res@gsnCenterString    = "JJAS"<br class="">  plot(1) = gsn_csm_contour_map_polar(wks,temp22D(:,1),res)<br class="">;********************************<br class="">;;;;;Contour plot;;;;;;;;;;;;;;;<br class="">;********************************<br class="">; panel plot only resources<br class="">;********************************<br class="">; panel plot only resources<br class="">; panel plot only resources<br class="">  resP                     = True         ; modify the panel plot<br class="">  resP@gsnMaximize         = True         ; large format<br class="">  resP@gsnPanelLabelBar    = True         ; add common colorbar<br class="">resP@lbLabelFontHeightF = 0.012<br class=""> resP@gsnPanelBottom   = 0.2;;;increases figure size                    ; shrink panel plot by setting bottom edge of plot<br class=""> resP@gsnPanelTop      = 0.9                    ; shrink panel plot by setting top edge of plot<br class=""> resP@pmLabelBarWidthF  = 0.50                 ; make thinner/small number<br class="">;  resP@pmLabelBarHeightF = 0.05<br class=""> resP@pmLabelBarHeightF = 0.08<br class="">resP@pmLabelBarOrthogonalPosF = -0.016<br class="">; resP@gsnPanelYWhiteSpacePercent = 5.           ; increase spacing along Y-axis between panel plots<br class=""> resP@gsnPanelYWhiteSpacePercent = 2;;increases the figure size           ; increase spacing along Y-axis between panel plots<br class="">res@lbLabelFontHeightF = 0.018<br class="">resP@lbLabelFont = "22"<br class="">;  resP@lbTitleString    = ""+tic+""<br class=""> resP@cnLinesOn       = False                   ; turn off contour lines<br class="">  resP@lbLabelFont    = "helvetica-bold"          ; add common colorbar<br class="">  resP@lbTitleFont    = "helvetica-bold"          ; add common colorbar<br class="">  resP@lbTitleFontHeightF= .015                 ; make title smaller<br class="">  resP@cnLineLabelsOn  = False<br class="">  resP@txFontHeightF   = 0.03<br class="">  resP@txFont   = "helvetica-bold"<br class=""><br class="">gsn_panel(wks,plot,(/1,2/),resP)<br class="">;---This will maximize the size of all the paneled stuff.<br class="">;end do<br class=""><br class="">end </div></div>
</div></div></div>
_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@mailman.ucar.edu" class="">ncl-talk@mailman.ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</div></blockquote></div><br class=""></div></div></div></body></html>