Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I'm getting hourly UV index from the ftp site of NOAA. As mentioned here, the forecast time is present in the file name as uv.t12z.grbfXX, where XX is the forecast hour (01 to 120). But inside the grib2 files, the key hour always indicate that the hour is 12. Also the date doesn't changes at all in any of the file. As of today it is 2016/06/04 in all of the 120 files. I couldn't find the timezone in the key of the file as well.

So, I wanted to know, if I want to find the UV Index of Delhi(28.6139, 77.2090) timezone: Asia/Kolkata on 2016/06/05 at 2 pm, how can I calculate this from those files ? Is it the UV index in the uv.t12z.grbf38 file assuming 01 in the files is 00:00 hrs on 2016/06/04. I couldn't find anything in documentation regarding this.

Here's the code snippet for finding the hour:

import pygrib
grbs = pygrib.open('uv.t12z.grbf01.grib2')
grb = grbs.select(name='UV index')[0]
year = grb.year
month = grb.month
day = grb.day
hour = grb.hour
minute = grb.minute
print year,month,day,hour,minute

Output:

>>2016 6 4 12 0
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.