4444eORCA1_drake_LAT0 = 79
4545eORCA1_drake_LAT1 = 109
4646
47+
48+ eORCA1_davis_LON = 289
49+ eORCA1_davis_LAT0 = 232
50+ eORCA1_davis_LAT1 = 244
51+
52+ # From Greenland to Norway via Iceland
53+ eORCA1_norway_LON = 281
54+ eORCA1_norway_LAT0 = 245
55+ eORCA1_norway_LAT1 = 294
56+
57+
58+
4759eORCA025_drake_LON = 875
4860eORCA025_drake_LAT0 = 317
4961eORCA025_drake_LAT1 = 436
8698e1v_AMOC26N = 0
8799e1v_AMOC40N = 0
88100e1v_AMOC55N = 0
101+ e1v_davis = 0
102+ e1v_norway = 0
103+
89104tmask_AMOC26N = 0
90105tmask_AMOC40N = 0
91106tmask_AMOC55N = 0
@@ -136,6 +151,8 @@ def loadDataMask(gridfn, maskname, grid):
136151 global e3v_AMOC26N
137152 global e3v_AMOC40N
138153 global e3v_AMOC55N
154+ global e1v_davis
155+ global e1v_norway
139156 global e1v_AMOC26N
140157 global e1v_AMOC40N
141158 global e1v_AMOC55N
@@ -183,6 +200,11 @@ def loadDataMask(gridfn, maskname, grid):
183200 e1v_AMOC55N = nc .variables ['e1v' ][..., latslice55Nnm , lonslice55N ] #
184201 tmask_AMOC55N = nc .variables ['tmask' ][..., latslice55Nnm , lonslice55N ]
185202
203+ e1v_davis = nc .variables ['e1v' ][eORCA1_davis_LON , eORCA1_davis_LAT0 :eORCA1_davis_LAT1 ]
204+ e1v_norway = nc .variables ['e1v' ][eORCA1_norway_LON , eORCA1_norway_LAT0 :eORCA1_norway_LAT1 ]
205+
206+
207+
186208 else :
187209 e3v_AMOC26N = nc .variables ['e3v' ][..., latslice26Nnm , :] # z level height 3D
188210 e1v_AMOC26N = nc .variables ['e1v' ][..., latslice26Nnm , :] #
@@ -196,6 +218,9 @@ def loadDataMask(gridfn, maskname, grid):
196218 e1v_AMOC55N = nc .variables ['e1v' ][..., latslice55N , :] #
197219 tmask_AMOC55N = nc .variables ['tmask' ][..., latslice55N , :]
198220
221+ e1v_davis = nc .variables ['e1v' ][eORCA1_davis_LON , eORCA1_davis_LAT0 :eORCA1_davis_LAT1 ]
222+ e1v_norway = nc .variables ['e1v' ][eORCA1_norway_LON , eORCA1_norway_LAT0 :eORCA1_norway_LAT1 ]
223+
199224 #print('e3v_AMOC26N: loaded')#e3v_AMOC26N, latslice26Nnm, e3v_AMOC26N.shape)
200225 nc .close ()
201226 loadedArea = True
@@ -313,6 +338,110 @@ def drakePassage(nc, keys, **kwargs):
313338 return drake
314339
315340
341+ def davisstraightflux (nc , keys , straight = 'Davis' , ** kwargs ):
342+ """
343+ This function calculates the salt flux through the davis straight in eORCA1.
344+
345+ nc: a netcdf openned as a dataset.
346+ keys: a list of keys to use in this function.
347+
348+ """
349+ areafile = get_kwarg_file (kwargs , 'areafile' )
350+ maskname = kwargs .get ('maskname' , 'tmask' )
351+ grid = kwargs .get ('grid' , 'eORCA1' )
352+
353+ if not loadedArea :
354+ loadDataMask (areafile , maskname , grid )
355+
356+ if grid == 'eORCA1' and straight == 'Davis' :
357+ LON = eORCA1_davis_LON
358+ LAT0 = eORCA1_davis_LAT0
359+ LAT1 = eORCA1_davis_LAT1
360+ e1v = e1v_davis
361+ elif grid == 'eORCA1' and straight == 'Norway' :
362+ LON = eORCA1_norway_LON
363+ LAT0 = eORCA1_norway_LAT0
364+ LAT1 = eORCA1_norway_LAT1
365+ e1v = e1v_norway
366+
367+ else :
368+ assert 0
369+
370+ if keys [0 ] in ['vo' , 'uo' ]:
371+ print ('These needs to be multiplied by the thkcello.' )
372+ assert 0
373+
374+ thkcello = nc .variables ['thkcello' ][0 , :, LAT0 :LAT1 , LON ]
375+
376+ print ('Davis straight:' , grid , 'LON' , LON , 'LAT0' ,LAT0 , 'LAT1' , LAT1 )
377+
378+ ndim = nc .variables [keys [0 ]].ndim
379+ if ndim == 4 : # vso, vmo
380+ flux = nc .variables [keys [0 ]][0 , :, LAT0 :LAT1 , LON ]
381+ e1v_4d = np .broadcast_to (e1v [np .newaxis , :], thkcello .shape [:])
382+
383+ if ndim == 3 : #hfy
384+ flux = nc .variables [keys [0 ]][0 , LAT0 :LAT1 , LON ]
385+ e1v_4d = e1v
386+ thkcello = thkcello .sum (0 )
387+
388+ flux = np .ma .masked_where (flux == 0. , flux )
389+ if keys [0 ] in ['vo' , 'uo' ]:
390+ flux = np .ma .sum (flux * e1v_4d * thkcello )
391+ else :
392+ # sum already calculated.
393+ flux = np .ma .sum (flux )
394+
395+ return flux
396+
397+
398+ def norwegianpassage (nc , keys , ** kwargs ):
399+ """
400+ This function calculates the salt flux through the Norwegian Sea in eORCA1.
401+
402+ nc: a netcdf openned as a dataset.
403+ keys: a list of keys to use in this function.
404+
405+ """
406+ return davisstraightflux (nc , keys , straight = 'Norway' , ** kwargs )
407+
408+ # areafile = get_kwarg_file(kwargs, 'areafile')
409+ # maskname = kwargs.get('maskname', 'tmask')
410+ # grid = kwargs.get('grid', 'eORCA1')
411+
412+ # if not loadedArea:
413+ # loadDataMask(areafile, maskname, grid)
414+
415+ # if grid == 'eORCA1':
416+ # LON = eORCA1_norway_LON
417+ # LAT0 = eORCA1_norway_LAT0
418+ # LAT1 = eORCA1_norway_LAT1
419+ # else:
420+ # assert 0
421+
422+ # if keys[0] in ['vo', 'uo']:
423+ # print('These needs to be multiplied by the thkcello.')
424+ # assert 0
425+ # print('Norwegian flux:', grid, 'LON', LON, 'LAT0',LAT0, 'LAT1', LAT1)
426+
427+
428+ # ndim = nc.variables[keys[0]].ndim
429+
430+
431+ # if ndim == 4: # vso, vmo
432+ # flux = nc.variables[keys[0]][0, :, LAT0:LAT1, LON]
433+
434+ # if ndim == 3: #hfy
435+ # flux = nc.variables[keys[0]][0, LAT0:LAT1, LON]
436+
437+ # flux = np.ma.masked_where(flux==0., flux)
438+
439+ # print('Norway:', flux.shape, thkcello.shape, e1v_4d.shape)
440+ # Norway = np.ma.sum(flux)
441+
442+ # return Norway
443+
444+
316445def TwentySixNorth (nc , keys , lat = '26N' , return_max_depth = False , ** kwargs ):
317446 """
318447 This function loads the AMOC/ADRC array that is used for eORCA
0 commit comments