# extracted files gagepath = '{}/gagedata'.format(directory) # all HUC8 NWIS flow data path # time series start and end start = datetime.datetime(1980, 1, 1) # start date for timeseries end = datetime.datetime(2010, 1, 1) # end date for timeseries # create an instance of the NWIS extractor nwisextractor = NWISExtractor(NWIS) # extract the locations of the gage stations in the HUC8 (Patuxent watershed) # into a new shapefile nwisextractor.extract_HUC8(HUC8, directory) # and download all the daily flow and water quality data across the period # for the gages in the gage shapefile if not os.path.isdir(gagepath): nwisextractor.download_all(start, end, output = gagepath) # alternatively, download the daily flow and water quality data for one gage # given the USGS NWIS Site ID number (Hunting Creek) gageid = '01594670' gagedata = 'hunting_station' nwisextractor.download_gagedata(gageid, start, end, output = gagedata)
# create an instance of the NWIS extractor and provide the location of the # metadata file (that is downloaded if it doesn't exist) nwisextractor = NWISExtractor(NWIS) # extract the locations of the gage stations in the HUC8 (Patuxent watershed) # into a new shapefile nwisextractor.extract_HUC8(HUC8, directory) # and download all the daily flow and water quality data across the period # for the gages in the gage shapefile if not os.path.isdir(gagepath): nwisextractor.download_all(start, end, output = gagepath) # alternatively, download the daily flow and water quality data for one gage # given the USGS NWIS Site ID number (Hunting Creek) gageid = '01594670' gagedata = 'hunting_station' nwisextractor.download_gagedata(gageid, start, end, output = gagedata) # the output directory will contain images with flow-duration curves and # daily flow hydrographs. the statements below show how to access the data # from the downloaded files. let's open up the data files from the patuxent # directory that was made above. print('fetching flow data from the Patuxent watershed')