File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,19 +250,10 @@ def _compute_env(self, depth: DataArray) -> DataArray:
250250 # the borders with xarray and obtain exactly the same results
251251 # of the original NEMO-like code, happy to use it.
252252 # ------------------------------------------------------------
253- cst_lsm = lsm * 0.0
254- ngb_pnt = [- 1 , 0 , 1 ]
255- for j , i in product (ngb_pnt , repeat = 2 ):
256- if not (j == 0 and i == 0 ):
257- lsm_sft = lsm .shift ({lsm .dims [1 ]: i , lsm .dims [0 ]: j })
258- cst_lsm += lsm_sft
259-
260- cst_lsm = cst_lsm .where (lsm == 0 , 0 )
261- cst_lsm = cst_lsm .where (cst_lsm == 0 , 1 )
253+ cst_lsm = lsm .rolling ({dim : 3 for dim in lsm .dims }, min_periods = 2 ).sum ()
254+ cst_lsm = cst_lsm .shift ({dim : - 1 for dim in lsm .dims })
255+ cst_lsm = (cst_lsm > 0 ) & (lsm == 0 )
262256 zenv = depth .where (cst_lsm == 0 , self ._min_dep )
263- for dim in lsm .dims :
264- for indx in [0 , - 1 ]:
265- zenv [{dim : indx }] = depth [{dim : indx }]
266257 # ------------------------------------------------------------
267258
268259 zenv = _smooth_MB06 (zenv , self ._rmax )
You can’t perform that action at this time.
0 commit comments