Re: Another xy plot qustion

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sat Apr 23 2011 - 14:59:02 MDT

I suggest you use

    printVarSummary(temp)

This will tell you the name of the 'time' dimension.
Let's say Let's say it is

    "initial_time0_hours"

Replace everything after
    wks = ...

with

;---Set some resources for the map.
res = True
res@cnMonoLineColor = True ; Turn off ...
res@tiMainString = "Temperature (C)" ; Create a title.
plot = gsn_csm_xy (wks, temp&initial_time0_hours, temp, res)

or, for clarity,

     time = temp&initial_time0_hours
     plot = gsn_csm_xy (wks, time, temp, res)

=============
Please look at the xy examples at

http://www.ncl.ucar.edu/Applications/
\Good luck

On 4/23/11 11:33 AM, ugo merlini wrote:
> Hi,
>
> I'm able to read from opendap server where a I grab GFS model data. In
> particular I want to make an xy plot with 2m temperature on Y axis and
> time on X axis
>
> here my script
>
> 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/contributed.ncl"
>
>
> begin
>
>
> url = "http://nomad1.ncep.noaa.gov:9090/dods/gfs_master/gfs20110417/"
> filename = url + "gfs_master_00z"
>
> exists = isfilepresent(filename)
> if(.not.exists) then
> print("OPeNDAP isfilepresent test unsuccessful.")
> print("Either file doesn't exist, or NCL does not have OPeNDAP
> capabilities on this system")
> else
> print("OPeNDAP isfilepresent test successful.")
> a = addfile(filename,"r")
> vars = getfilevarnames(a)
> end if
>
> temp = a->tmp2m(:,48,9) ; temperature
> temp = temp - 273.15
> temp@units = "(C)"
> print(temp)
> print(temp!0)
>
>
> ;--- Open workstation
> wks_type = "png"
> wks = gsn_open_wks(wks_type,"2m Temperature")
>
> ;---Set some resources for the map.
> res = True
> res@cnMonoLineColor = True ; Turn off the drawing of contours lines in
> one color.
> res@tiMainString = "Temperature (C)" ; Create a title.
> field1 = create "field1" coordArraysClass defaultapp
> "caYArray": (temp)
> "caXArray": (temp!0)
>
> end create
> ;
> ; Create XyPlot object and assign data to it
> ;
> xy_plot = create "xy_plot" xyPlotClass wks
> "xyCoordData": field1
> end create
> draw(xy_plot)
> frame(wks)
>
> tmp2m data is a three dimensional array (time,lat,lon)
>
> print(temp) give me the value so the file is readed correctly
>
> I don't undestand how assign the Y axis and the X
>
> I'm doing a 2 dimension plot?
>
> regards
>
> Ugo
>
>
>
> _______________________________________________
> 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 Sat Apr 23 14:59:12 2011

This archive was generated by hypermail 2.1.8 : Tue May 03 2011 - 14:47:35 MDT