Skip to content

Commit 1358f48

Browse files
committed
changes before migration to new disk
1 parent c148f45 commit 1358f48

File tree

9 files changed

+47
-21
lines changed

9 files changed

+47
-21
lines changed

bgcval2/bgcvaltools/pftnames.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ def makeLongNameDict():
287287
lnd['SubtropicNorthAtlantic'] = 'Subtropic North Atlantic'
288288
lnd['GINSalinity'] = 'GIN Salinity 0-800m'
289289

290+
lnd['volSalinity'] = 'Salinity 0-1200m'
291+
lnd['volTemperature'] = 'Temperature 0-1200m'
292+
293+
290294
lnd['Surfaceto100m'] = 'Surface-to-100m'
291295
lnd['Surfaceto200m'] = 'Surface-to-200m'
292296
lnd['Surfaceto300m'] = 'Surface-to-300m'
@@ -295,6 +299,8 @@ def makeLongNameDict():
295299
lnd['Surfaceto600m'] = 'Surface-to-600m'
296300
lnd['Surfaceto700m'] = 'Surface-to-700m'
297301
lnd['Surfaceto800m'] = 'Surface-to-800m'
302+
lnd['Surfaceto1200m'] = 'Surface-to-1200m'
303+
298304
lnd['Surfaceto2000m'] = 'Surface-to-2000m'
299305

300306
lnd['TotalHeatFlux'] = "Global Total Heat Flux"
@@ -354,8 +360,8 @@ def makeLongNameDict():
354360
lnd['DPT'] = 'Drake Passage Transport'
355361

356362
lnd['DavisStraightSaltFlux'] = 'Davis Straight Salt Flux'
357-
lnd['DavisStraightMassFlux'] = 'Davis Straight Salt Flux'
358-
lnd['DavisStraightHeatFlux'] = 'Davis Straight Salt Flux'
363+
lnd['DavisStraightMassFlux'] = 'Davis Straight Mass Flux'
364+
lnd['DavisStraightHeatFlux'] = 'Davis Straight Heat Flux'
359365
lnd['NorwegianSeaSaltFlux'] = 'Norwegian Sea Salt Flux'
360366
lnd['NorwegianSeaMassFlux'] = 'Norwegian Sea Mass Flux'
361367
lnd['NorwegianSeaHeatFlux'] = 'Norwegian Sea Heat Flux'

bgcval2/functions/circulation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@
4949
eORCA1_davis_LAT0=232
5050
eORCA1_davis_LAT1=244
5151

52-
eORCA1_norway_LON = 300
53-
eORCA1_norway_LAT0 = 260
54-
eORCA1_norway_LAT1 = 300
52+
# From Greenland to Norway via Iceland
53+
eORCA1_norway_LON = 281
54+
eORCA1_norway_LAT0 = 245
55+
eORCA1_norway_LAT1 = 294
5556

5657

5758

bgcval2/functions/standard_functions.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ def extractData(nc, details, key=['',], debug=False):
7171
return np.ma.array(xd)
7272

7373

74+
7475
####
7576
# Some functions for maniulating data:
7677
def NoChange(nc,keys):
7778
"""
7879
Loads keys[0] from the netcdf, but applies no change.
7980
"""
80-
return nc.variables[keys[0]][:]
81+
arr = nc.variables[keys[0]][:]
82+
arr = np.ma.masked_where(arr == 0. + arr.mask, arr)
83+
return arr
8184

8285

8386
def N2Biomass(nc,keys):
@@ -126,7 +129,9 @@ def applymask(nc,keys):
126129
"""
127130
Loads keys[0] from the netcdf, but applies a mask.
128131
"""
129-
return np.ma.masked_where(nc.variables[keys[1]][:] == 0., nc.variables[keys[0]][:])
132+
arr = np.ma.array(nc.variables[keys[0]][:])
133+
arr = np.ma.masked_invalid(arr)
134+
return np.ma.masked_where(arr.mask + (nc.variables[keys[1]][:] == 0.), arr)
130135

131136

132137
def maskzeroes(nc, keys):
@@ -147,6 +152,7 @@ def sums(nc,keys):
147152
a = nc.variables[keys[0]][:]
148153
for k in keys[1:]:
149154
a += nc.variables[k]
155+
a = np.ma.masked_where(a == 0. + a.mask, a)
150156
return a
151157

152158

@@ -172,9 +178,12 @@ def choose_best_var(nc, keys):
172178
for key in keys:
173179
if key not in nc.variables.keys():
174180
continue
175-
return nc.variables[key][:]
181+
arr = nc.variables[key][:]
182+
arr = np.ma.masked_where(arr == 0. + arr.mask, arr)
183+
return arr
176184
raise KeyError(f'choose_best_var: unable to find any variable in {keys} in {nc.filename}')
177185

