-
Notifications
You must be signed in to change notification settings - Fork 1
Added several Mission atlantic developments and a shelve fixer tool #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 18 commits
d689b03
43e52db
31a7bb0
ea9d2fc
d63c66d
7b25785
7f645d5
dd88b1a
c7cd5b0
a1d0407
290ee4d
6b06595
8ec9ecb
b3af6e4
918c6c8
bf27519
e9d9deb
c78c1ea
d8a8884
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,8 @@ | |
| from bgcval2.bgcvaltools.dataset import dataset | ||
| from bgcval2.functions.get_kwarg_file import get_kwarg_file | ||
| from bgcval2.functions.standard_functions import find_best_var | ||
| import os | ||
|
|
||
|
|
||
| global loadedArea | ||
| global model_area | ||
|
|
@@ -84,6 +86,10 @@ def MA_TotalIntPP(nc, keys, **kwargs): | |
| # This will only work for NEMO models: | ||
| thkfn = nc.filename.replace('diag_T', 'grid_T').replace('ptrc_T', 'grid_T') | ||
| print('MA_TotalIntPP: opening:', thkfn) | ||
| if not os.path.exists(thkfn): | ||
| print('MA_TotalIntPP: ERROR: does not exist:', thkfn) | ||
| return np.ma.masked | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. np.ma.masked what? That's just a generic Numpy function
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a masked value, so that the arrays all line up corectly, even if there's no data here.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a |
||
|
|
||
| thknc = dataset(thkfn, 'r') | ||
| thick = thknc.variables['thkcello'][:] | ||
| thknc.close() | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -244,7 +244,6 @@ def TwentySixNorth(nc,keys,**kwargs): | |||||||||||||||||||
|
|
||||||||||||||||||||
| assert 0 | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| zv = np.ma.array(nc.variables[keys[0]][..., latslice26Nnm, :]) # m/s | ||||||||||||||||||||
| atlmoc = np.array(np.zeros_like(zv[0, :, :, 0])) | ||||||||||||||||||||
| print('TwentySixNorth:', e3v_AMOC26N.shape, atlmoc.shape, zv.shape) | ||||||||||||||||||||
|
|
@@ -290,11 +289,35 @@ def twentysixnorth025(nc,keys,**kwargs): | |||||||||||||||||||
| depths = np.ma.masked_where(thkcello.mask + np.abs(depths)<500., depths) # masked above 500m depth. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| e1v = e1v_AMOC26N[:,None, :, :] | ||||||||||||||||||||
| flux = vo * depths * e1v_AMOC26N[:,None, :, :]/1.E06 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| moc=np.ma.zeros_like(flux) | ||||||||||||||||||||
| np.ma.cumsum(flux[:,::-1], axis=1, out=moc ) # sum floor to surface | ||||||||||||||||||||
| return moc.max() | ||||||||||||||||||||
| # flux = vo * thkcello * e1v_AMOC26N[:,None, :, :]/1.E06 | ||||||||||||||||||||
| # moc=np.ma.zeros_like(flux) | ||||||||||||||||||||
| # np.ma.cumsum(flux[:,::-1], axis=1, out=moc ) # sum floor to surface | ||||||||||||||||||||
| # return moc.max() | ||||||||||||||||||||
| atlmoc = np.array(np.zeros_like(vo.squeeze())) | ||||||||||||||||||||
| #print(atlmoc.shape, thkcello.shape, depths.shape, vo.shape, e1v_AMOC26N.shape, e3v_AMOC26N.shape) | ||||||||||||||||||||
| # (75, 264) (1, 75, 1, 264) (1, 75, 1, 264) (1, 75, 1, 264) (1, 1, 264) (75, 264) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #assert 0 | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+292
to
+301
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
| for (t, z, la, lo), vox in np.ndenumerate(vo): | ||||||||||||||||||||
| if not vox: | ||||||||||||||||||||
| continue | ||||||||||||||||||||
| if not depths[t, z, la, lo] or np.ma.is_masked(depths[t, z, la, lo]): | ||||||||||||||||||||
| continue | ||||||||||||||||||||
| # if not alttmask_AMOC26N[la, lo]: | ||||||||||||||||||||
| # continue | ||||||||||||||||||||
| # if not tmask_AMOC26N[z, la, lo]: | ||||||||||||||||||||
| # continue | ||||||||||||||||||||
| # if np.ma.is_masked(zv[0, z, la, lo]): | ||||||||||||||||||||
| # continue | ||||||||||||||||||||
ledm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||
| atlmoc[z, la] = atlmoc[z, la] - e1v[t, 0, la, lo] * thkcello[t, z, la, lo] * vo[t, z, la, lo] / 1.E06 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| for z in range(thkcello.shape[1] -2, 1, -1): # add from the bottom up | ||||||||||||||||||||
| atlmoc[z, :] = atlmoc[z+1, :] + atlmoc[z, :] | ||||||||||||||||||||
| print('AMOC:', atlmoc.max()) | ||||||||||||||||||||
| #assert 0 | ||||||||||||||||||||
ledm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||
| return atlmoc.max() | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| def AMOC26N(nc, keys, **kwargs): | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |
|
|
||
| """ | ||
| #Standard Python modules: | ||
| import os | ||
| from sys import argv, exit | ||
| from os.path import exists | ||
| from calendar import month_name | ||
|
|
@@ -162,6 +163,9 @@ def testsuite_p2p( | |
| # Match observations and model. | ||
| # Does not produce and plots. | ||
| #annual = True | ||
| if not os.path.exists(av[name].get('dataFiles', '')): | ||
| print('Data file missing:', name, av[name].get('dataFiles', '')) | ||
| assert 0 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. come on, get rid of all this old crappe - raise an exception or continue |
||
| b = matchDataAndModel(av[name]['dataFiles'], | ||
| av[name]['modelFiles'], | ||
| dataType=name, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.