diff --git a/waternsw_grabber/waternsw_grabber.py b/waternsw_grabber/waternsw_grabber.py index c980b7f..5bb1959 100644 --- a/waternsw_grabber/waternsw_grabber.py +++ b/waternsw_grabber/waternsw_grabber.py @@ -324,8 +324,15 @@ def extract_definitions(input_dir, output_dir): sites = sites.set_index('ID') # Get basin from master site dataframe - sites['Basin name'] = basins.loc[sites.index, 'Basin name'] - sites['Basin code'] = basins.loc[sites.index, 'Basin code'] + try: + sites['Basin name'] = basins.loc[sites.index, 'Basin name'] + sites['Basin code'] = basins.loc[sites.index, 'Basin code'] + except ValueError: + # FIXME: Some bores have duplicate IDs! + # Get basin name from input directory + sites['Basin name'] = input_dir + basin_idx = basins['Basin name'] == input_dir + sites['Basin code'] = basins.loc[basin_idx, 'Basin code'].values[0] # Save variable definitions variables = pd.DataFrame(