<div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">dale zuri</strong> <span dir="auto"><<a href="mailto:dalezuri@gmail.com">dalezuri@gmail.com</a>></span><br>Date: Mon, Mar 29, 2021 at 7:02 PM<br>Subject: sub: Any help to plot ascii<br>To: Ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>><br></div><br><br><div dir="ltr"><div>Dear NCL user,</div><div>could someone help me fix this? <br></div><div><br></div><div>I appreciate your time and help. <br></div><div><br></div><div>Thanks</div><div>DZ</div><div><br></div><div>nlat=720<br>nlon=1440<br>fname = "avhrr_seaice"<br><br> data = asciiread("avhrr_seaice",(/nlat*nlon,2/),"float") <br>lat = data(::nlon,0)<br><br> printVarSummary(lat)<br>lon = data(0:nlon-1,1)<br><br> printVarSummary(lon) <br><br>temp12D = onedtond(data(:,0),(/nlat,nlon/)) ; convert 1D array to a 2D array<br>temp22D = onedtond(data(:,1),(/nlat,nlon/)) ; convert 1D array to a 2D array<br><br>; Assign named dimensions<br> lat!0 = "lat"<br> lon!0 = "lon"<br><br> temp12D!0 = "lat"<br> temp12D!1 = "lon"<br><br> temp22D!0 = "lat"<br> temp22D!1 = "lon"<br>; Assign coordinate variables<br> lat&lat = lat<br> lon&lon = lon<br><br> temp22D&lat = lat<br> temp22D&lon = lon<br><br> temp12D&lat = lat<br> temp12D&lon = lon<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> printVarSummary(temp12D) <br> printVarSummary(temp22D) <br><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>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>end<br><br>end </div></div>
</div></div>