Python library for dealing with time associated data? -


i've got data (noaa-provided weather forecasts) i'm trying work with. there various data series (temperature, humidity, etc), each of contains series of data points, , indexes array of datetimes, on various time scales (some series hourly, others 3-hourly, daily). there sort of library dealing data this, , accessing in user-friendly way. ideal usage like:

db = timedata()  db.set_val('2010-12-01 12:00','temp',34)  db.set_val('2010-12-01 15:00','temp',37)  db.set_val('2010-12-01 12:00','wind',5)  db.set_val('2010-12-01 13:00','wind',6)  db.query('2010-12-01 13:00') # {'wind':6, 'temp':34}   

basically query return recent value of each series. looked @ scikits.timeseries, isn't amenable use case, due amount of pre-computation involved (it expects data in 1 shot, no random-access setting).

if data sorted can use bisect module entry greatest time less or equal specified time.

something like:

i = bisect_right(times, time) # times[j] <= time j<i # times[j] > time j>=i if times[i-1] == time:       # exact match       value = values[i-1] else:       # interpolate       value = (values[i-1]+values[i])/2 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -