Skip to content

Commit

Permalink
fixed some paths and removed broken code
Browse files Browse the repository at this point in the history
  • Loading branch information
acchamber committed Nov 8, 2023
1 parent 7b28fcd commit 6decedf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
9 changes: 3 additions & 6 deletions lib/iris/_shapefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,9 @@ def create_shapefile_mask(
mask_template[idx] = True
# if weights method used, mask intersections below required weight
if intersect_bool is True and weights is True:
if (
shapely.covers(trans_geo, cell_box) is False
): # box is not 100% inside shape
intersect_area = trans_geo.intersection(cell_box).area
if (intersect_area / cell_box.area) <= minimum_weight:
mask_template[idx] = True
intersect_area = trans_geo.intersection(cell_box).area
if (intersect_area / cell_box.area) <= minimum_weight:
mask_template[idx] = True

return mask_template

Expand Down
10 changes: 5 additions & 5 deletions lib/iris/tests/test_shapefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cartopy.io.shapereader as shpreader
import numpy as np

import iris._shapefiles
import iris
import iris.tests as tests
from iris.util import apply_shapefile

Expand All @@ -17,7 +17,7 @@ class TestCubeMasking(tests.IrisTest):

def testGlobal(self):
path = tests.get_data_path(
"NetCDF", "global", "xyt", "SMALL_hires_wind_u_for_ipcc4.nc"
["NetCDF", "global", "xyt", "SMALL_hires_wind_u_for_ipcc4.nc"]
)
test_global = iris.load_cube(path)
ne_russia = [
Expand All @@ -33,7 +33,7 @@ def testGlobal(self):

def testRotated(self):
path = tests.get_data_path(
"NetCDF", "rotated", "xy", "rotPole_landAreaFraction.nc"
["NetCDF", "rotated", "xy", "rotPole_landAreaFraction.nc"]
)
test_rotated = iris.load_cube(path)
ne_germany = [
Expand All @@ -48,7 +48,7 @@ def testRotated(self):

def testTransverseMercator(self):
path = tests.get_data_path(
"NetCDF", "transverse_mercator", "tmean_1910_1910.nc"
["NetCDF", "transverse_mercator", "tmean_1910_1910.nc"]
)
test_transverse = iris.load_cube(path)
ne_uk = [
Expand All @@ -63,7 +63,7 @@ def testTransverseMercator(self):

def testRotatedWeighted(self):
path = tests.get_data_path(
"NetCDF", "rotated", "xy", "rotPole_landAreaFraction.nc"
["NetCDF", "rotated", "xy", "rotPole_landAreaFraction.nc"]
)
test_rotated = iris.load_cube(path)
ne_germany = [
Expand Down

0 comments on commit 6decedf

Please sign in to comment.