Skip to content

Commit d689b03

Browse files
committed
So much MA work.
1 parent 7d5de97 commit d689b03

37 files changed

+279
-66
lines changed

bgcval2/bgcval.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
import sys
3939
from multiprocessing import Pool
4040

41-
from .download_from_mass import findLastFinishedYear
42-
from .analysis_timeseries import analysis_timeseries, singleTimeSeries, singleTimeSeriesProfile
41+
from bgcval2.download_from_mass import findLastFinishedYear
42+
from bgcval2.analysis_timeseries import analysis_timeseries, singleTimeSeries, singleTimeSeriesProfile
4343
# these modules are no more and break the tests
4444
# from .analysis_timeseries import level1KeysDict, physKeysDict, bgcKeysDict, keymetricsfirstDict
45-
from .analysis_p2p import analysis_p2p, p2pDict_level2, p2pDict_physics, single_p2p
46-
from .bgcval2_make_report import html5Maker
47-
from .bv2tools import folder
45+
from bgcval2.analysis_p2p import analysis_p2p, p2pDict_level2, p2pDict_physics, single_p2p
46+
from bgcval2.bgcval2_make_report import html5Maker
47+
from bgcval2.bv2tools import folder
4848

4949

5050
def timeseriesParrallelL1(index):

bgcval2/bgcval2_make_report.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ def newImageLocation(fn):
10041004
for s in slices:
10051005
if s in [
10061006
'Surface',
1007-
'1000m',
1007+
'*',
10081008
]:
10091009
vfiles.extend(
10101010
glob(imagedir + '/' + jobID + '/P2Pplots/*/*' + key +

bgcval2/functions/circulation.py

+29-6
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ def TwentySixNorth(nc,keys,**kwargs):
240240
# Atlantic Mask not loaded
241241
assert 0
242242

243-
244243
zv = np.ma.array(nc.variables[keys[0]][..., latslice26Nnm, :]) # m/s
245244
atlmoc = np.array(np.zeros_like(zv[0, :, :, 0]))
246245
print('TwentySixNorth:', e3v_AMOC26N.shape, atlmoc.shape, zv.shape)
@@ -286,11 +285,35 @@ def twentysixnorth025(nc,keys,**kwargs):
286285
depths = np.ma.masked_where(thkcello.mask + np.abs(depths)<500., depths) # masked above 500m depth.
287286

288287
e1v = e1v_AMOC26N[:,None, :, :]
289-
flux = vo * depths * e1v_AMOC26N[:,None, :, :]/1.E06
290-
291-
moc=np.ma.zeros_like(flux)
292-
np.ma.cumsum(flux[:,::-1], axis=1, out=moc ) # sum floor to surface
293-
return moc.max()
288+
# flux = vo * thkcello * e1v_AMOC26N[:,None, :, :]/1.E06
289+
# moc=np.ma.zeros_like(flux)
290+
# np.ma.cumsum(flux[:,::-1], axis=1, out=moc ) # sum floor to surface
291+
# return moc.max()
292+
atlmoc = np.array(np.zeros_like(vo.squeeze()))
293+
#print(atlmoc.shape, thkcello.shape, depths.shape, vo.shape, e1v_AMOC26N.shape, e3v_AMOC26N.shape)
294+
# (75, 264) (1, 75, 1, 264) (1, 75, 1, 264) (1, 75, 1, 264) (1, 1, 264) (75, 264)
295+
296+
#assert 0
297+
298+
for (t, z, la, lo), vox in np.ndenumerate(vo):
299+
if not vox:
300+
continue
301+
if not depths[t, z, la, lo] or np.ma.is_masked(depths[t, z, la, lo]):
302+
continue
303+
# if not alttmask_AMOC26N[la, lo]:
304+
# continue
305+
# if not tmask_AMOC26N[z, la, lo]:
306+
# continue
307+
# if np.ma.is_masked(zv[0, z, la, lo]):
308+
# continue
309+
atlmoc[z, la] = atlmoc[z, la] - e1v[t, 0, la, lo] * thkcello[t, z, la, lo] * vo[t, z, la, lo] / 1.E06
310+
311+
for z in range(thkcello.shape[1] -2, 1, -1): # add from the bottom up
312+
atlmoc[z, :] = atlmoc[z+1, :] + atlmoc[z, :]
313+
print('AMOC:', atlmoc.max())
314+
#assert 0
315+
return atlmoc.max()
316+
294317

295318

296319
def AMOC26N(nc, keys, **kwargs):

bgcval2/p2p/matchDataAndModel.py

+2
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def _convertDataTo1D_(self, ):
270270
'500m',
271271
'1000m',
272272
'2000m',
273+
'4000m',
273274
]:
274275
print(
275276
'matchDataAndModel:\tconvertDataTo1D:\tSlicing along depth direction.'
@@ -281,6 +282,7 @@ def _convertDataTo1D_(self, ):
281282
if self.depthLevel == '500m': z = 500.
282283
if self.depthLevel == '1000m': z = 1000.
283284
if self.depthLevel == '2000m': z = 2000.
285+
if self.depthLevel == '4000m': z = 4000.
284286

285287
if nc.variables[self.datacoords['z']].ndim == 1:
286288
k = bvt.getORCAdepth(

bgcval2/p2p/testsuite_p2p.py

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
2828
"""
2929
#Standard Python modules:
30+
import os
3031
from sys import argv, exit
3132
from os.path import exists
3233
from calendar import month_name
@@ -162,6 +163,9 @@ def testsuite_p2p(
162163
# Match observations and model.
163164
# Does not produce and plots.
164165
#annual = True
166+
if not os.path.exists(av[name].get('dataFiles', '')):
167+
print('Data file missing:', name, av[name].get('dataFiles', ''))
168+
assert 0
165169
b = matchDataAndModel(av[name]['dataFiles'],
166170
av[name]['modelFiles'],
167171
dataType=name,

input_yml/mission_atlantic.yml

+113-17
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,130 @@ jobs:
2626
linestyle: '-'
2727
shifttime: 0.
2828
suite: missionatlantic
29-
test17a:
30-
description: 'NEMO-ERSEM eORCA025 - with iron deposition x0.1'
31-
colour: red
29+
# test17a:
30+
# description: 'NEMO-ERSEM eORCA025 - with iron deposition x0.1'
31+
# colour: red
32+
# thickness: 1.7
33+
# linestyle: '-'
34+
# shifttime: 0.
35+
# suite: missionatlantic
36+
37+
# test17aa:
38+
# description: 'NEMO-ERSEM eORCA025 - with iron deposition x0.59 spinup year 1'
39+
# colour: blue
40+
# thickness: 1.7
41+
# linestyle: '-'
42+
# shifttime: 0.
43+
# suite: missionatlantic
44+
# test17b:
45+
# description: 'NEMO-ERSEM eORCA025 - with iron deposition x0.59 spinup year 2'
46+
# colour: blue
47+
# thickness: 1.7
48+
# linestyle: '-'
49+
# shifttime: 1.
50+
# suite: missionatlantic
51+
# test17c:
52+
# description: 'NEMO-ERSEM eORCA025 - with iron deposition x0.59 spinup year 3'
53+
# colour: blue
54+
# thickness: 1.7
55+
# linestyle: '-'
56+
# shifttime: 2.
57+
# suite: missionatlantic
58+
59+
# Broken with weird DIC/pH
60+
# test18a:
61+
# description: 'NEMO-ERSEM eORCA025 - new river input - spinup year 1'
62+
# colour: purple
63+
# thickness: 1.7
64+
# linestyle: '-'
65+
# shifttime: 0.
66+
# suite: missionatlantic
67+
# test18b:
68+
# description: 'NEMO-ERSEM eORCA025 - new river input - spinup year 2'
69+
# colour: purple
70+
# thickness: 1.7
71+
# linestyle: '-'
72+
# shifttime: 1.
73+
# suite: missionatlantic
74+
# test18c:
75+
# description: 'NEMO-ERSEM eORCA025 - new river input - spinup year 3'
76+
# colour: purple
77+
# thickness: 1.7
78+
# linestyle: '-'
79+
# shifttime: 2.
80+
# suite: missionatlantic
81+
82+
# test19_S1:
83+
# description: 'NEMO-ERSEM eORCA025 - same as 18 but better - spinup year 1'
84+
# colour: orange
85+
# thickness: 1.7
86+
# linestyle: '-'
87+
# shifttime: 0.
88+
# suite: missionatlantic
89+
# test19_S2:
90+
# description: 'NEMO-ERSEM eORCA025 - same as 18 but better - spinup year 2'
91+
# colour: orange
92+
# thickness: 1.7
93+
# linestyle: '-'
94+
# shifttime: 1.
95+
# suite: missionatlantic
96+
# test19_S3:
97+
# description: 'NEMO-ERSEM eORCA025 - same as 18 but better - spinup year 3'
98+
# colour: orange
99+
# thickness: 1.7
100+
# linestyle: '-'
101+
# shifttime: 2.
102+
# suite: missionatlantic
103+
104+
test19b_S1:
105+
description: 'NEMO-ERSEM eORCA025 - same as 19 but better - spinup year 1'
106+
colour: dodgerblue
32107
thickness: 1.7
33108
linestyle: '-'
34109
shifttime: 0.
35110
suite: missionatlantic
36-
test17aa:
37-
description: 'NEMO-ERSEM eORCA025 - with iron deposition x0.59 spinup year 1'
38-
colour: blue
111+
# test19b_S2:
112+
# description: 'NEMO-ERSEM eORCA025 - same as 19 but better - spinup year 2'
113+
# colour: dodgerblue
114+
# thickness: 1.7
115+
# linestyle: '-'
116+
# shifttime: 1.
117+
# suite: missionatlantic
118+
# test19b_S3:
119+
# description: 'NEMO-ERSEM eORCA025 - same as 19 but better - spinup year 3'
120+
# colour: dodgerblue
121+
# thickness: 1.7
122+
# linestyle: '-'
123+
# shifttime: 2.
124+
# suite: missionatlantic
125+
126+
test25:
127+
description: 'NEMO-ERSEM eORCA025 - stable(?!)'
128+
colour: purple
39129
thickness: 1.7
40130
linestyle: '-'
41-
shifttime: 0.
131+
shifttime: 02.
42132
suite: missionatlantic
43-
test17b:
44-
description: 'NEMO-ERSEM eORCA025 - with iron deposition x0.59 spinup year 2'
45-
colour: blue
133+
134+
# test25S1:
135+
# description: 'NEMO-ERSEM eORCA025 - stablE(?!) spinup s1'
136+
# colour: purple
137+
# thickness: 1.7
138+
# linestyle: '-'
139+
# shifttime: -3.
140+
# suite: missionatlantic
141+
test25S2:
142+
description: 'NEMO-ERSEM eORCA025 - stable(?!) spinup 2'
143+
colour: purple
46144
thickness: 1.7
47145
linestyle: '-'
48-
shifttime: 1.
146+
shifttime: -2.
49147
suite: missionatlantic
50-
test17c:
51-
description: 'NEMO-ERSEM eORCA025 - with iron deposition x0.59 spinup year 3'
52-
colour: blue
148+
test25S3:
149+
description: 'NEMO-ERSEM eORCA025 - stable(?!) spinup3'
150+
colour: purple
53151
thickness: 1.7
54152
linestyle: '-'
55-
shifttime: 2.
153+
shifttime: -1.
56154
suite: missionatlantic
57155

58-
59-

key_files/ma_aeu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: AEU #AtlanticEquatorialUndercurent
33
units: Sv
44
dimensions: 1
55
model: NEMO
6-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*grid_U*.nc
6+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*grid_U*.nc
77
modelgrid : eORCA025
88
model_vars: uo
99
model_convert:

key_files/ma_ammonium.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units : mmol N/m^3
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*ptrc_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*ptrc_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : N4_n
1010
model_convert : NoChange

key_files/ma_amoc_26n.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: AMOC_26N
44
units: Sv
55
dimensions: 1
66
model: NEMO
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*grid_V*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*grid_V*.nc
88
modelgrid : eORCA025
99
model_vars: vo
1010
model_convert:

key_files/ma_dic.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units : mmol C/m^3
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*ptrc_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*ptrc_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : O3_c
1010
model_convert : NoChange

key_files/ma_drake.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: DrakePassageTransport
33
units: Sv
44
dimensions: 1
55
model: NEMO
6-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*grid_U*.nc
6+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*grid_U*.nc
77
modelgrid : eORCA025
88
model_vars: uo
99
model_convert:

key_files/ma_gpp.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units : ""
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*diag_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*diag_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : Ptot_GPP_result
1010
model_convert : NoChange

key_files/ma_iron.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units : umol Fe/m^3
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*ptrc_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*ptrc_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : N7_f
1010
model_convert : NoChange

key_files/ma_mld.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ units : m
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*grid_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*grid_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
9-
model_vars : somxzint1
9+
model_convert : choose_best_var
10+
model_vars : somxzint1 mldr10_1
1011
layers : layerless
1112
regions : Global NorthAtlanticOcean SouthAtlanticOcean EquatorialAtlanticOcean ITCZ
1213
metrics : mean, max #, median, 10pc, 20pc, 30pc, 40pc, 50pc, 60pc, 70pc, 80pc, 90pc, min, max

key_files/ma_mld_sigma.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units : m
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*grid_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*grid_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : mldr10_1
1010
layers : layerless

key_files/ma_nitrate.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units : mmol N/m^3
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*ptrc_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*ptrc_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : N3_n
1010
model_convert : NoChange

key_files/ma_northerntotaliceextent.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name : NorthernTotalIceExtent
33
units : 1E6 km^2
44
dimensions : 1
55
model : CICE
6-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*grid_T*.nc
6+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*grid_T*.nc
77
model_vars : soicecov
88
model_convert:
99
path: bgcval2/functions/ice.py

key_files/ma_npp.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units : ""
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*diag_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*diag_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : Ptot_NPP_result
1010
model_convert : NoChange

key_files/ma_o2.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ units : mmol O_2/m^3
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*ptrc_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*ptrc_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : O2_o
1010
model_convert : NoChange
11-
dataFile : $BASEDIR_OBS/WOA/annual/woa13_all_O00_01.nc
12-
data_vars : O_an
11+
#dataFile : $BASEDIR_OBS/WOA/annual/woa13_all_O00_01.nc
12+
dataFile : $BASEDIR_OBS/WOA/annual/woa18_all_o00_01.nc
13+
data_vars : o_an
1314
data_convert : NoChange
14-
data_source : WOA13
15+
data_source : WOA18
1516
layers : 500m #Surface #50m 100m
1617
regions : Global NorthAtlanticOcean SouthAtlanticOcean EquatorialAtlanticOcean
1718
metrics : mean #, median, 10pc, 20pc, 30pc, 40pc, 50pc, 60pc, 70pc, 80pc, 90pc, min, max

key_files/ma_p1c.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units : mg C/m^3
44
dimensions : 1
55
model : NEMO025-ERSEM
66
modelgrid : eORCA025
7-
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO_*_1m_*ptrc_T*.nc
7+
modelFiles : $BASEDIR_MODEL/$JOBID/SENEMO*_1m_*ptrc_T*.nc
88
gridFile : /data/proteus2/scratch/ledm/MissionAtlantic/SENEMO/eORCA025_mesh_mask_mes_v2.nc
99
model_vars : P1_c
1010
model_convert : NoChange

0 commit comments

Comments
 (0)