[ncl-talk] sub: plot ASCII data

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Mar 30 14:26:06 MDT 2021


Hi Dale.  Your input file is a giant list of numbers with no coherent
structure.  This is why you are having problems.  Please do one of two
things.  Either go back to the source and get a complete description of
this file's structure, or else get the same data in a better format such as
netcdf.


On Tue, Mar 30, 2021 at 1:52 PM dale zuri via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Dear ncl users,
> I managed to get a map. But still some error.
> I would appreciate any help to fix this error.
>
> Thanks
>
> Error:
> warning:ScalarFieldSetValues: irregular coordinate array sfXArray
> non-monotonic: defaulting sfXArray
> warning:ScalarFieldSetValues: irregular coordinate array sfYArray
> non-monotonic: defaulting sfYArray
> warning:ScalarFieldSetValues: irregular coordinate array sfXArray
> non-monotonic: defaulting sfXArray
> warning:ScalarFieldSetValues: irregular coordinate array sfYArray
> non-monotonic: defaulting sfYArray
>
> ;----------------------------------------------------------------------
> ; dataonmap_5.ncl
> ;
> begin
> nlat=720
> nlon=1440
>
> ncol  = 6
> nhead = 1
>
> fname = "avhrr_seaice"
> nrow = numAsciiRow (fname)
>  data = asciiread (fname,(/nrow,ncol/), "float")
> data at FillValue = -999.9
>  printVarSummary(data)
>  lat = data (::nlat,0)
> mlat = dimsizes(lat)
>  lon = data (::nlon,1)
>  mlon = dimsizes(lon)
> precip = data (:,0)
> printVarSummary(precip)
> pre = onedtond(precip,(/mlat,mlon/))
> printVarSummary(pre)
> lat!0 = "lat"
> lon!0 = "lon"
>
> pre!0 = "lat"
> pre!1 = "lon"
>  ;-----------------------------------------------------------------------
>    ; Assign coordinate variables
>  ;-----------------------------------------------------------------------
>  lat&lat =  lat
>  lon&lon =  lon
>
>  pre&lat  = lat
>  pre&lon  = lon
>  pre&lat at units="degrees_north"
>   pre&lon at units="degrees_east"
>  ;-----------------
> printVarSummary(pre)
> wks = gsn_open_wks("pdf","test")               ; send graphics to PNG file
>
>  plot = new(2,graphic)
>   cmap = read_colormap_file("UKM_hadcrut"); choose colormap
>
>
> res                      = True               ; plot mods desired
>   res at cnFillOn             = True               ; turn on color
> ;res at mpShapeMode  = "FreeAspect"
> res at vpWidthF      = 0.3
> res at vpHeightF     = 0.2
> ;  res at cnFillPalette  2     = "grads_rainbow"     ; choose colormap
>   res at cnFillPalette        = cmap     ; choose colormap
>   res at gsnPolar           = "NH"               ; specify the hemisphere
> res at gsnDraw              = False
>  res at gsnFrame    = False
>  res at gsnTickMarksOn         = False
>   res at mpMinLatF            = 50                 ; specify min lat
> res at gsnAddCyclic = False
> ;  res at mpMinLatF            = minlatt                 ; specify min lat
> ;res at mpMaxLatF            = maxlatt
>   res at trGridType           = "TriangularMesh"
>   res at cnLinesOn            = False        ; True is default
> ;res at mpFillOn             = False              ; turns off continent gray
>   res at cnLineLabelsOn       = False        ; True is default
> res at mpGridAndLimbOn = False
> res at mpLabelFontHeightF = "22"
> res at mpPerimLineThicknessF = 2
> res at mpOutlineOn           = True
> ; res at mpLandFillColor       = "tan"
> ;res at tiMainString    = ""+type+"-"+mon+""
>   res at lbLabelBarOn         = False        ; turn off individual lb's
>
>  res at gsnLeftString    = ""    ; no titles
>   res at gsnRightString   = ""
>   res at tiXAxisString    = ""
>   res at tiYAxisString    = ""
>   res at cnLevelSelectionMode = "ManualLevels"     ; set manual contour
> levels
>   res at cnMinLevelValF       =  0;0              ; set min contour level
>   res at cnMaxLevelValF       = 100 ;6                ; set max contour level
>   res at cnLevelSpacingF      =  10;0.5              ; set contour spacing
>
>
> ;res at lbOrientation        = "Horizontal"
> ;res at lbLabelFontHeightF = 0.014
> ;res at lbLabelFont = "22"
> ;  res at lbTitleString    = ""+type+""
> ;  res at lbTitleString        = " (deg C)" ; bar title
> ;  res at lbTitlePosition      = "Right"                           ; title
> location
> ;  res at lbTitleDirection     = "Across"                          ; letter
> angle
> ;  res at lbTitleAngleF        = 90.                               ; title
> angle
> ;  res at lbTitleFontHeightF   = 0.02                              ; font
> height
>  res at gsnStringFont              = "helvetica-bold"  ; will be used for
> gsnCenterString later
>     res at gsnCenterStringFontHeightF = 0.014
> res at gsnCenterString    = "NDJFM"
>   plot(0) = gsn_csm_contour_map_polar(wks,pre,res)
> res at gsnCenterString    = "JJAS"
>   plot(1) = gsn_csm_contour_map_polar(wks,pre,res)
> ;********************************
> ;;;;;Contour plot;;;;;;;;;;;;;;;
> ;********************************
> ; panel plot only resources
> ;********************************
> ; panel plot only resources
> ; panel plot only resources
>   resP                     = True         ; modify the panel plot
>   resP at gsnMaximize         = True         ; large format
>   resP at gsnPanelLabelBar    = True         ; add common colorbar
> resP at lbLabelFontHeightF = 0.012
>  resP at gsnPanelBottom   = 0.2;;;increases figure size                    ;
> shrink panel plot by setting bottom edge of plot
>  resP at gsnPanelTop      = 0.9                    ; shrink panel plot by
> setting top edge of plot
>  resP at pmLabelBarWidthF  = 0.50                 ; make thinner/small number
> ;  resP at pmLabelBarHeightF = 0.05
>  resP at pmLabelBarHeightF = 0.08
> resP at pmLabelBarOrthogonalPosF = -0.016
> ; resP at gsnPanelYWhiteSpacePercent = 5.           ; increase spacing along
> Y-axis between panel plots
>  resP at gsnPanelYWhiteSpacePercent = 2;;increases the figure size
> ; increase spacing along Y-axis between panel plots
> res at lbLabelFontHeightF = 0.018
> resP at lbLabelFont = "22"
> ;  resP at lbTitleString    = ""+tic+""
>  resP at cnLinesOn       = False                   ; turn off contour lines
>   resP at lbLabelFont    = "helvetica-bold"          ; add common colorbar
>   resP at lbTitleFont    = "helvetica-bold"          ; add common colorbar
>   resP at lbTitleFontHeightF= .015                 ; make title smaller
>   resP at cnLineLabelsOn  = False
>   resP at txFontHeightF   = 0.03
>   resP at txFont   = "helvetica-bold"
>
> gsn_panel(wks,plot,(/1,2/),resP)
> ;---This will maximize the size of all the paneled stuff.
> ;end do
>
> end
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210330/c2103e1d/attachment.html>


More information about the ncl-talk mailing list