186+
178187
def find_best_var(nc, keys):
179188
"""
180189
Takes the list of keys and returns the first one that exists in the input file.
@@ -194,7 +203,9 @@ def multiplyBy(nc,keys, **kwargs):
194203
"""
195204
if 'factor' not in kwargs:
196205
raise KeyError(f"std_functions: multiplyBy: Did not get key word argument, 'factor' in kwargs: {kwargs}")
197-
return nc.variables[keys[0]][:] * float(kwargs['factor'])
206+
arr = nc.variables[keys[0]][:] * float(kwargs['factor'])
207+
arr = np.ma.masked_where(arr == 0. + arr.mask, arr)
208+
return arr
198209

199210

200211
def addValue(nc,keys, **kwargs):

bgcval2/timeseries/timeseriesTools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,15 @@ def getHorizontalSlice(nc, coords, details, layer, data=''):
205205

206206
elif layer in [
207207
'Surfaceto100m', 'Surfaceto300m', 'Surfaceto700m',
208-
'Surfaceto500m', 'Surfaceto800m',
208+
'Surfaceto500m', 'Surfaceto800m','Surfaceto1200m',
209209
'Surfaceto2000m'
210210
]:
211211
if layer == 'Surfaceto100m': z = 100.
212212
if layer == 'Surfaceto300m': z = 300.
213213
if layer == 'Surfaceto500m': z = 500.
214214
if layer == 'Surfaceto700m': z = 700.
215215
if layer == 'Surfaceto800m': z = 800.
216+
if layer == 'Surfaceto1200m': z = 1200.
216217
if layer == 'Surfaceto2000m': z = 2000.
217218

218219
k_surf = bvt.getORCAdepth(0.,

key_files/davisstraightsaltflux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units: PSU m/s
44
dimensions: 1
55
model: NEMO
66
modelFiles: $BASEDIR_MODEL/$JOBID/nemo_$JOBIDo_1y_*_grid-V.nc
7-
model_vars: vso thkcello
7+
model_vars: somesatr thkcello
88
model_convert:
99
path: bgcval2/functions/circulation.py
1010
function: davisstraightflux

key_files/norwegianseasaltflux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ units: PSU m/s
44
dimensions: 1
55
model: NEMO
66
modelFiles: $BASEDIR_MODEL/$JOBID/nemo_$JOBIDo_1y_*_grid-V.nc
7-
model_vars: vso thkcello
7+
model_vars: somesatr thkcello
88
model_convert:
99
path: bgcval2/functions/circulation.py
1010
function: norwegianpassage

key_files/sowindsp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ modelFile_p2p : $BASEDIR_MODEL/$JOBID/nemo*$JOBIDo_1y_*$YEAR????_grid-T.nc
1010
gridFile : $PATHS_GRIDFILE
1111

1212
# Model coordinates/dimension names
13-
model_vars : sowindsp
14-
model_convert : choose_best_var
13+
model_vars : sowindsp sos
14+
model_convert : applymask # applies a mask where sos is zero.
1515

1616
layers : layerless
1717
regions : Global ignoreInlandSeas SouthernOcean ArcticOcean Equator10 NorthPacificOcean SouthPacificOcean NorthAtlanticOcean SouthAtlanticOcean SPNA LIGINseas STNA LIseas LabradorSea NorthEastAtlantic IrmingerSea GINseas BritishIsles

key_lists/debug.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ keys:
99
# DrakePassageTransport: True
1010
# hfbasinatlantic: True
1111
# AMOC_26N: True
12-
DavisStraightSaltFlux: True
13-
NorwegianSeaSaltFlux: True
14-
DavisStraightHeatFlux: True
15-
NorwegianSeaHeatFlux: True
16-
DavisStraightMassFlux: True
17-
NorwegianSeaMassFlux: True
12+
# ficeberg: True
13+
# volTemperature: True
14+
# volSalinity: True
15+
# DavisStraightSaltFlux: True
16+
# NorwegianSeaSaltFlux: True
17+
# DavisStraightHeatFlux: True
18+
# NorwegianSeaHeatFlux: True
19+
# DavisStraightMassFlux: True
20+
# NorwegianSeaMassFlux: True
1821

1922
# pbsi3: True
2023
# agessc: True
@@ -44,7 +47,7 @@ keys:
4447
# SouthernTotalIceArea: True
4548

4649
#ZOS: True
47-
#sowindsp: True
50+
sowindsp: True
4851
#sowflisf: True
4952
#evs: True
5053
#precip: True

key_lists/tfamoc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ keys:
2424
SouthernTotalIceExtent: True
2525
GlobalMeanSalinity: True
2626
fsitherm: True
27+
ficeberg: True
2728
sowaflup: True
2829
hfds: True
2930
hfy: True
@@ -44,3 +45,6 @@ keys:
4445
DavisStraightMassFlux: True
4546
NorwegianSeaMassFlux: True
4647

48+
volTemperature: True
49+
volSalinity: True
50+

0 commit comments

Comments
 (0)