Skip to content

Commit 61cd5e4

Browse files
committed
Fix grammar and formatting in mask module
1 parent d3f84c4 commit 61cd5e4

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

conda_package/docs/mesh_conversion.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ details.
285285
-m MESH_FILE_NAME, --mesh_file_name MESH_FILE_NAME
286286
An MPAS mesh file
287287
-g GEOJSON_FILE_NAME, --geojson_file_name GEOJSON_FILE_NAME
288-
An Geojson file containing mask regions
288+
A GeoJSON file containing mask regions
289289
-o MASK_FILE_NAME, --mask_file_name MASK_FILE_NAME
290290
An output MPAS region masks file
291291
-t MASK_TYPES [MASK_TYPES ...], --mask_types MASK_TYPES [MASK_TYPES ...]
@@ -381,7 +381,7 @@ The command-line tool takes the following arguments:
381381
-m MESH_FILE_NAME, --mesh_file_name MESH_FILE_NAME
382382
An MPAS mesh file
383383
-g GEOJSON_FILE_NAME, --geojson_file_name GEOJSON_FILE_NAME
384-
An Geojson file containing transects
384+
A GeoJSON file containing transects
385385
-o MASK_FILE_NAME, --mask_file_name MASK_FILE_NAME
386386
An output MPAS transect masks file
387387
-t MASK_TYPES [MASK_TYPES ...], --mask_types MASK_TYPES [MASK_TYPES ...]
@@ -437,7 +437,7 @@ The command-line tool takes the following arguments:
437437
-m MESH_FILE_NAME, --mesh_file_name MESH_FILE_NAME
438438
An MPAS mesh file
439439
-g GEOJSON_FILE_NAME, --geojson_file_name GEOJSON_FILE_NAME
440-
An Geojson file containing points at which to start
440+
A GeoJSON file containing points at which to start
441441
the flood fill
442442
-o MASK_FILE_NAME, --mask_file_name MASK_FILE_NAME
443443
An output MPAS region masks file
@@ -475,7 +475,7 @@ The command-line tool takes the following arguments:
475475
--lon LON The name of the longitude coordinate
476476
--lat LAT The name of the latitude coordinate
477477
-g GEOJSON_FILE_NAME, --geojson_file_name GEOJSON_FILE_NAME
478-
An Geojson file containing mask regions
478+
A GeoJSON file containing mask regions
479479
-o MASK_FILE_NAME, --mask_file_name MASK_FILE_NAME
480480
An output MPAS region masks file
481481
-c CHUNK_SIZE, --chunk_size CHUNK_SIZE

