RE: [ncl-talk] add plots in ncl

From: Lin Su <Lin.Su_at_nyahnyahspammersnyahnyah>
Date: Sat, 4 Aug 2007 14:37:25 -0600 (MDT)

Dear all,

Firstly, thanks Debasish's great help:)

Now I tried more dataset and there is no more errors being showed up. However, I still got only 1 line (the first line is from AERONET data). Attched please find the ncl script(test.ncl), data(test.txt) and the plot (test.pdf). BTW, it's supposed to get 3 lines at the same plot.

I appreciate any suggestions and input!

Thanks again,
-Lin

---- Original message ----
>Date: Fri, 3 Aug 2007 14:50:39 -0800
>From: "Debasish Pai Mazumder" <debasish_at_gi.alaska.edu>
>Subject: RE: [ncl-talk] add plots in ncl
>To: "'Lin Su'" <Lin.Su_at_Colorado.EDU>, <ncl-talk_at_ucar.edu>
>
>Hi Lin,
>
>Just do
>
>day5 = new((/6/),"float")
>day5(:) = DUSTAOD5(:,0)
>
>instead of doing
>
>day5 = new((/1,6/),"float","No_FillValue")
>day5(0,:) = DUSTAOD5(:,0)
>
>then you can get rid of the warning massage
>
>"gsn_csm_xy: Fatal: X and Y must have the same dimensions sizes, or one must
>be one-dimensional and both have the same rightmost dimension."
>
>Thanks
>
>Debasish
>
>-----Original Message-----
>From: Lin Su [mailto:Lin.Su_at_Colorado.EDU]
>Sent: Friday, August 03, 2007 2:19 PM
>To: Debasish Pai Mazumder; 'Lin Su'; ncl-talk_at_ucar.edu
>Subject: RE: [ncl-talk] add plots in ncl
>
>Hello, Debasish,
>
>Thanks for your good suggestions:)
>
>When I tried 6 rows (see the following modified scripts and dataset), I
>still only got one line, and here is the error message:
>-------------------------------
>warning:asciiread: End of file reached and only (76) elements were read from
>the file, filling remaining elements with the default missing value for the
>requested type
>(0) plotting
>(0) gsn_csm_xy: Fatal: X and Y must have the same dimensions sizes, or
>one must be one-dimensional and both have the same rightmost dimension.
>---------------------------------------------------
>
>Thanks again,
>-Lin
>
>---- Original message ----
>>Date: Fri, 3 Aug 2007 11:23:23 -0800
>>From: "Debasish Pai Mazumder" <debasish_at_gi.alaska.edu>
>>Subject: RE: [ncl-talk] add plots in ncl
>>To: "'Lin Su'" <Lin.Su_at_Colorado.EDU>, <ncl-talk_at_ucar.edu>
>>
>>Dear Lin,
>>
>>I looked through your program. It is okay but I think you do not need
>>gsnDraw and gsnFrame so comment out those two line,
>>
>>; res1_at_gsnDraw = False ;don't draw
>>; res1_at_gsnFrame = False
>>
>>Secondly you have only one plot so you also do not need to declare
>>plot = new(1,graphic)
>>
>>you can simply write
>>
>>plot = gsn_csm_xy(wks, day5, aod5, res1)
>>
>>Now your main problem is you got only 1 line instead of three because you
>>have only two real values for your second and third variables rest of them
>>are missing values. NCL need at least three values to make line. If you
>>change one of your missing value with real vale we will get the line.
>>
>>Thanks
>>
>>Debasish
>>
>>
>>-----Original Message-----
>>From: Lin Su [mailto:Lin.Su_at_Colorado.EDU]
>>Sent: Friday, August 03, 2007 9:51 AM
>>To: Debasish Pai Mazumder; ncl-talk_at_ucar.edu
>>Subject: RE: [ncl-talk] add plots in ncl
>>
>>Hello, Debasish,
>>
>>Your information is very helpful, and the error is gone now:)
>>However, I got only one line instead of 3 as expected in my new plot. Here
>>is the simple case I am trying:
>>-------------------------------------
>>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>
>>begin
>> path = "/Volumes/Data/Models/cam/AOD/aeronet/"
>> fileHandle5= path + "test.txt"
>> DUSTAOD5 = asciiread(fileHandle5, (/6,4/), "float")
>> DUSTAOD5@_FillValue = -9999
>>
>> aod5 = new((/3,6/),"float", DUSTAOD5@_FillValue)
>> day5 = new((/1,6/),"float","No_FillValue")
>> day5(0,:) = DUSTAOD5(:,0)
>> aod5(0,:) = DUSTAOD5(:,1)
>> aod5(1,:) = DUSTAOD5(:,2)
>> aod5(2,:) = DUSTAOD5(:,3)
>>
>> delete(path)
>>
>> print("plotting")
>> wks = gsn_open_wks("pdf", "test")
>>>
>> res1 = True
>> res1_at_xyMarkLineModes = "Markers" ;1st line
>> res1_at_xyMarkers = 3
>> res1_at_xyMarkerSizeF = 0.02
>> res1_at_xyLineThicknesses = (/2.0,2.0,2.0/)
>> res1_at_xyLineColors = (/"black","blue","red"/)
>> res1_at_pmLegendDisplayMode = "Always" ; turn on legend
>> res1_at_pmLegendSide = "Top" ; Change location of
>> res1_at_pmLegendParallelPosF = .6 ; move units right
>> res1_at_pmLegendOrthogonalPosF = -0.3 ; move units down
>> res1_at_pmLegendWidthF = 0.15 ; Change width and
>> res1_at_pmLegendHeightF = 0.09 ; height of legend.
>> res1_at_lgPerimOn = False ; turn off box around
>> res1_at_lgTitleFontHeightF = .018
>> res1_at_lgTitleString = "Beijing(39.98N 116.38E)" ; create
>>legend title
>> res1_at_lgLabelFontHeightF = .015 ; label font height
>> res1_at_xyExplicitLegendLabels = (/"AERONET","10-m wind","ustar"/)
>> res1_at_tiXAxisString = "days in April 2001"
>> res1_at_tiYAxisString = "AOD[500nm] "
>> res1_at_tmLabelAutoStride = True
>> res1_at_trXLog = False
>> res1_at_trYLog = False
>> res1_at_trXMinF = 0.0
>> res1_at_trXMaxF = 30
>> res1_at_trYMinF = 0.0
>> res1_at_trYMaxF = 6.0
>>
>> plot = gsn_csm_xy(wks, day5, aod5, res1)
>>
>>end
>>---------------------------
>>
>>And here is the data (test.txt with 1st column Julian days):
>>
>>------------------------------
>>1.1 0.3 0.1 0.2
>>1.2 0.4 -9999 -9999
>>1.3 0.5 -9999 -9999
>>2.1 0.6 0.2 0.3
> 3.1 0.7 0.1 0.2
> 3.3 0.4 0.3 0.4
>
>>----------------------------------
>>
>>I appreciate any input to correct my wrong scripts!
>>
>>Thank you,
>>-Lin
>>
>>---- Original message ----
>>>Date: Thu, 2 Aug 2007 13:33:26 -0800
>>>From: "Debasish Pai Mazumder" <debasish_at_gi.alaska.edu>
>>>Subject: RE: [ncl-talk] add plots in ncl
>>>To: "'Lin Su'" <Lin.Su_at_Colorado.EDU>
>>>
>>>Dear Lin,
>>>
>>>I guess that you have missing values in your some columns because of that
>>>you get dimension mismatch error.
>>>
>>>One way I can fill with -9999 for skipping data or
>>>
>>>Check the last example in
>>>
>>> http://www.ncl.ucar.edu/Applications/ascii_multicol.shtml
>>>
>>>and specify the numder of rows where you have values and rest of them
>>assume
>>>-9999 i.e. missing values.
>>>
>>>Good luck
>>>
>>>Debasish
>>>
>>>
>>>-----Original Message-----
>>>From: Lin Su [mailto:Lin.Su_at_Colorado.EDU]
>>>Sent: Thursday, August 02, 2007 12:56 PM
>>>To: Debasish Pai Mazumder
>>>Subject: RE: [ncl-talk] add plots in ncl
>>>
>>>BTW, I have more than 400 lines data for each colummn, but sounds NCL only
>>>read 76 data of them? -Lin
>>>
>>>---- Original message ----
>>>>Date: Thu, 2 Aug 2007 12:44:44 -0800
>>>>From: "Debasish Pai Mazumder" <debasish_at_gi.alaska.edu>
>>>>Subject: RE: [ncl-talk] add plots in ncl
>>>>To: "'Lin Su'" <Lin.Su_at_Colorado.EDU>, <ncl-talk_at_ucar.edu>
>>>>
>>>>Dear Lin,
>>>>
>>>>You can declare
>>>>
>>>>data=new((/3,4/),float) ; dimension= column, time
>>>>
>>>>data(0,:)= column2(:)
>>>>data(1,:)= column3(:)
>>>>data(2,:)= column4(:)
>>>>
>>>>Then in plotting statement:
>>>>
>>>>plot= gsn_csm_xy (wks,day,data(:,:),res) ; create plot
>>>>
>>>>check the example2 in
>>>>
>>>>http://www.ncl.ucar.edu/Applications/xy.shtml
>>>>
>>>>Good luck
>>>>
>>>>Debasish
>>>>
>>>>-----Original Message-----
>>>>From: Lin Su [mailto:Lin.Su_at_Colorado.EDU]
>>>>Sent: Thursday, August 02, 2007 12:19 PM
>>>>To: Debasish Pai Mazumder; 'Lin Su'; ncl-talk_at_ucar.edu
>>>>Subject: RE: [ncl-talk] add plots in ncl
>>>>
>>>>Hello, Debasish,
>>>>
>>>>I appreciate your kindly reply:)
>>>>My case is as follows, and sorry that I didn't give more clearly
>>>expressions
>>>>in my last email:
>>>>
>>>>Now I have 4 columns data which looks like this:
>>>>----------------------------
>>>>1 0.1 0.2 0.1
>>>>2 0.2
>>>>3 0.2
>>>>4 0.4 0.3 0.5
>>>>---------------------------
>>>>The first column is the time (day), the second column is the data with
>the
>>>>whole column. However, the other two columns with only half data of
>column
>>>>2. How can I plot these 3 lines of time series in one plot? I tried to
>>>>seperate these data into 3 files and used gsn_csm_xy3 to plot it.
>However,
>>>I
>>>>got 3 y axes which I didn't expect.
>>>>
>>>>Thanks again,
>>>>-Lin
>>>>
>>>>
>>>>---- Original message ----
>>>>>Date: Thu, 2 Aug 2007 11:25:47 -0800
>>>>>From: "Debasish Pai Mazumder" <debasish_at_gi.alaska.edu>
>>>>>Subject: RE: [ncl-talk] add plots in ncl
>>>>>To: "'Lin Su'" <Lin.Su_at_Colorado.EDU>, <ncl-talk_at_ucar.edu>
>>>>>
>>>>>Dear Lin,
>>>>>
>>>>>You can check the "overlay" in
>>>>>
>>>>>http://www.ncl.ucar.edu/Document/Functions/Built-in/overlay.shtml
>>>>>
>>>>>or the example2 in
>>>>>
>>>>>http://www.ncl.ucar.edu/Applications/xy.shtml
>>>>>
>>>>>This example produces multiple line plots with varying colors,
>>>thicknesses,
>>>>>and markers.
>>>>>
>>>>>Thanks
>>>>>
>>>>>Debasish
>>>>>
>>>>>
>>>>>-----Original Message-----
>>>>>From: ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu] On
>>>>Behalf
>>>>>Of Lin Su
>>>>>Sent: Thursday, August 02, 2007 11:10 AM
>>>>>To: ncl-talk_at_ucar.edu
>>>>>Subject: add plots in ncl
>>>>>
>>>>>Hello, all,
>>>>>
>>>>>Could anybody tell me how to add another two lines in the xy plot? I
>>tried
>>>>>gsn_polyline and gsn_csm_xy3, and which are not what I need. Actually, I
>>>am
>>>>>looking for some function which likes IDL oplot.
>>>>>
>>>>>Thanks a lot,
>>>>>-Lin
>>>>>_______________________________________________
>>>>>ncl-talk mailing list
>>>>>ncl-talk_at_ucar.edu
>>>>>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

