<div dir="ltr"><div>Hi Dennis and Alessandra,</div><div>Sorry. I wasn't sure about the history. <br></div><div><br></div><div>Thanks for your help. <br></div><div><br></div><div>DZ<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 30, 2021 at 4:52 PM Dennis Shea <<a href="mailto:shea@ucar.edu">shea@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"><a class="gmail_plusreply" id="gmail-m_-8331086443517959975plusReplyChip-0" href="mailto:dalezuri@gmail.com" target="_blank">@dale zuri</a><div> </div><div>As noted, you must provide more information. ncl-talk should not have to determine the structure of your data. <br></div><div><br></div><br><div><div>The <b>readAsciiTable</b> assumes that each column contains separate variables. <br></div><div>The avhrr_seaice file's columns are not separate values.<br></div></div><div><br></div><div> ngrid_pts=720*1440 = 1036800</div><div>It turns out there are 2 grids</div><div><br></div><div>The file structure is:</div><div>[1] header line with two values: 720 1440<br></div><div>[2] nlat=720 latitude values [left to right]<br></div><div>[3] mlon=1440 longitude values</div><div>[4] 2 successive grids of nlat*mlon values<br></div><div><br></div><div><br></div><div>The first line:<br></div><div> 1 720 1440<br></div><div><br></div><div>The columns are not separate variables. Rather, going left to right, these are the 720 latitude grid coordinates.<br></div><div><br></div><div> 2 -89.8750 -89.6250 -89.3750 -89.1250 -88.8750 -88.6250<br> 3 -88.3750 -88.1250 -87.8750 -87.6250 -87.3750 -87.1250</div><div>[snip]</div><div> 61 -1.37500 -1.12500 -0.875000 -0.625000 -0.375000 -0.125000<br> 62 0.125000 0.375000 0.625000 0.875000 1.12500 1.37500</div><div>[snip]</div><div> 120 87.1250 87.3750 87.6250 87.8750 88.1250 88.3750<br> 121 88.6250 88.8750 89.1250 89.3750 89.6250 89.8750<br> </div><div>Followed immediately, by 1440 longitude grid coordinates:</div><div><br></div><div> 122 0.125000 0.375000 0.625000 0.875000 1.12500 1.37500<br> 123 1.62500 1.87500 2.12500 2.37500 2.62500 2.87500</div><div>[snip]</div><div> 360 357.125 357.375 357.625 357.875 358.125 358.375<br> 361 358.625 358.875 359.125 359.375 359.625 359.875</div><div><br></div><div>Then the data values. Likely, -9999.00 is an _FillValue (missing value)<br></div><div><br></div><div> 362 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00<br> 363 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00</div><div>[snip</div><div><br></div><div>The first non-missing values are at:</div><div><br></div><div> 11279 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00<br> 11280 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00 73.1283<br> 11281 72.8258 72.7936 71.9907 71.9810 71.5007 71.5007<br> 11282 70.9247 70.9355 71.1821 71.1821 71.2308 71.2523</div><div>[snip]</div><div> 11293 89.3143 89.4753 89.5369 89.2018 88.8201 88.7093<br> 11294 89.1968 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00<br> 11295 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00<br></div><div>[snip]</div><div> 11532 65.7548 66.1178 66.4644 87.9502 88.4724 88.9699<br> 11533 89.3143 89.4753 89.5369 89.2018 88.8201 88.7093<br> 11534 89.1968 -9999.00 -9999.00 -9999.00 -9999.00 -9999.00</div><div><br></div><div>=============================================================</div><div><br></div><div> diri = "./"<br> fili = "avhrr_seaice"<br> pthi = diri + fili<br> data = asciiread(pthi,-1,"float")<br><br> nlat = 720<br> mlon = 1440<br> nStrt = (nlat+mlon) + 2 ; 2160 lat/lon values +2: first line: 720,1440<br> print("nStrt="+nStrt)<br><br> seaice = onedtond( data(nStrt:), (/2,nlat,mlon/)) ; skip the 1st 2162 values<br><br> lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")<br> lon = lonGlobeFo(mlon, "lon", "longitude", "degrees_east")<br><br> printVarSummary(lat)<br> printVarSummary(lon)<br><br> seaice!0 = "season"<br> seaice!1 = "lat"<br> seaice&lat = lat<br> seaice!2 = "lon"<br> seaice&lon = lon<br><br> seaice@long_name = "Seaice"<br> seaice@units = "%"<br> seaice@_FillValue = -9999.0<br><br> printVarSummary(seaice)<br> printMinMax(seaice,0)<br>~ <br>~ <br></div><div><br></div><div><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 1:51 PM Alessandra Giannini 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><div><br></div><div>ok, thanks. more questions — </div><div><br></div><div>So, “data” is a matrix of dimensions 345960 by 6.</div><div><br></div><div>1) what is the 6 dimension? what are the 6 "fields"?</div><div><br></div><div>2) regarding the 345960 dimension — </div><div>nlat x nlon = 720x1440 = 1036800, which is larger than 345960.</div><div>So, each one of the 6 dimensions cannot be a map, given the nlat and nlon dimension you specify.</div><div><br></div><div>I give up!</div><div><br></div><div><br></div><div><br></div><br>
<div><br><blockquote type="cite"><div>On Mar 30, 2021, at 2:41 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"><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" target="_blank">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" target="_blank">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>
_______________________________________________<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>_______________________________________________<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>