In [1]:
from pylab import *
import pandas as pd
import datetime as dt
from pyoos.collectors.usgs.usgs_rest import UsgsRest
In [2]:
box=[-87,46,-85,48]
In [3]:
# last few days
jd_start = dt.datetime.utcnow()- dt.timedelta(days=3)
jd_stop = dt.datetime.utcnow()
In [4]:
# hurricane sandy time period
jd_start = dt.datetime(2012,10,26)
jd_stop = dt.datetime(2012,11,2)
In [5]:
print jd_start
print jd_stop
In [6]:
c = UsgsRest()
In [7]:
c.list_variables()
Out[7]:
In [8]:
c.filter(bbox=tuple(box), start=jd_start, end=jd_stop)
col = c.collect()
col.calculate_bounds()
In [9]:
for sta in col.elements: print sta.name,sta.location.x,sta.location.y
In [10]:
type(sta)
Out[10]:
In [11]:
sta.get_unique_members()
Out[11]:
In [12]:
sta.properties()
Out[12]:
In [13]:
type(sta)
Out[13]:
In [14]:
sta.elements[0].time
Out[14]:
In [15]:
sta.elements[0].members
Out[15]:
In [16]:
d = [float(ele.members[0]['value']) for ele in sta.elements]
In [17]:
jd = [ele.time for ele in sta.elements]
In [18]:
df = pd.Series(d,index=jd)
In [19]:
df.plot()
Out[19]:
In [20]:
df.describe()
Out[20]:
In [21]:
df.sum()
Out[21]:
In [21]: