Skip to content

Commit 8f079b7

Browse files
committed
fixed logic for xesmf
1 parent a871fde commit 8f079b7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

extract_model/extract_model.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ def select(
393393
)
394394
kwargs_out["weights"] = weights
395395
kwargs_out["interp_coords"] = {}
396+
elif not XESMF_AVAILABLE and horizontal_interp_code == "xesmf":
397+
raise ModuleNotFoundError(
398+
"xESMF is not available so horizontal interpolation in 2D cannot be performed."
399+
)
396400
elif horizontal_interp_code == "delaunay":
397401

398402
# This might be faster for interpolation between a few points and many points
@@ -542,11 +546,8 @@ def pt_in_itriangle_proj(ix, iy):
542546
# interp_coords are the coords and indices that went into the interpolation
543547
da, interp_coords = interp_with_barycentric(da, ixs, iys, lam)
544548
kwargs_out["interp_coords"] = interp_coords
545-
546549
else:
547-
raise ModuleNotFoundError(
548-
"xESMF is not available so horizontal interpolation in 2D cannot be performed."
549-
)
550+
raise RuntimeError("Horizontal interpolation cannot be run.")
550551

551552
end_time = time()
552553
print("time: ", end_time - start_time)

0 commit comments

Comments
 (0)