1.01 0.666990 0.3921967 0.7667063
1.02 0.673673 -9999 -9999
1.03 0.683627 -9999 -9999
1.04 0.766717 -9999 -9999
1.05 0.785233 -9999 -9999
1.06 0.956437 -9999 -9999
1.07 0.827316 -9999 -9999
1.08 0.933051 -9999 -9999
1.09 0.934332 -9999 -9999
1.10 0.966229 -9999 -9999
1.11 1.038647 -9999 -9999
1.12 0.786286 -9999 -9999
1.13 0.785892 -9999 -9999
1.14 0.712951 -9999 -9999
1.15 0.665290 -9999 -9999
1.16 0.669144 -9999 -9999
1.17 0.635362 -9999 -9999
1.18 0.627538 -9999 -9999
1.19 0.633248 -9999 -9999
2.01 0.633772 0.1922807 0.8347189
2.02 0.610905 -9999 -9999
2.03 0.456074 -9999 -9999
2.04 0.491173 -9999 -9999
2.05 0.513473 -9999 -9999
2.06 0.508634 -9999 -9999
2.07 0.592463 -9999 -9999
2.08 0.570994 -9999 -9999
2.09 0.625512 -9999 -9999
2.10 0.655983 -9999 -9999
2.11 0.655368 -9999 -9999
2.12 0.634062 -9999 -9999
2.13 0.687787 -9999 -9999
2.14 0.650326 -9999 -9999
2.15 0.672912 -9999 -9999
2.16 0.768503 -9999 -9999
2.17 0.754367 -9999 -9999
2.18 0.696888 -9999 -9999
2.19 0.691990 -9999 -9999
2.20 0.729436 -9999 -9999
2.21 0.686890 -9999 -9999
2.22 0.704352 -9999 -9999
2.23 0.713750 -9999 -9999
2.24 0.691732 -9999 -9999
2.25 0.690672 -9999 -9999
2.26 0.669735 -9999 -9999
2.27 0.690368 -9999 -9999
2.28 0.704474 -9999 -9999
2.29 0.714987 -9999 -9999
2.30 0.690203 -9999 -9999
2.31 0.528561 -9999 -9999
2.32 0.550196 -9999 -9999
2.33 0.560454 -9999 -9999
2.34 0.610742 -9999 -9999
2.35 0.623721 -9999 -9999
2.36 0.592692 -9999 -9999
2.37 0.568086 -9999 -9999
2.38 0.587491 -9999 -9999
2.39 0.561782 -9999 -9999
2.40 0.590070 -9999 -9999
3.01 0.600787 0.2846134 0.7005754
3.02 0.577977 -9999 -9999
3.03 0.589158 -9999 -9999
3.04 0.571283 -9999 -9999
3.05 0.551215 -9999 -9999
3.06 0.594788 -9999 -9999
3.07 0.646472 -9999 -9999
3.08 0.677773 -9999 -9999
3.09 0.546251 -9999 -9999
3.10 0.483780 -9999 -9999
3.11 0.493744 -9999 -9999
3.12 0.485836 -9999 -9999
3.13 0.500024 -9999 -9999
3.14 0.525831 -9999 -9999
3.15 0.505292 -9999 -9999
3.16 0.560872 -9999 -9999
3.17 0.559165 -9999 -9999
3.18 0.613582 -9999 -9999
3.19 0.565926 -9999 -9999
3.20 0.591896 -9999 -9999
3.21 0.603786 -9999 -9999
3.22 0.625366 -9999 -9999
3.23 0.621493 -9999 -9999
3.24 0.612210 -9999 -9999
3.25 0.627806 -9999 -9999
3.26 0.599671 -9999 -9999
3.27 0.582926 -9999 -9999
3.28 0.695932 -9999 -9999
3.29 1.515817 -9999 -9999
4.01 2.047272 0.3138736 0.7525298
4.02 2.210783 -9999 -9999
4.03 2.396380 -9999 -9999
5.01 1.50000 0.300000 1.20000

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Sat Aug 04 2007 - 14:37:25 MDT

This archive was generated by hypermail 2.2.0 : Tue Aug 07 2007 - 18:08:19 MDT