Add strict matching for basin names

master
Daniel Howe 6 years ago
parent 8c47977a84
commit 2092571b01

@ -230,14 +230,14 @@ def open_browser(download_dir):
return driver return driver
def telemetered_bore_downloader(basin, def telemetered_bore_downloader(basin_name,
download_dir=None, download_dir=None,
start_date=None, start_date=None,
end_date=None): end_date=None):
"""Download multiple records from telemetered bore. """Download multiple records from telemetered bore.
Args: Args:
basin: basin name or code (string) basin_name: basin name (string)
download_dir: path to where downloaded files will be saved download_dir: path to where downloaded files will be saved
start_date: start date (string YYYY-MM-DD format) start_date: start date (string YYYY-MM-DD format)
end_date: end date (string YYYY-MM-DD format) end_date: end date (string YYYY-MM-DD format)
@ -250,15 +250,9 @@ def telemetered_bore_downloader(basin,
basins = get_basins() basins = get_basins()
# Check if full basin name was provided # Check if full basin name was provided
if basin in basins['Basin name'].values: basin_names = basins['Basin name'].unique()
basin_name = basin if basin_name not in basin_names:
else: raise ValueError("'basin_name' must be one of:\n" + '\n'.join(basin_names))
try:
# Check ift two-letter basin code was provided
basin_name = basins.groupby('Basin code').first().loc[basin][
'Basin name']
except KeyError:
raise KeyError('Basin {} not found'.format(basin))
# Get list of bore IDs from selected basin # Get list of bore IDs from selected basin
bore_ids = basins[basins['Basin name'] == basin_name].index.values bore_ids = basins[basins['Basin name'] == basin_name].index.values

Loading…
Cancel
Save