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
def test_fdc(): d16 = wa.nwis('dv', '01659500', 'sites') ci = wa.fdc(d16.data, 'value', 1900, 2016) assert type(ci[0]) == list
def test_nwis_gw(): nw = wa.nwis('gwlevels', '16010204', 'huc', siteStatus='all') df = nw.avg_wl() assert len(df) > 5
def test_nwis(): nw = wa.nwis('dv', '01585200', 'sites') assert len(nw.sites) == 1
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)
def test_gantt(): ashley = wa.nwis('dv', '09265500', 'sites') gn = wa.gantt(ashley.data, stations=['value']) assert type(gn.gantt()[2]) == matplotlib.figure.Figure