From 8a454b8fe3a00562925c0ef4a470b5da1905ecb5 Mon Sep 17 00:00:00 2001 From: Maggie Bruckner Date: Tue, 5 Nov 2024 10:25:37 -0700 Subject: [PATCH] Update monetio/sat/_tropomi_l2_no2_mm.py Co-authored-by: Zachary Moon --- monetio/sat/_tropomi_l2_no2_mm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monetio/sat/_tropomi_l2_no2_mm.py b/monetio/sat/_tropomi_l2_no2_mm.py index 44634d6c..66ced287 100644 --- a/monetio/sat/_tropomi_l2_no2_mm.py +++ b/monetio/sat/_tropomi_l2_no2_mm.py @@ -103,8 +103,9 @@ 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 i >= 0 and i < p.sizes["z"]: - ptrop = xr.where(itrop == i, p.isel(z=int(i)), ptrop) + 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 ds["troppres"].attrs.update({"long_name": "tropopause pressure", "units": "Pa"})