Re: Get forecast time from GFS gribfiles

From: Alan Brammer <abrammer_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 12 2012 - 10:26:56 MST

Hi Jonas,

  The attributes your reading in are strings so it needs some manipulation before you can add them up. This is a slightly adapted method of how I used to do this, its not entirely clean but it should work.

mm = stringtoint( str_get_cols(wind_u@initial_time,0,1) )
dd = stringtoint( str_get_cols(wind_u@initial_time,3,4) )
yyyy = stringtoint( str_get_cols(wind_u@initial_time,6,9) )
hh = stringtoint( str_get_cols(wind_u@initial_time,12,13) )

initial_time = cd_inv_calendar(yyyy, mm,dd, hh, 00, 00, "hours since 1800-01-01 00:00:00",0)
valid_time = initial_time + stringtoint(wind_u@forecast_time)
valid_time@units = initial_time@units

; Add to plot
res@gsnRightString = "Valid: "+cd_calendar(valid_time,-3) ; or cd_string if you want nicely formatted outputs

        good luck.

Alan.

-------------------------------------
Alan Brammer,
PhD Student,

Department of Atmospheric and Environmental Sciences, University at
Albany, SUNY, Albany, NY, 12222

-------------------------------------
On Dec 12, 2012, at 10:16 AM, Jonas Kaufmann <jonas.kaufmann@gmail.com> wrote:

> wind_u@initial_time

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 13 02:27:53 2012

This archive was generated by hypermail 2.1.8 : Wed Dec 12 2012 - 19:07:01 MST