ASIS Web Service Access Demo

Get single station data and plot it using Pandas.
Implements the custom ASIS web service described here: http://data.rcc-acis.org/doc/


In [1]:
import matplotlib
matplotlib.get_backend()


Out[1]:
'module://IPython.kernel.zmq.pylab.backend_inline'

In [1]:
import ACISLoader as A
import pandas as pd
import matplotlib.pyplot as plt

In [2]:
p = A.ACISLoader(sid='304174',sdate='2012-01-01',edate='por',elems='mint,maxt,pcpn')
df = p['304174']

In [3]:
df.mint.plot(figsize=(16,6)).set_title('Ithaca, NY min and max temperature')
df.maxt.plot(style='r')


Out[3]:
<matplotlib.axes.AxesSubplot at 0x45881d0>

In [4]:
pd.rolling_mean(df.mint,10,center=True).plot(figsize=(16,6)).set_title('10 day moving average')
pd.rolling_mean(df.maxt,10,center=True).plot(style='r')


Out[4]:
<matplotlib.axes.AxesSubplot at 0x45cfd90>

In [5]:
p = A.ACISLoader(sid='304174',sdate='1893-09-01',edate='por',elems=[
    dict(label='p_30',name='pcpn',interval=(1,0,0),duration=30,reduce='sum'),
    dict(label='p_60',name='pcpn',interval=(1,0,0),duration=60,reduce='sum'),
    dict(label='p_90',name='pcpn',interval=(1,0,0),duration=90,reduce='sum'),
    dict(label='p_120',name='pcpn',interval=(1,0,0),duration=120,reduce='sum'),
    ])
prcp = p['304174']

In [6]:
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(16, 6),sharex=True,sharey=True)
prcp.p_30.hist(ax=axes[0,0],color='k', alpha=0.5, bins=50); axes[0,0].set_title('30-day')
prcp.p_60.hist(ax=axes[0,1],color='k', alpha=0.5, bins=50); axes[0,1].set_title('60-day')
prcp.p_90.hist(ax=axes[1,0],color='k', alpha=0.5, bins=50); axes[1,0].set_title('90-day')
prcp.p_120.hist(ax=axes[1,1],color='k', alpha=0.5, bins=50); axes[1,1].set_title('120-day')


Out[6]:
<matplotlib.text.Text at 0x47eaf10>

In [6]: