Re: Time Series Tickmark help

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sat, 28 Oct 2006 09:31:44 -0600 (MDT)

I speculate that the following is what you want:

      TIME = ut_calendar( A->time, 4)

  plot = gsn_csm_xy(wks, TIME, wspd(:,{levP},{latN},{lon}),res)

Good luck
D

> After reading in zonal and meridional wind speed files, I calculated
> velocity over a region,
> and I have tried creating a Time-Series plot of Wind Velocity (kts) at
> a level for a time span of 1990 to 2005.
>
> I cannot get my tickmarks for years (x-axis) to display correctly at
> all. I have used the ut_calandar function.
> I have attached my resulting plot.
>
> May I have some help?
>
> Sincerely,
> Erik
>
> ; ***********************************************
> 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"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> ;************************************************
> begin
> latN = 28.35
> lon = 77.12
> levP = 70
> ;************************************************
> ; read in data
> ;************************************************
> diri ="../../../../Volumes/KIRO_DRIVE/NCEP_reanalysis_data/NCEP_reanalysis_2/"
> ;diri = "../data/" ;Test directory to select
> fileIn = systemfunc ("ls "+diri+"wind_velocity_India_BIGFILE.nc")
>
> A = addfile(fileIn,"r")
> wspd = A->wspd
> printVarSummary(wspd)
> ;The following should return an array dimensioned (ntime,6), you will
> be interested in what is in (ntime,0)...
> temp = ut_calendar(A->time,0)
> time = temp(:,0)
> delete(temp)
>
> ; Now, use ind to grab the indices of time that equal a set year (say
> ; 1990), and then select the first returned index to get the start of a
> ; new year:
>
> yrstart = 1990
> yrend = 2005
> nyear = yrend-yrstart+1
> arrind = new(nyear,integer) ; set up array to house indices of first
> ; instance of year
> do gg = yrstart,yrend
> temp = ind(time.eq.gg) ; return the array indices where the
> ; array = gg
> arrind(gg-yrstart) = temp(0) ; grab the 0th index
> delete(temp)
> end do
> ;*****************************************************
> ;Plot Time Series of Wind Speed in knots
> ;******************************************************
> wks =
> gsn_open_wks("pdf","Time_Series_WindVelocity_India_Region_70mb_1990-2005")
> ; open an output file
>
> res = True ; plot mods desired
> res_at_tmXBMode="Explicit"
> res_at_tmXBValues=arrind ;leap year 1, 31*4+1
> res_at_tmXBLabels=ispan(yrstart,yrend,1)
> res_at_vpXF=0.1
> res_at_vpWidthF=0.8
> res_at_vpHeightF=0.5
> res_at_trXMaxF=dimsizes(time)
> res_at_tiMainString = "Wind Velocity over Region at 60,000 ft."
> ; add title
> wspd_at_units ="knots"
> wspd_at_long_name ="6 Hourly Wind Velocity"
> plot = gsn_csm_xy(wks, ispan(0,dimsizes(time)-1,1),
> wspd(:,{levP},{latN},{lon}),res) ; for year 365*4 for 4x daily
> end
> _______________________________________________
> 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 Sat Oct 28 2006 - 09:31:44 MDT

This archive was generated by hypermail 2.2.0 : Wed Nov 01 2006 - 11:37:05 MST