diff --git a/monetio/sat/_tropomi_l2_no2_mm.py b/monetio/sat/_tropomi_l2_no2_mm.py index a575893f..66ced287 100644 --- a/monetio/sat/_tropomi_l2_no2_mm.py +++ b/monetio/sat/_tropomi_l2_no2_mm.py @@ -103,7 +103,7 @@ def get_extra(varname_, *, dct_=None, default_group="PRODUCT"): # Tropopause pressure ptrop = xr.full_like(itrop, np.nan, dtype=ds["preslev"].dtype) for i in np.unique(itrop): - if np.isnan(i): + if np.isnan(i) or i < 0 or i >= p.sizes["z"]: continue ptrop = xr.where(itrop == i, p.isel(z=int(i)), ptrop) ds["troppres"] = ptrop