Skip to content

Commit

Permalink
Debugged new AMOCs
Browse files Browse the repository at this point in the history
  • Loading branch information
ledm committed Nov 20, 2024
1 parent d7a8aa0 commit b95efd6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
25 changes: 14 additions & 11 deletions bgcval2/functions/circulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def loadDataMask(gridfn, maskname, grid):
global tmask_AMOC55N

global loadedArea
global loadedAltMask
# global loadedAltMask

if grid == 'eORCA1':
LON = eORCA1_drake_LON
Expand Down Expand Up @@ -231,13 +231,15 @@ def loadAtlanticMask(altmaskfile, maskname='tmaskatl', grid = 'eORCA1'):
global loadedAltMask
if grid == 'eORCA1':
latslice26Nnm = eORCA1_latslice26Nnm
latslice40N = eORCA1_latslice40N
latslice55N = eORCA1_latslice55N

else:
raise ValueError("Grid not recognised in this calculation: %s", grid)
nc = dataset(altmaskfile, 'r')
alttmask_AMOC26N = nc.variables[maskname][latslice26Nnm, :]
alttmask_AMOC40N = nc.variables[maskname][latslice40N, :]
alttmask_AMOC55N = nc.variables[maskname][latslice55N, :]

nc.close()
loadedAltMask = True

Expand Down Expand Up @@ -326,34 +328,35 @@ def TwentySixNorth(nc, keys, lat='26N', return_max_depth=False, **kwargs):
if not loadedArea:
loadDataMask(areafile, maskname, grid)

altmaskfile = get_kwarg_file(kwargs, 'altmaskfile', default = 'bgcval2/data/basinlandmask_eORCA1.nc')
if not loadedAltMask:
loadAtlanticMask(altmaskfile, maskname='tmaskatl', grid=grid)

if grid == 'eORCA1':
if lat == '26N':
latslice = eORCA1_latslice26Nnm
e1v_AMOC = e1v_AMOC26N
alttmask_AMOC = alttmask_AMOC26N
alttmask_AMOC = alttmask_AMOC26N[:]
tmask_AMOC = tmask_AMOC26N
e3v_AMOC = e3v_AMOC26N

elif lat == '40N':
latslice = eORCA1_latslice40N
e1v_AMOC = e1v_AMOC40N
alttmask_AMOC = alttmask_AMOC40N
alttmask_AMOC = alttmask_AMOC40N[:]
tmask_AMOC = tmask_AMOC40N
e3v_AMOC = e3v_AMOC40N

elif lat == '55N':
latslice = eORCA1_latslice55N
e1v_AMOC = e1v_AMOC55N
alttmask_AMOC = alttmask_AMOC55N
alttmask_AMOC = alttmask_AMOC55N[:]
tmask_AMOC = tmask_AMOC55N
e3v_AMOC = e3v_AMOC44N

else:
raise ValueError('Region not recognised', lat)

altmaskfile = get_kwarg_file(kwargs, 'altmaskfile', default = 'bgcval2/data/basinlandmask_eORCA1.nc')
if not loadedAltMask:
loadAtlanticMask(altmaskfile, maskname='tmaskatl', grid=grid)
elif grid == 'eORCA025':
assert 0
latslice = eORCA025_latslice26Nnm
Expand Down Expand Up @@ -652,21 +655,21 @@ def AMOC26N(nc, keys, **kwargs):
if kwargs.get('grid',None) == 'eORCA025':
return twentysixnorth025(nc, keys, **kwargs)
else:
atlmoc = TwentySixNorth(nc, keys, lat='26N' **kwargs)
atlmoc = TwentySixNorth(nc, keys, lat='26N', **kwargs)
return atlmoc.max()

def AMOC40N(nc, keys, **kwargs):
if kwargs.get('grid',None) == 'eORCA025':
return twentysixnorth025(nc, keys, **kwargs)
else:
atlmoc = TwentySixNorth(nc, keys,lat='40N' **kwargs)
atlmoc = TwentySixNorth(nc, keys,lat='40N', **kwargs)
return atlmoc.max()

def AMOC55N(nc, keys, **kwargs):
if kwargs.get('grid',None) == 'eORCA025':
return twentysixnorth025(nc, keys, **kwargs)
else:
atlmoc = TwentySixNorth(nc, keys, lat='55N' **kwargs)
atlmoc = TwentySixNorth(nc, keys, lat='55N', **kwargs)
return atlmoc.max()


Expand Down
2 changes: 1 addition & 1 deletion key_lists/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ keys:
# soicecov: True
# hfds: True
# somesatr: True
hfy: True
hfy: True

# sosafldo: True

Expand Down
4 changes: 3 additions & 1 deletion key_lists/tfamoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ keys:
SST: True
DrakePassageTransport: True
AMOC_26N: True
AMOC_40N: True
AMOC_55N: True
AtmosCO2: True
AtlanticSubtropicSalinity: True
GINSalinity: True
Expand All @@ -22,9 +24,9 @@ keys:
fsitherm: True
sowaflup: True
hfds: True
hfy: True
sosafldo: True
somesatr: True

hfbasinatlantic: True
sowindsp: True
friver: True
Expand Down

0 comments on commit b95efd6

Please sign in to comment.