Skip to content

Commit 306d779

Browse files
author
Sebastien FOUREST
committed
Correction supplémentaire climato Nmin
1 parent cc1988f commit 306d779

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

lenapy/utils/climato.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ def climatology(self, coefficients=None, x=None):
240240
if coefficients is None:
241241
return res.sum("coeffs", min_count=1)
242242
else:
243-
return res.sel(coeffs=np.ravel(coefficients)).sum("coeffs", min_count=1)
243+
return res.sel(coeffs=np.ravel(coefficients)).sum(
244+
"coeffs", min_count=(0 if coefficients == [] else 1)
245+
)
244246

245247
def residuals(self, coefficients=None):
246248
if type(self.ds) is xr.Dataset:
@@ -280,8 +282,4 @@ def interp_residuals(data_in):
280282
dask_gufunc_kwargs={"output_sizes": {self.dim: x.shape[0]}},
281283
)
282284

283-
return resid_interp + (
284-
self.climatology(coefficients=coefficients, x=x)
285-
if coefficients != []
286-
else 0
287-
)
285+
return resid_interp + self.climatology(coefficients=coefficients, x=x)

0 commit comments

Comments
 (0)