Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
7yl4r committed Jul 9, 2024
1 parent 73ae309 commit 0e9006a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions nerrs_data/exportStationCodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,24 @@ def exportStationCodes():
df = pd.DataFrame(data_rows[1:], columns=data_rows[0])

return df

def exportStationCodesDictFor(nerr_site_id):
df = exportStationCodes()
df = df.drop(columns=['Lat_Long', 'latitude', 'longitude'])
# view uniques like:
# df['state'].unique()

# === subset however you want:
# df = df[df['reserve_name'] == 'Sapelo Island']
# or
# df = df[df['state'] == 'ga']
# or
df = df[df['NERR_SITE_ID'] == nerr_site_id]

# === build the dict for the selection
for station_type in ['nut', 'met', 'wq']:
df_subset = df[df['Station_Code'].str.endswith(station_type)]
params_dict = {
row['Station_Code']: row['params_reported'].split(',') for index, row in df_subset.iterrows()
}
print('\n', station_type, ' = ', params_dict)

0 comments on commit 0e9006a

Please sign in to comment.