@@ -325,7 +325,7 @@ def drakePassage(nc, keys, **kwargs):
325325 assert 0
326326 print ('drakePassage:' , grid , 'LON' , LON , 'LAT0' ,LAT0 , 'LAT1' , LAT1 )
327327
328- all_e3u_keys = ['thkcello' , 'e3u' ]
328+ all_e3u_keys = ['thkcello' , 'thkcelluo' , ' e3u' ]
329329 e3u_keys = find_keys_in_nc (nc , all_e3u_keys )
330330 e3u = nc .variables [e3u_keys [0 ]][0 , :, LAT0 :LAT1 , LON ]
331331
@@ -371,7 +371,15 @@ def davisstraightflux(nc, keys, straight='Davis', **kwargs):
371371 print ('These needs to be multiplied by the thkcello.' )
372372 assert 0
373373
374- thkcello = nc .variables ['thkcello' ][0 , :, LAT0 :LAT1 , LON ]
374+
375+ if 'thkcello' in nc .variables .keys ():
376+ thkcello = nc .variables ['thkcello' ][0 , :, LAT0 :LAT1 , LON ]
377+ elif 'thkcelluo' in nc .variables .keys ():
378+ thkcello = nc .variables ['thkcelluo' ][0 , :, LAT0 :LAT1 , LON ]
379+ elif 'thkcellvo' in nc .variables .keys ():
380+ thkcello = nc .variables ['thkcellvo' ][0 , :, LAT0 :LAT1 , LON ]
381+ else : assert 0
382+ #thkcello = nc.variables['thkcello'][0, :, LAT0:LAT1, LON]
375383
376384 print ('Davis straight:' , grid , 'LON' , LON , 'LAT0' ,LAT0 , 'LAT1' , LAT1 )
377385
@@ -503,11 +511,19 @@ def TwentySixNorth(nc, keys, lat='26N', return_max_depth=False, **kwargs):
503511
504512 atlmoc = np .array (np .zeros_like (zv [0 , :, :, 0 ]))
505513
514+ # if 'thkcello' in nc.variables.keys():
515+ # thkcello = nc.variables['thkcello'][0, :, latslice, :]
516+
506517 if 'thkcello' in nc .variables .keys ():
507518 thkcello = nc .variables ['thkcello' ][0 , :, latslice , :]
508- thkcello = np .ma .masked_where (thkcello .mask + zv [0 ].mask , thkcello )
519+ elif 'thkcelluo' in nc .variables .keys ():
520+ thkcello = nc .variables ['thkcelluo' ][0 , :, latslice , :]
521+ elif 'thkcellvo' in nc .variables .keys ():
522+ thkcello = nc .variables ['thkcellvo' ][0 , :, latslice , :]
509523 else :
510524 thkcello = e3v_AMOC [:]
525+ thkcello = np .ma .array (thkcello )
526+ thkcello = np .ma .masked_where (thkcello .mask + zv [0 ].mask , thkcello )
511527
512528 depths = np .ma .abs (np .cumsum (thkcello , axis = 0 ))
513529
@@ -635,9 +651,16 @@ def gulfstream_depth(nc, keys, **kwargs):
635651 print (lats , lons )
636652
637653 vo = nc .variables [keys [0 ]][0 , :, latslice26Nnm , lonslice_70W ].squeeze () # m/s
638- thickness = nc .variables ['thkcello' ][0 ,:,latslice26Nnm , lonslice_70W ].squeeze ()
654+ # thickness = nc.variables['thkcello'][0,:,latslice26Nnm, lonslice_70W].squeeze()
639655 depth = np .abs (np .cumsum (thickness , axis = 0 ))# depth array
640656
657+ if 'thkcello' in nc .variables .keys ():
658+ thickness = nc .variables ['thkcello' ][0 ,:,latslice26Nnm , lonslice_70W ].squeeze ()
659+ elif 'thkcelluo' in nc .variables .keys ():
660+ thickness = nc .variables ['thkcelluo' ][0 ,:,latslice26Nnm , lonslice_70W ].squeeze ()
661+ elif 'thkcellvo' in nc .variables .keys ():
662+ thickness = nc .variables ['thkcellvo' ][0 ,:,latslice26Nnm , lonslice_70W ].squeeze ()
663+
641664 vo = np .ma .masked_where (vo .mask + (vo == 0. ), vo )
642665
643666
@@ -726,8 +749,14 @@ def gulfstream(nc, keys, **kwargs):
726749 lons = nc .variables ['nav_lon' ][latslice26Nnm , lonslice_70W ]
727750 vo = np .ma .array (nc .variables [keys [0 ]][0 , :, latslice26Nnm , lonslice_70W ]) # m/s
728751 vo = np .ma .masked_where (vo .mask + (vo <= 0. ), vo )
752+
753+ if 'thkcello' in nc .variables .keys ():
754+ thickness = nc .variables ['thkcello' ][0 ,:,latslice26Nnm , lonslice_70W ]
755+ elif 'thkcelluo' in nc .variables .keys ():
756+ thickness = nc .variables ['thkcelluo' ][0 ,:,latslice26Nnm , lonslice_70W ]
757+ elif 'thkcellvo' in nc .variables .keys ():
758+ thickness = nc .variables ['thkcellvo' ][0 ,:,latslice26Nnm , lonslice_70W ]
729759
730- thickness = nc .variables ['thkcello' ][0 ,:,latslice26Nnm , lonslice_70W ]
731760 depth = np .abs (np .cumsum (thickness , axis = 0 ))# depth array
732761 #print(vo.shape, thickness.shape, e1v_AMOC26N.shape)
733762 gs = 0.
@@ -767,7 +796,16 @@ def twentysixnorth025(nc, keys, **kwargs):
767796 latslice26N = eORCA025_latslice26Nnm
768797 lonslice26N = eORCA025_lonslice26Nnm
769798 vo = np .ma .array (nc .variables [keys [0 ]][..., latslice26N , lonslice26N ]) # #vo in m/s
770- thkcello = np .ma .array (nc .variables ['thkcello' ][..., latslice26N , lonslice26N ]) # #thickness
799+ # thkcello = np.ma.array(nc.variables['thkcello'][..., latslice26N, lonslice26N]) # #thickness
800+
801+ if 'thkcello' in nc .variables .keys ():
802+ thkcello = nc .variables ['thkcello' ][..., latslice26N , lonslice26N ] # #thickness
803+ elif 'thkcelluo' in nc .variables .keys ():
804+ thkcello = nc .variables ['thkcelluo' ][..., latslice26N , lonslice26N ] # #thickness
805+ elif 'thkcellvo' in nc .variables .keys ():
806+ thkcello = nc .variables ['thkcellvo' ][..., latslice26N , lonslice26N ] # #thickness
807+ thkcello = np .ma .array (thkcello )
808+
771809 depths = np .ma .cumsum (thkcello , axis = 1 )
772810
773811 depths = np .ma .masked_where (thkcello .mask + np .abs (depths )< 500. , depths ) # masked above 500m depth.
0 commit comments