Skip to content

Commit

Permalink
add ma files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledm committed Oct 13, 2023
1 parent 31a7bb0 commit ea9d2fc
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 20 deletions.
11 changes: 10 additions & 1 deletion bgcval2/p2p/matchDataAndModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
# local imports
import bgcval2.bgcvaltools.bv2tools as bvt
from bgcval2.bgcvaltools.pftnames import CMIP5models

#####
# These are availalble in the module:
# https://gitlab.ecosystem-modelling.pml.ac.uk/ledm/netcdf_manip
Expand Down Expand Up @@ -925,6 +926,7 @@ def loadMesh(self, modelfile=None):
if self.loncc.ndim == 1 and self.loncc.shape != self.latcc.shape:
self.loncc, self.latcc = np.meshgrid(self.loncc, self.latcc)


# self.depthcc = choose_best_ncvar(ncER, depthNames)[:]
# if 'deptht' in list(ncER.variables.keys()):
# self.depthcc = ncER.variables['deptht'][:].squeeze()
Expand All @@ -934,7 +936,14 @@ def loadMesh(self, modelfile=None):
# self.depthcc = ncER.variables['lev'][:].squeeze()
# else:
# print(self.modelcoords['z'], ncER.variables.keys())
self.depthcc = ncER.variables[self.modelcoords['z']][:]
if self.modelcoords['z'] in ncER.variables.keys():
self.depthcc = ncER.variables[self.modelcoords['z']][:]
else:
print('load mesh:', self.modelcoords['z'], 'is missing', ncER.variables.keys())
if not set(ncER.variables.keys()).intersection(set(depthNames)):
print('load mesh: no depth field available in ', modelfile)
self.depthcc = np.array([0])
# assert 0

# self.depthcc = choose_best_ncvar(ncER, depthNames)[:]
self.datescc = var_to_datetime(ncER.variables[self.modelcoords['t']])
Expand Down
16 changes: 5 additions & 11 deletions bgcval2/timeseries/timeseriesTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,16 @@ def getHorizontalSlice(nc, coords, details, layer, data=''):
'200m',
'300m',
'500m',
'750m',
'1000m',
'2000m',
'3000m',
'4000m',
]:
if layer == 'Surface': z = 0.
if layer == '50m': z = 50.
if layer == '100m': z = 100.
if layer == '200m': z = 200.
if layer == '300m': z = 300.
if layer == '500m': z = 500.
if layer == '1000m': z = 1000.
if layer == '2000m': z = 2000.
if layer == '3000m': z = 3000.
if layer == '4000m': z = 4000.
print(z)
if layer == 'Surface':
z = 0.
else:
z = float(layer.replace('m', ''))
k = bvt.getORCAdepth(z, nc.variables[coords['z']][:], debug=False)
if isinstance(data, str):
data = std_extractData(nc, details)
Expand Down
2 changes: 1 addition & 1 deletion key_files/ma_mld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ model_vars : somxzint1 mldr10_1
dataFile : $BASEDIR_OBS/WOA/annual/woa18_A5B7_M0200_01.nc
data_vars : M_an
data_convert : NoChange
data_source : WOA13
data_source : WOA18
layers : layerless
regions : Global NorthAtlanticOcean SouthAtlanticOcean EquatorialAtlanticOcean ITCZ
metrics : mean, max #, median, 10pc, 20pc, 30pc, 40pc, 50pc, 60pc, 70pc, 80pc, 90pc, min, max
2 changes: 1 addition & 1 deletion key_files/ma_nitrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ model_convert : NoChange
dataFile : $BASEDIR_OBS/WOA/annual/woa18_all_n00_01.nc
data_vars : n_an
data_convert : NoChange
data_source : WOA13
data_source : WOA18
layers : Surface 500m
regions : Global NorthAtlanticOcean SouthAtlanticOcean EquatorialAtlanticOcean
metrics : mean #, median, 10pc, 20pc, 30pc, 40pc, 50pc, 60pc, 70pc, 80pc, 90pc, min, max
2 changes: 1 addition & 1 deletion key_files/ma_phosphate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ model_convert : NoChange
dataFile : $BASEDIR_OBS/WOA/annual/woa18_all_p00_01.nc
data_vars : p_an
data_convert : NoChange
data_source : WOA13
data_source : WOA18
layers : Surface 500m
regions : Global NorthAtlanticOcean SouthAtlanticOcean EquatorialAtlanticOcean
metrics : mean #, median, 10pc, 20pc, 30pc, 40pc, 50pc, 60pc, 70pc, 80pc, 90pc, min, max
2 changes: 1 addition & 1 deletion key_files/ma_silicate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ model_convert : NoChange
dataFile : $BASEDIR_OBS/WOA/annual/woa18_all_i00_01.nc
data_vars : i_an
data_convert : NoChange
data_source : WOA13
data_source : WOA18
layers : Surface 100m 200m 500m 1000m 2000m 4000m
regions : Global NorthAtlanticOcean SouthAtlanticOcean EquatorialAtlanticOcean
metrics : mean #, median, 10pc, 20pc, 30pc, 40pc, 50pc, 60pc, 70pc, 80pc, 90pc, min, max
2 changes: 1 addition & 1 deletion key_files/ma_sss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ model_vars : so_abs so
dataFile : /data/sthenno1/scratch/ledm/Observations/WOA/annual/woa18_decav_s00_01.nc
data_vars : s_an
data_convert : NoChange
data_source : WOA13
data_source : WOA18
layers : Surface 50m 100m 200m 500m 1000m 2000m 4000m
regions : Global NorthAtlanticOcean SouthAtlanticOcean EquatorialAtlanticOcean ITCZ
metrics : mean #, median, 10pc, 20pc, 30pc, 40pc, 50pc, 60pc, 70pc, 80pc, 90pc, min, max
2 changes: 1 addition & 1 deletion key_files/ma_sst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ model_convert : choose_best_var
dataFile : /data/sthenno1/scratch/ledm/Observations/WOA/annual/woa18_decav_t00_01.nc
data_vars : t_an
data_convert : NoChange
data_source : WOA13
data_source : WOA18
layers : Surface #50m 100m
regions : Global NorthAtlanticOcean SouthAtlanticOcean EquatorialAtlanticOcean ITCZ
metrics : mean #, median, 10pc, 20pc, 30pc, 40pc, 50pc, 60pc, 70pc, 80pc, 90pc, min, max
6 changes: 4 additions & 2 deletions key_lists/ma_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
# of how a model is working.
keys:
# BGC
MA_TotalIntGPP: True
MA_TotalIntNPP: True
MA_SST: True

# MA_TotalIntGPP: True
# MA_TotalIntNPP: True

0 comments on commit ea9d2fc

Please sign in to comment.