예제 #1
0
파일: zonal.py 프로젝트: inkenbrandt/UBM
def get_usgs_data(SITE, strtDT=''):
    # Grab USGS data for comparison
    if strtDT == '':
        strtDT = '2003-01-01'

    nw = wa.nwis('dv', SITE, 'sites', startDT=strtDT)
    data = nw.data
    label = nw.sites.station_nm[0].title()
    data['cfd'] = data.value * 86400  # cfs to cfd
    if isinstance(data.index, pd.core.index.MultiIndex):
        data.index = data.index.droplevel(0)
    # convert to acft by converting from monthly sum of cfd to acft-mo
    acft = data['cfd'].groupby(pd.TimeGrouper('MS',
                                              label='left')).sum() * 2.29569E-5
    acft = acft.to_frame()
    acft['month'] = acft.index.month

    return acft, label
예제 #2
0
def test_fdc():
    d16 = wa.nwis('dv', '01659500', 'sites')
    ci = wa.fdc(d16.data, 'value', 1900, 2016)
    assert type(ci[0]) == list
예제 #3
0
def test_nwis_gw():
    nw = wa.nwis('gwlevels', '16010204', 'huc', siteStatus='all')
    df = nw.avg_wl()
    assert len(df) > 5
예제 #4
0
def test_nwis():
    nw = wa.nwis('dv', '01585200', 'sites')
    assert len(nw.sites) == 1
예제 #5
0
def test_get_info():
    nw = wa.nwis('gwlevels', '16010204', 'huc', siteStatus='all')
    df = nw.get_info(siteStatus='all')
    assert 'site_no' in list(df.columns)
예제 #6
0
def test_gantt():
    ashley = wa.nwis('dv', '09265500', 'sites')
    gn = wa.gantt(ashley.data, stations=['value'])
    assert type(gn.gantt()[2]) == matplotlib.figure.Figure