<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <b class="gmail_sendername" dir="auto">dale zuri</b> <span dir="auto"><<a href="mailto:dalezuri@gmail.com">dalezuri@gmail.com</a>></span><br>Date: Tue, Mar 30, 2021 at 12:36 PM<br>Subject: Re: [ncl-talk] sub: read ascii error<br>To: Alessandra Giannini <<a href="mailto:alesall@iri.columbia.edu">alesall@iri.columbia.edu</a>><br></div><br><br><div dir="ltr"><div>Hi,</div><div>Thanks for your response. <br></div><div>Variable: data<br>Type: float<br>Total Size: 8303040 bytes<br> 2075760 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [345960] x [6]<br>Coordinates: <br>Number Of Attributes: 1</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 30, 2021 at 12:00 PM Alessandra Giannini <<a href="mailto:alesall@iri.columbia.edu" target="_blank">alesall@iri.columbia.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><div><br></div><div><br></div>Hi there, <div><br></div><div>can you print out:</div><div><br></div><div>printVarSummary(data)</div><div><br></div><div>?</div><div><br></div><div>are lat and lon really included in the matrix called “data”?</div><div>The way you define “templat” and “templon”, they should have the same dimension. (Is said dimension nlat x nlon?)</div><div><br></div><div>At any rate, lon and lat should be 1-dimensional. </div><div><br><div>Rule #0 of ncl-talk is that you should have an idea of the structure of your data…</div><div>Maybe you do, but you are not telling us!</div><div><br></div><div>warm regards, alessandra</div><div><br></div><div><br><div><br></div><div><br>
<div><br><blockquote type="cite"><div>On Mar 30, 2021, at 1:45 PM, dale zuri via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:</div><br><div><div dir="ltr"><div>Hi Adam,</div><div>I would appreciate any help to plot this ASCII data. <br></div><div><br></div><div>Thanks</div><div>DZ<br></div><div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <b class="gmail_sendername" dir="auto">dale zuri</b> <span dir="auto"><<a href="mailto:dalezuri@gmail.com" target="_blank">dalezuri@gmail.com</a>></span><br>Date: Tue, Mar 30, 2021 at 10:24 AM<br>Subject: sub: read ascii error<br>To: Ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br></div><br><br><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>
</div></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" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></div></blockquote></div><br></div></div></div></div></blockquote></div>
</div></div>