Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move regionmaskcompat to core #275

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mesmer/core/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import regionmask
import xarray as xr

import mesmer.utils
import mesmer


def _where_if_dim(obj, cond, dims):
Expand Down Expand Up @@ -56,10 +56,10 @@ def mask_ocean_fraction(data, threshold, *, x_coords="lon", y_coords="lat"):
land_110 = regionmask.defined_regions.natural_earth_v5_0_0.land_110

try:
mask_fraction = mesmer.utils.regionmaskcompat.mask_3D_frac_approx(
mask_fraction = mesmer.core.regionmaskcompat.mask_3D_frac_approx(
land_110, data[x_coords], data[y_coords]
)
except mesmer.utils.regionmaskcompat.InvalidCoordsError as e:
except mesmer.core.regionmaskcompat.InvalidCoordsError as e:
raise ValueError(
"Cannot calculate fractional mask for irregularly-spaced coords - use "
"``mask_land`` instead."
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion mesmer/io/load_constant_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import regionmask
from packaging.version import Version

from ..utils.regionmaskcompat import mask_3D_frac_approx
from ..core.regionmaskcompat import mask_3D_frac_approx


def load_phi_gc(lon, lat, ls, cfg, L_start=1500, L_end=10000, L_interval=250):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_regionmaskcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import shapely.geometry
import xarray as xr

from mesmer.utils.regionmaskcompat import (
from mesmer.core.regionmaskcompat import (
InvalidCoordsError,
mask_3D_frac_approx,
sample_coord,
Expand Down