From 15335dac084be283c33e2d2bdea63f4f01fabe52 Mon Sep 17 00:00:00 2001 From: zmoon Date: Wed, 1 Mar 2023 11:32:07 -0700 Subject: [PATCH] Unwrap lons in `quick_contourf` if not monotonic --- monet/monet_accessor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/monet/monet_accessor.py b/monet/monet_accessor.py index f06c38ea..dc83a395 100644 --- a/monet/monet_accessor.py +++ b/monet/monet_accessor.py @@ -1097,6 +1097,9 @@ def quick_contourf(self, map_kws=None, roll_dateline=False, **kwargs): sns.set_context("notebook") da = _dataset_to_monet(self._obj) + dlon = da.longitude.diff("x") + if not ((dlon >= 0).all() or (dlon <= 0).all()): # monotonic + da["longitude"] = da.longitude % 360 # unwrap longitudes crs_p = ccrs.PlateCarree() if "crs" not in map_kws: map_kws["crs"] = crs_p