conda_package/mpas_tools/mesh/mask.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def compute_mpas_region_masks(
111111
logger.info(f' Computing {maskType} masks:')
112112

113113
# create shapely geometry for lon and lat
114-
points = [shapely.geometry.Point(x, y) for x, y in zip(lon, lat)]
114+
points = [
115+
shapely.geometry.Point(x, y) for x, y in zip(lon, lat, strict=True)
116+
]
115117
regionNames, masks, properties = _compute_region_masks(
116118
fcMask,
117119
points,
@@ -171,7 +173,7 @@ def entry_point_compute_mpas_region_masks():
171173
dest='geojson_file_name',
172174
type=str,
173175
required=True,
174-
help='An Geojson file containing mask regions',
176+
help='A GeoJSON file containing mask regions',
175177
)
176178
parser.add_argument(
177179
'-o',
@@ -418,7 +420,7 @@ def entry_point_compute_mpas_transect_masks():
418420
dest='geojson_file_name',
419421
type=str,
420422
required=True,
421-
help='An Geojson file containing transects',
423+
help='A GeoJSON file containing transects',
422424
)
423425
parser.add_argument(
424426
'-o',
@@ -612,7 +614,7 @@ def entry_point_compute_mpas_flood_fill_mask():
612614
dest='geojson_file_name',
613615
type=str,
614616
required=True,
615-
help='An Geojson file containing points at which to '
617+
help='A GeoJSON file containing points at which to '
616618
'start the flood fill',
617619
)
618620
parser.add_argument(
@@ -708,7 +710,9 @@ def compute_lon_lat_region_masks(
708710
Lat = Lat.ravel()
709711

710712
# create shapely geometry for lon and lat
711-
points = [shapely.geometry.Point(x, y) for x, y in zip(Lon, Lat)]
713+
points = [
714+
shapely.geometry.Point(x, y) for x, y in zip(Lon, Lat, strict=True)
715+
]
712716
regionNames, masks, properties = _compute_region_masks(
713717
fcMask,
714718
points,
@@ -783,7 +787,7 @@ def entry_point_compute_lon_lat_region_masks():
783787
dest='geojson_file_name',
784788
type=str,
785789
required=True,
786-
help='An Geojson file containing mask regions',
790+
help='A GeoJSON file containing mask regions',
787791
)
788792
parser.add_argument(
789793
'-o',
@@ -932,7 +936,8 @@ def compute_projection_grid_region_masks(
932936

933937
# create shapely geometry for lon and lat
934938
points = [
935-
shapely.geometry.Point(x, y) for x, y in zip(lon.ravel(), lat.ravel())
939+
shapely.geometry.Point(x, y)
940+
for x, y in zip(lon.ravel(), lat.ravel(), strict=True)
936941
]
937942
regionNames, masks, properties = _compute_region_masks(
938943
fcMask,
@@ -1005,7 +1010,7 @@ def entry_point_compute_projection_grid_region_masks():
10051010
dest='geojson_file_name',
10061011
type=str,
10071012
required=True,
1008-
help='An Geojson file containing mask regions',
1013+
help='A GeoJSON file containing mask regions',
10091014
)
10101015
parser.add_argument(
10111016
'-o',
@@ -1349,7 +1354,7 @@ def _compute_transect_masks(
13491354
if subdivisionResolution is None:
13501355
new_coords.append(coords)
13511356
else:
1352-
lon, lat = zip(*coords)
1357+
lon, lat = zip(*coords, strict=True)
13531358
x, y, z = lon_lat_to_cartesian(
13541359
lon, lat, earthRadius, degrees=True
13551360
)
@@ -1359,7 +1364,9 @@ def _compute_transect_masks(
13591364
lon, lat = cartesian_to_lon_lat(
13601365
x, y, z, earthRadius, degrees=True
13611366
)
1362-
new_coords.append([list(a) for a in zip(lon, lat)])
1367+
new_coords.append(
1368+
[list(a) for a in zip(lon, lat, strict=True)]
1369+
)
13631370

13641371
if geom_type == 'LineString':
13651372
shape = shapely.geometry.LineString(new_coords[0])
@@ -1471,7 +1478,7 @@ def _get_polygons(dsMesh, maskType):
14711478

14721479
polygons = []
14731480
for index in range(lon.shape[0]):
1474-
coords = zip(lon[index, :], lat[index, :])
1481+
coords = zip(lon[index, :], lat[index, :], strict=True)
14751482
polygons.append(shapely.geometry.Polygon(coords))
14761483

14771484
return polygons, nPolygons, duplicatePolygons
@@ -1608,14 +1615,17 @@ def _compute_edge_sign(dsMesh, edgeMask, shape):
16081615
local_voe[local_mask] = local_v
16091616

16101617
graph = Graph(
1611-
n=len(unique_vertices), edges=zip(local_voe[:, 0], local_voe[:, 1])
1618+
n=len(unique_vertices),
1619+
edges=zip(local_voe[:, 0], local_voe[:, 1], strict=True),
16121620
)
16131621
graph.vs['distance'] = distance
16141622
graph.vs['lon'] = unique_lon
16151623
graph.vs['lat'] = unique_lat
16161624
graph.vs['vertices'] = numpy.arange(len(unique_vertices))
16171625
graph.es['edges'] = edge_indices
1618-
graph.es['vertices'] = [(v0, v1) for v0, v1 in zip(voe[:, 0], voe[:, 1])]
1626+
graph.es['vertices'] = [
1627+
(v0, v1) for v0, v1 in zip(voe[:, 0], voe[:, 1], strict=True)
1628+
]
16191629

16201630
edgeSign = numpy.zeros(edgeMask.shape, dtype=numpy.int32)
16211631

0 commit comments

Comments
 (0)