RE: [ncl-talk] add plots in ncl

From: Debasish Pai Mazumder <debasish_at_nyahnyahspammersnyahnyah>
Date: Fri, 3 Aug 2007 11:23:23 -0800

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, (/4,4/), "float")
 DUSTAOD5@_FillValue = -9999

 aod5 = new((/3,4/),"float", DUSTAOD5@_FillValue)
 day5 = new((/1,4/),"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")
 plot = new(1,graphic)

 res1 = True
 res1_at_gsnDraw = False ;don't draw
 res1_at_gsnFrame = False
 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(0) = 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
----------------------------------

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 Fri Aug 03 2007 - 13:23:23 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 06 2007 - 08:08:45 MDT