You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like the URL for the DV sites has changed. I noticed that data for newer sites does not download with the old URL construction. The sites pull into the field sites table fine with the old url and it seems like misc measurements are coming in but the daily values are not. I updated the make_dv_url function to this and this seems to work.
def make_dv_url(self, station_IDs, parameter_code='00060', start_date='1880-01-01', end_date=None):
"""Creates url to retrieve daily values for a site
Parameters
----------
stationIDs: int, str or list of ints or strings
USGS station IDs
parameter_code: (string)
e.g. 00060 for discharge.
See http://help.waterdata.usgs.gov/codes-and-parameters/parameters.
start_date: (string) 'YYYY-DD-MM'
To obtain the entire period-of-record use a start date of 1880-01-01 (default)...
Notes
-----
A leading zero is added to the site number if the first digit is greater than 1
(this can happend for basins 01 - 09 if the site number gets converted to an int).
Note that this may cause site numbers for basin 01 (North Atlantic slope) to get confused with
basins 10-16 (west coast and hawaii).
See <http://help.waterdata.usgs.gov/faq/sites/do-station-numbers-have-any-particular-meaning>
"""
if not isinstance(station_IDs, list):
station_IDs = [str(station_IDs)]
def add_leading_zero(station_ID):
if 1 < int(str(station_ID)[0]) < 10:
station_ID = '0{}'.format(station_IDs)
return station_ID
#station_IDs = ','.join(['0{}'.format(int(str(s))) for s in station_IDs])
station_IDs = ','.join([self._correct_stationID(s) for s in station_IDs])
url = 'https://waterdata.usgs.gov/nwis/dv?cb_00060=on&format=rdb'
url += '&site_no={}'.format(station_IDs)
url += '&begin_date={}'.format(start_date)
if end_date is not None:
url += '&end_date={}'.format(end_date)
#url += '¶meterCd={}'.format(parameter_code)
print('{}'.format(url))
return url
The text was updated successfully, but these errors were encountered:
Seems like the URL for the DV sites has changed. I noticed that data for newer sites does not download with the old URL construction. The sites pull into the field sites table fine with the old url and it seems like misc measurements are coming in but the daily values are not. I updated the make_dv_url function to this and this seems to work.
The text was updated successfully, but these errors were encountered: