Skip to content

Commit ef02eec

Browse files
committed
cleaning
1 parent 3119aad commit ef02eec

1 file changed

Lines changed: 0 additions & 45 deletions

File tree

pydomcfg/domzgr/sco.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Class to generate NEMO v4.0 s-coordinates
55
"""
66

7-
from itertools import product
87
from typing import Optional
98

109
import numpy as np
@@ -207,54 +206,10 @@ def _compute_env(self, depth: DataArray) -> DataArray:
207206

208207
# set first land point adjacent to a wet cell to
209208
# min_dep as this needs to be included in smoothing
210-
211-
# ------------------------------------------------------------
212-
# This is the original NEMO Fortran90 code: translated
213-
# in python it is very inefficient
214-
# ------------------------------------------------------------
215-
# zenv = depth.copy()
216-
# env = zenv.data
217-
#
218-
# nj = env.shape[0]
219-
# ni = env.shape[1]
220-
#
221-
# for j in range(nj - 1):
222-
# for i in range(ni - 1):
223-
# if not lsm[j, i]:
224-
# ip1 = np.minimum(i + 1, ni)
225-
# jp1 = np.minimum(j + 1, nj)
226-
# im1 = np.maximum(i - 1, 0)
227-
# jm1 = np.maximum(j - 1, 0)
228-
# if (
229-
# depth[jp1, im1]
230-
# + depth[jp1, i]
231-
# + depth[jp1, ip1]
232-
# + depth[j, im1]
233-
# + depth[j, ip1]
234-
# + depth[jm1, im1]
235-
# + depth[jm1, i]
236-
# + depth[jm1, ip1]
237-
# ) > 0.0:
238-
# env[j, i] = min_dep
239-
#
240-
# zenv.data = env
241-
# ------------------------------------------------------------
242-
243-
# ------------------------------------------------------------
244-
# This is my translation into xarray. I think it does what
245-
# it should, a part on the boundaries: I tested with AMM7,
246-
# and zenv computed with NEMO-like code (above) and this
247-
# one are perfectly identical apart for two single different
248-
# points just on the border ... I don't think it will make
249-
# a huge difference but if there is a better way to manage
250-
# the borders with xarray and obtain exactly the same results
251-
# of the original NEMO-like code, happy to use it.
252-
# ------------------------------------------------------------
253209
cst_lsm = lsm.rolling({dim: 3 for dim in lsm.dims}, min_periods=2).sum()
254210
cst_lsm = cst_lsm.shift({dim: -1 for dim in lsm.dims})
255211
cst_lsm = (cst_lsm > 0) & (lsm == 0)
256212
zenv = depth.where(cst_lsm == 0, self._min_dep)
257-
# ------------------------------------------------------------
258213

259214
zenv = _smooth_MB06(zenv, self._rmax)
260215
zenv = zenv.where(zenv > self._min_dep, self._min_dep)

0 commit comments

Comments
 (0)