RE: [ncl-talk] add plots in ncl

From: Debasish Pai Mazumder <debasish_at_nyahnyahspammersnyahnyah>
Date: Mon, 6 Aug 2007 11:00:02 -0800

Dear Lin,

I look through your program. It is okay. But I am not quite sure why it does
not create second and third lines? One thing I can tell you if try to plot
using markers instead of line, you will get all three in same plot.

To plot using different markers use resources are given below,

res1_at_xyMarkLineModes = (/"Markers", "Markers", "Markers"/)
res1_at_xyMarkers = (/3, 1, 7/)
res1_at_xyMarkerSizeF = 0.02
; res1_at_xyLineThicknesses = (/2.0, 2.0, 2.0/)
; res1_at_xyLineColors = (/"black", "blue", "red"/)
 res1_at_xyMarkerColor = (/"black", "blue", "red"/);

I guess you have less number of real values in your second and third
variable in compare to your timescale to generate a line plot.

Thanks

Debasish
 
-----Original Message-----
From: Lin Su [mailto:Lin.Su_at_Colorado.EDU]
Sent: Saturday, August 04, 2007 12:37 PM
To: ncl-talk_at_ucar.edu
Cc: Debasish Pai Mazumder
Subject: RE: [ncl-talk] add plots in ncl

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
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 06 2007 - 13:00:02 MDT

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