# Re: one dimensional data

Date: Thu Dec 17 2009 - 04:55:37 MST

Hi Dan

I think it's useful for all plot problems.
http://www.ncl.ucar.edu/Document/Manuals/graphics_man.pdf

Leonardo

= = = = = = = = = = = =
Quoting Mary Haley <haley@ucar.edu>:

> Hi Dan,
>
> The idea behind plotting X,Y,Z data that is 1-dimensional is that you
> should have a set of random points scattered about in a 2D plane,
> each with a different Z value.
>
> I don't understand this code:
>
> yy = new((/50/),float)
> do j = 0,49
> yy(j) = 1
> end do
> print(yy)
>
> This creates an array of 50 elements all equal to 1.0. This doesn't
> seem very "random". Your Y values are effectively all on a straight
> line. Was this intentional? I'm not sure how well NCL can contour
> data like this.
>
> By the way, the above code doesn't need to be done with a loop:
>
> yy = new(50,float)
> yy = 1.0
>
> Is your script giving you some kind of error? If so, it would help to
> include that in an email.
>
> --Mary
>
>
> On Dec 16, 2009, at 1:25 PM, Dan Barrie wrote:
>
>> Dear NCL users,
>>
>> I am trying to plot a 1-dimensional variable: the results from a
>> channel model that has a spatial dimension of 1x50. I understand
>> from other emails in the NCL-Talk archive that the resources
>> sfXArray and sfYArray are used when plotting 1-dimensional data,
>> but I have been unsuccessful in producing a plot with my data.
>> Thanks in advance for the help. My script is attached.
>>
>> -Dan
>> ;================================================;
>> ; hovmoller.ncl
>> ;================================================;
>> ; ================================================;
>>
>> begin
>>
>> ;=================================================;
>> ; open file and read in data
>> ;=================================================;
>>
>> I = in(:,1:50)
>> ;D = in2(:,1:50)
>> dimension = dimsizes(I)
>> I!0 = "time"
>> I!1 = "Latitude"
>> I&time = D(:,0)
>> I&Latitude = LAT(0,:)
>> printVarSummary(I)
>>
>> ;=================================================;
>> ; PLOT
>> ;=================================================;
>>
>> yy = new((/50/),float)
>> do j = 0,49
>> yy(j) = 1
>> end do
>> print(yy)
>>
>> do i = 0,20000,10
>> name = sprinti("%0.4i",i)
>> times = D(i,0)/365
>>
>> wks = gsn_open_wks("ps",""+name+"") ; open a ncgm file
>> gsn_define_colormap(wks,"rainbow") ; choose a colormap
>> colors = gsn_retrieve_colormap(wks)
>> do i = 2,3,1
>> colors(i,:) = (/1,1,1/)
>> end do
>> ;gsn_define_colormap(wks,colors)
>>
>> res = True ; plot mods desired
>>
>> ;res@gsnDraw = False
>> ;res@gsnFrame = False
>> res@cnFillOn = True ; turn on color
>> res@gsnSpreadColors = True ; use full range of colormap
>> res@gsnMaximize = True
>> ;res@cnFillMode = "CellFill"
>> res@cnLinesOn = False
>> res@tiMainFont = 22
>> res@tmXBLabelFont = 22
>> res@tmYLLabelFont = 22
>> res@tiXAxisFont = 22
>> res@tiYAxisFont = 22
>> res@lbLabelFont = 22
>> res@gsnStringFont = 22
>> res@lbLabelStride = 2
>> res@lbLabelFontHeightF = 0.015
>> res@lbOrientation = "Vertical"
>> res@tiMainString = "Temperature (degrees celsius)"
>> res@tiMainJust = "BottomLeft"
>> res@tiMainPosition = "Left"
>> res@gsnLeftString = ""+times+" days"
>> res@gsnRightString = "Black line = ice edge"
>> res@tiYAxisString = "Time (years)"
>> res@tiXAxisString = "Latitude"
>> res@cnLevelSelectionMode = "ManualLevels"
>> res@cnMinLevelValF = -20
>> res@cnMaxLevelValF = 30
>> res@cnLevelSpacingF = 5
>> res@lbLabelStride = 2
>> res@gsnXAxisIrregular2Linear = True
>> res@sfXArray = LAT(0,:)
>> res@sfYArray = yy
>>
>> plot1 = gsn_csm_contour(wks,I(i,:),res) ; contour the variable
>>
>> ;res1 = True
>> ;res1@gsnDraw = False
>> ;res1@gsnFrame = False
>> ;res1@cnLinesOn = True
>> ;res1@cnFillOn = False
>> ;res1@cnLevelSelectionMode = "ExplicitLevels"
>> ;res1@cnLevels = (/-10/)
>> ;res1@cnInfoLabelOn = False
>> ;res1@cnLineLabelsOn = False
>>
>> ;res1@cnLineThicknessF = 6.
>>
>> ;plot2 = gsn_csm_contour(wks,I(i,:),res1)
>>
>> ;overlay(plot1,plot2)
>> ;draw(plot1)
>> ;frame(wks)
>>
>> end do
>>
>> end
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 17 04:55:45 2009

This archive was generated by hypermail 2.1.8 : Thu Dec 17 2009 - 17:15:52 MST