Skip to content

Commit

Permalink
When gates span sectors, use the mode rather than split the gate
Browse files Browse the repository at this point in the history
See #28
  • Loading branch information
mankoff committed Nov 11, 2021
1 parent 8800f04 commit f033d4a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ice_discharge.org
Original file line number Diff line number Diff line change
Expand Up @@ -2928,12 +2928,24 @@ meta.rename(inplace=True, columns={'regions@Mouginot_2019':'regions',
'gates_gateID@gates_100_5000':'gates'})
regions = {1:'NO', 2:'NE', 3:'CE', 4:'SE', 5:'SW', 6:'CW', 7:'NW'}
meta['regions'] = meta['regions'].map(regions.get) # Convert sector numbers to meaningful names
# UNDO with foo.replace({'NO':1,'NW':2,'NE':3,'CW':4,'CE':5,'SW':6,'SE':7})
meta['ones'] = 1

R = pd.read_csv('./out/gate_meta.csv')
meta['name'] = ''
for g in meta['gates'].unique(): meta.loc[meta['gates'] == g, 'name'] = R[R['gate'] == g]['Mouginot_2019'].values

# from IPython import embed; embed()

### https://github.com/GEUS-Glaciology-and-Climate/ice_discharge/issues/28
### Gates span sectors and regions. Assign to their primary sector or region
### meta.groupby('gates').mean()['sectors'].values
### meta[meta['gates'] == 239].sectors
### Don't seem to span regions (run same code but do it above before "map(regions.get)"
for g in meta['gates'].unique():
meta.loc[meta['gates'] == g, 'sectors'] = meta[meta['gates'] == g]['sectors'].mode()
# meta.loc[meta['gates'] == g, 'regions'] = meta[meta['gates'] == g]['regions'].mode()

###
### Load BASELINE velocity
###
Expand Down
12 changes: 12 additions & 0 deletions raw2discharge.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@
'gates_gateID@gates_100_5000':'gates'})
regions = {1:'NO', 2:'NE', 3:'CE', 4:'SE', 5:'SW', 6:'CW', 7:'NW'}
meta['regions'] = meta['regions'].map(regions.get) # Convert sector numbers to meaningful names
# UNDO with foo.replace({'NO':1,'NW':2,'NE':3,'CW':4,'CE':5,'SW':6,'SE':7})
meta['ones'] = 1

R = pd.read_csv('./out/gate_meta.csv')
meta['name'] = ''
for g in meta['gates'].unique(): meta.loc[meta['gates'] == g, 'name'] = R[R['gate'] == g]['Mouginot_2019'].values

# from IPython import embed; embed()

### https://github.com/GEUS-Glaciology-and-Climate/ice_discharge/issues/28
### Gates span sectors and regions. Assign to their primary sector or region
### meta.groupby('gates').mean()['sectors'].values
### meta[meta['gates'] == 239].sectors
### Don't seem to span regions (run same code but do it above before "map(regions.get)"
for g in meta['gates'].unique():
meta.loc[meta['gates'] == g, 'sectors'] = meta[meta['gates'] == g]['sectors'].mode()
# meta.loc[meta['gates'] == g, 'regions'] = meta[meta['gates'] == g]['regions'].mode()

###
### Load BASELINE velocity
###
Expand Down

0 comments on commit f033d4a

Please sign in to comment.