[ncl-talk] sub: read ascii error

Alessandra Giannini alesall at iri.columbia.edu
Tue Mar 30 13:51:07 MDT 2021


ok, thanks. more questions — 

So, “data” is a matrix of dimensions 345960 by 6.

1) what is the 6 dimension? what are the 6 "fields"?

2) regarding the 345960 dimension — 
nlat x nlon = 720x1440 = 1036800, which is larger than 345960.
So, each one of the 6 dimensions cannot be a map, given the nlat and nlon dimension you specify.

I give up!





> On Mar 30, 2021, at 2:41 PM, dale zuri via ncl-talk <ncl-talk at mailman.ucar.edu> wrote:
> 
> 
> 
> ---------- Forwarded message ---------
> From: dale zuri <dalezuri at gmail.com <mailto:dalezuri at gmail.com>>
> Date: Tue, Mar 30, 2021 at 12:36 PM
> Subject: Re: [ncl-talk] sub: read ascii error
> To: Alessandra Giannini <alesall at iri.columbia.edu <mailto:alesall at iri.columbia.edu>>
> 
> 
> Hi,
> Thanks for your response.  
> Variable: data
> Type: float
> Total Size: 8303040 bytes
>             2075760 values
> Number of Dimensions: 2
> Dimensions and sizes: [345960] x [6]
> Coordinates: 
> Number Of Attributes: 1
> 
> On Tue, Mar 30, 2021 at 12:00 PM Alessandra Giannini <alesall at iri.columbia.edu <mailto:alesall at iri.columbia.edu>> wrote:
> 
> 
> Hi there, 
> 
> can you print out:
> 
> printVarSummary(data)
> 
> ?
> 
> are lat and lon really included in the matrix called “data”?
> The way you define “templat” and “templon”, they should have the same dimension. (Is said dimension nlat x nlon?)
> 
> At any rate, lon and lat should be 1-dimensional. 
> 
> Rule #0 of ncl-talk is that you should have an idea of the structure of your data…
> Maybe you do, but you are not telling us!
> 
> warm regards, alessandra
> 
> 
> 
> 
> 
>> On Mar 30, 2021, at 1:45 PM, dale zuri via ncl-talk <ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu>> wrote:
>> 
>> Hi Adam,
>> I would appreciate any help to plot this ASCII data. 
>> 
>> Thanks
>> DZ
>> 
>> 
>> ---------- Forwarded message ---------
>> From: dale zuri <dalezuri at gmail.com <mailto:dalezuri at gmail.com>>
>> Date: Tue, Mar 30, 2021 at 10:24 AM
>> Subject: sub: read ascii error
>> To: Ncl-talk <ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>>
>> 
>> 
>> Dear NCL user,
>> I would appreciate any help to plot this data. I'm getting this error. 
>> 
>> Thanks in advance
>> DZ
>> 
>> fatal:Variable (lat) is undefined
>> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 18 in file test.ncl
>> 
>> 
>> 
>> 
>> begin
>> nlat=720
>> nlon=1440
>> 
>> ncol  = 6
>> nhead = 1
>> 
>> fname = "avhrr_seaice"
>> data = readAsciiTable("avhrr_seaice", ncol, "float", nhead)
>> temp12D = onedtond(data(2,:),(/nlat,nlon/)) ; convert 1D array to a 2D array
>> temp22D = onedtond(data(3,:),(/nlat,nlon/)) ; convert 1D array to a 2D array
>> templat = data(0,:) ; convert 1D array to a 2D array
>> templon = data(1,:) ; convert 1D array to a 2D array
>> ; Assign named dimensions
>>   temp12D!0 = "lat"
>>   temp12D!1 = "lon"
>>   temp12D&lat =  templat               ; assign coord variables
>>   temp12D&lon =  templon 
>>   temp22D!0 = "lat"
>>   temp22D!1 = "lon"
>>   temp22D&lat =  templat               ; assign coord variables
>>   temp22D&lon =  templon  
>>     temp12D&lat at units = "degrees_north"
>>     temp12D&lon at units = "degrees_east" 
>>     temp22D&lat at units = "degrees_north"
>>     temp22D&lon at units = "degrees_east"
>> ; Assign coordinate variables
>>   printVarSummary(temp12D) 
>>   printVarSummary(temp22D) 
>> 
>> wks = gsn_open_wks("x11","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 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,temp12D(:,0),res)
>> res at gsnCenterString    = "JJAS"
>>   plot(1) = gsn_csm_contour_map_polar(wks,temp22D(:,1),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
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk <https://mailman.ucar.edu/mailman/listinfo/ncl-talk>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210330/0a43f086/attachment.html>


More information about the ncl-talk mailing list