@@ -261,7 +261,7 @@ def difference(self, maskingFC, show_progress=False):
261261 featureCount = len (self .features )
262262 maskCount = len (maskingFC .features )
263263
264- totalCount = featureCount * maskCount
264+ totalCount = featureCount * maskCount
265265
266266 if show_progress :
267267 print ('Masking features...' )
@@ -285,7 +285,7 @@ def difference(self, maskingFC, show_progress=False):
285285 masked = False
286286 for maskIndex , maskFeature in enumerate (maskingFC .features ):
287287 if show_progress :
288- bar .update (maskIndex + featureIndex * maskCount )
288+ bar .update (maskIndex + featureIndex * maskCount )
289289 maskShape = shapely .geometry .shape (maskFeature ['geometry' ])
290290 if featureShape .intersects (maskShape ):
291291 masked = True
@@ -613,7 +613,8 @@ def _validate_feature(feature):
613613 raise KeyError (f'Feature { name } missing [{ outerKey } ] key' )
614614 for innerKey in required [outerKey ]:
615615 if innerKey not in feature [outerKey ]:
616- raise KeyError (f'Feature { name } missing [{ outerKey } ][{ innerKey } ] key' )
616+ raise KeyError (
617+ f'Feature { name } missing [{ outerKey } ][{ innerKey } ] key' )
617618
618619 geomType = feature ['geometry' ]['type' ]
619620 objectType = feature ['properties' ]['object' ]
@@ -666,18 +667,18 @@ def _validate_feature(feature):
666667
667668def _split_geometry_crossing_antimeridian (geometry ):
668669 def _to_polar (lon , lat ):
669- phi = np .pi / 180. * (np .mod (lon + 180. , 360. ) - 180. )
670- radius = np .pi / 180. * (90. - sign * lat )
670+ phi = np .pi / 180. * (np .mod (lon + 180. , 360. ) - 180. )
671+ radius = np .pi / 180. * (90. - sign * lat )
671672
672673 # nudge points at +/- 180 out of the way so they don't intersect the
673674 # testing wedge
674675 phi = np .sign (phi ) * \
675- np .where (np .abs (phi ) > np .pi - 1.5 * epsilon ,
676- np .pi - 1.5 * epsilon , np .abs (phi ))
676+ np .where (np .abs (phi ) > np .pi - 1.5 * epsilon ,
677+ np .pi - 1.5 * epsilon , np .abs (phi ))
677678 # radius = np.where(radius < 1.5*epsilon, 1.5*epsilon, radius)
678679
679- x = radius * np .sin (phi )
680- y = radius * np .cos (phi )
680+ x = radius * np .sin (phi )
681+ y = radius * np .cos (phi )
681682 if isinstance (lon , list ):
682683 x = x .tolist ()
683684 y = y .tolist ()
@@ -688,17 +689,17 @@ def _to_polar(lon, lat):
688689 return x , y
689690
690691 def _from_polar (x , y ):
691- radius = np .sqrt (np .array (x )** 2 + np .array (y )** 2 )
692+ radius = np .sqrt (np .array (x )** 2 + np .array (y )** 2 )
692693 phi = np .arctan2 (x , y )
693694
694695 # close up the tiny gap
695- radius = np .where (radius < 2 * epsilon , 0. , radius )
696+ radius = np .where (radius < 2 * epsilon , 0. , radius )
696697 phi = np .sign (phi ) * \
697- np .where (np .abs (phi ) > np .pi - 2 * epsilon ,
698+ np .where (np .abs (phi ) > np .pi - 2 * epsilon ,
698699 np .pi , np .abs (phi ))
699700
700- lon = 180. / np .pi * phi
701- lat = sign * (90. - 180. / np .pi * radius )
701+ lon = 180. / np .pi * phi
702+ lat = sign * (90. - 180. / np .pi * radius )
702703
703704 if isinstance (x , list ):
704705 lon = lon .tolist ()
@@ -717,8 +718,8 @@ def _from_polar(x, y):
717718 (epsilon , - np .pi )])
718719
719720 featureShape = shapely .geometry .shape (geometry )
720- sign = ( 2. * ( 0.5 * ( featureShape .bounds [1 ] + featureShape .bounds [3 ]) >= 0. ) -
721- 1. )
721+ sign_mask = featureShape .bounds [1 ] + featureShape .bounds [3 ] >= 0.
722+ sign = 2. * sign_mask - 1.
722723 polarShape = shapely .ops .transform (_to_polar , featureShape )
723724
724725 if not polarShape .intersects (antimeridianWedge ):
0 commit comments