<div dir="ltr"><div>Thanks for your response. I'm able to read the file. But not able to figure out the dimension coordinates. <br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 30, 2021 at 11:27 AM david brown <<a href="mailto:david.ian.brown@gmail.com">david.ian.brown@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">I think you should change:<div><br></div><div>fname = "avhrr_seaice"<br>data = readAsciiTable("avhrr_seaice", ncol, "float", nhead)<br></div><div><br></div><div>to</div><div><br></div><div>fname = "avhrr_seaice"<br>data = readAsciiTable(fname, ncol, "float", nhead)<br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 30, 2021 at 10:24 AM dale zuri via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</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>Dear NCL user,</div><div>I would appreciate any help to plot this data. I'm getting this error. <br></div><div><br></div><div>Thanks in advance</div><div>DZ<br></div><div><br></div><div>fatal:Variable (lat) is undefined<br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 18 in file test.ncl<br><br><br></div><div><br></div><div><br></div><div>begin<br>nlat=720<br>nlon=1440<br><br>ncol  = 6<br>nhead = 1<br><br>fname = "avhrr_seaice"<br>data = readAsciiTable("avhrr_seaice", ncol, "float", nhead)<br>temp12D = onedtond(data(2,:),(/nlat,nlon/)) ; convert 1D array to a 2D array<br>temp22D = onedtond(data(3,:),(/nlat,nlon/)) ; convert 1D array to a 2D array<br>templat = data(0,:) ; convert 1D array to a 2D array<br>templon = data(1,:) ; convert 1D array to a 2D array<br>; Assign named dimensions<br>  temp12D!0 = "lat"<br>  temp12D!1 = "lon"<br>  temp12D&lat =  templat               ; assign coord variables<br>  temp12D&lon =  templon <br>  temp22D!0 = "lat"<br>  temp22D!1 = "lon"<br>  temp22D&lat =  templat               ; assign coord variables<br>  temp22D&lon =  templon  <br>    temp12D&lat@units = "degrees_north"<br>    temp12D&lon@units = "degrees_east" <br>    temp22D&lat@units = "degrees_north"<br>    temp22D&lon@units = "degrees_east"<br>; Assign coordinate variables<br>  printVarSummary(temp12D) <br>  printVarSummary(temp22D) <br><br>wks = gsn_open_wks("x11","test")               ; send graphics to PNG file<br><br> plot = new(2,graphic)<br>  cmap = read_colormap_file("UKM_hadcrut"); choose colormap<br>;<br><br>res                      = True               ; plot mods desired<br>  res@cnFillOn             = True               ; turn on color<br>;res@mpShapeMode  = "FreeAspect"<br>res@vpWidthF      = 0.3<br>res@vpHeightF     = 0.2<br>;  res@cnFillPalette  2     = "grads_rainbow"     ; choose colormap<br>  res@cnFillPalette        = cmap     ; choose colormap<br>  res@gsnPolar           = "NH"               ; specify the hemisphere<br>res@gsnDraw              = False<br> res@gsnFrame    = False<br> res@gsnTickMarksOn         = False<br>  res@mpMinLatF            = 50                 ; specify min lat<br>;  res@mpMinLatF            = minlatt                 ; specify min lat<br>;res@mpMaxLatF            = maxlatt <br>  res@trGridType           = "TriangularMesh"<br>  res@cnLinesOn            = False        ; True is default<br>;res@mpFillOn             = False              ; turns off continent gray<br>  res@cnLineLabelsOn       = False        ; True is default<br>res@mpGridAndLimbOn = False<br>res@mpLabelFontHeightF = "22"<br>res@mpPerimLineThicknessF = 2<br>res@mpOutlineOn           = True<br>; res@mpLandFillColor       = "tan"<br>;res@tiMainString    = ""+type+"-"+mon+""<br>  res@lbLabelBarOn         = False        ; turn off individual lb's<br><br> res@gsnLeftString    = ""    ; no titles<br>  res@gsnRightString   = ""<br>  res@tiXAxisString    = ""<br>  res@tiYAxisString    = ""<br>  res@cnLevelSelectionMode = "ManualLevels"     ; set manual contour levels<br>  res@cnMinLevelValF       =  0;0              ; set min contour level<br>  res@cnMaxLevelValF       = 100 ;6                ; set max contour level<br>  res@cnLevelSpacingF      =  10;0.5              ; set contour spacing<br><br><br>;res@lbOrientation        = "Horizontal"<br>;res@lbLabelFontHeightF = 0.014 <br>;res@lbLabelFont = "22"<br>;  res@lbTitleString    = ""+type+""<br>;  res@lbTitleString        = " (deg C)" ; bar title<br>;  res@lbTitlePosition      = "Right"                           ; title location<br>;  res@lbTitleDirection     = "Across"                          ; letter angle<br>;  res@lbTitleAngleF        = 90.                               ; title angle<br>;  res@lbTitleFontHeightF   = 0.02                              ; font height<br> res@gsnStringFont              = "helvetica-bold"  ; will be used for gsnCenterString later<br>    res@gsnCenterStringFontHeightF = 0.014<br>res@gsnCenterString    = "NDJFM"<br>  plot(0) = gsn_csm_contour_map_polar(wks,temp12D(:,0),res)<br>res@gsnCenterString    = "JJAS"<br>  plot(1) = gsn_csm_contour_map_polar(wks,temp22D(:,1),res)<br>;********************************<br>;;;;;Contour plot;;;;;;;;;;;;;;;<br>;********************************<br>; panel plot only resources<br>;********************************<br>; panel plot only resources<br>; panel plot only resources<br>  resP                     = True         ; modify the panel plot<br>  resP@gsnMaximize         = True         ; large format<br>  resP@gsnPanelLabelBar    = True         ; add common colorbar<br>resP@lbLabelFontHeightF = 0.012<br> resP@gsnPanelBottom   = 0.2;;;increases figure size                    ; shrink panel plot by setting bottom edge of plot<br> resP@gsnPanelTop      = 0.9                    ; shrink panel plot by setting top edge of plot<br> resP@pmLabelBarWidthF  = 0.50                 ; make thinner/small number<br>;  resP@pmLabelBarHeightF = 0.05<br> resP@pmLabelBarHeightF = 0.08<br>resP@pmLabelBarOrthogonalPosF = -0.016<br>; resP@gsnPanelYWhiteSpacePercent = 5.           ; increase spacing along Y-axis between panel plots<br> resP@gsnPanelYWhiteSpacePercent = 2;;increases the figure size           ; increase spacing along Y-axis between panel plots<br>res@lbLabelFontHeightF = 0.018<br>resP@lbLabelFont = "22"<br>;  resP@lbTitleString    = ""+tic+""<br> resP@cnLinesOn       = False                   ; turn off contour lines<br>  resP@lbLabelFont    = "helvetica-bold"          ; add common colorbar<br>  resP@lbTitleFont    = "helvetica-bold"          ; add common colorbar<br>  resP@lbTitleFontHeightF= .015                 ; make title smaller<br>  resP@cnLineLabelsOn  = False<br>  resP@txFontHeightF   = 0.03<br>  resP@txFont   = "helvetica-bold"<br><br>gsn_panel(wks,plot,(/1,2/),resP)<br>;---This will maximize the size of all the paneled stuff.<br>;end do<br><br>end </div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>