Skip to content

Commit 9589679

Browse files
committed
cleaning syntax
1 parent eac503b commit 9589679

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

pydomcfg/domzgr/sco.py

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

7-
from typing import Optional # , Tuple
7+
from itertools import product
8+
from typing import Optional
89

910
import numpy as np
1011
import xarray as xr
1112
from xarray import DataArray, Dataset
1213

13-
from pydomcfg.utils import _smooth_MB06 # , _calc_rmax
14+
from pydomcfg.utils import _smooth_MB06
1415

1516
from .zgr import Zgr
1617

@@ -193,7 +194,7 @@ def _compute_env(self, depth: DataArray) -> DataArray:
193194
----------
194195
depth: DataArray
195196
xarray DataArray of the 2D bottom topography
196-
it MUST have only two dimensions named "x" and "y"
197+
it MUST have only two dimensions
197198
Returns
198199
-------
199200
DataArray
@@ -251,11 +252,10 @@ def _compute_env(self, depth: DataArray) -> DataArray:
251252
# ------------------------------------------------------------
252253
cst_lsm = lsm * 0.0
253254
ngb_pnt = [-1, 0, 1]
254-
for j in ngb_pnt:
255-
for i in ngb_pnt:
256-
if j != 0 or i != 0:
257-
lsm_sft = lsm.shift({lsm.dims[1]: i, lsm.dims[0]: j})
258-
cst_lsm += lsm_sft
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
259259

260260
cst_lsm = cst_lsm.where(lsm == 0, 0)
261261
cst_lsm = cst_lsm.where(cst_lsm == 0, 1)

0 commit comments

Comments
 (0)