9
9
import shutil
10
10
import sys
11
11
import warnings
12
+ from os import PathLike
12
13
from pathlib import Path
13
14
from typing import Optional , Union
14
15
from warnings import warn
21
22
from ..utils .crs import get_crs
22
23
23
24
24
- def write_gridlines_shapefile (filename : Union [str , os . PathLike ], mg ):
25
+ def write_gridlines_shapefile (filename : Union [str , PathLike ], mg ):
25
26
"""
26
27
Write a polyline shapefile of the grid lines - a lightweight alternative
27
28
to polygons.
@@ -59,12 +60,12 @@ def write_gridlines_shapefile(filename: Union[str, os.PathLike], mg):
59
60
60
61
61
62
def write_grid_shapefile (
62
- path : Union [str , os . PathLike ],
63
+ path : Union [str , PathLike ],
63
64
mg ,
64
65
array_dict ,
65
66
nan_val = np .nan ,
66
67
crs = None ,
67
- prjfile : Optional [ Union [str , os . PathLike ] ] = None ,
68
+ prjfile : Union [str , PathLike , None ] = None ,
68
69
verbose = False ,
69
70
** kwargs ,
70
71
):
@@ -87,7 +88,7 @@ def write_grid_shapefile(
87
88
The value can be anything accepted by
88
89
:meth:`pyproj.CRS.from_user_input() <pyproj.crs.CRS.from_user_input>`,
89
90
such as an authority string (eg "EPSG:26916") or a WKT string.
90
- prjfile : str or pathlike , optional if `crs` is specified
91
+ prjfile : str or PathLike , optional if `crs` is specified
91
92
ESRI-style projection file with well-known text defining the CRS
92
93
for the model grid (must be projected; geographic CRS are not supported).
93
94
**kwargs : dict, optional
@@ -224,7 +225,7 @@ def write_grid_shapefile(
224
225
225
226
226
227
def model_attributes_to_shapefile (
227
- path : Union [str , os . PathLike ],
228
+ path : Union [str , PathLike ],
228
229
ml ,
229
230
package_names = None ,
230
231
array_dict = None ,
@@ -259,7 +260,7 @@ def model_attributes_to_shapefile(
259
260
The value can be anything accepted by
260
261
:meth:`pyproj.CRS.from_user_input() <pyproj.crs.CRS.from_user_input>`,
261
262
such as an authority string (eg "EPSG:26916") or a WKT string.
262
- prjfile : str or pathlike , optional if `crs` is specified
263
+ prjfile : str or PathLike , optional if `crs` is specified
263
264
ESRI-style projection file with well-known text defining the CRS
264
265
for the model grid (must be projected; geographic CRS are not supported).
265
266
@@ -535,7 +536,7 @@ def get_pyshp_field_dtypes(code):
535
536
return dtypes .get (code , object )
536
537
537
538
538
- def shp2recarray (shpname : Union [str , os . PathLike ]):
539
+ def shp2recarray (shpname : Union [str , PathLike ]):
539
540
"""Read a shapefile into a numpy recarray.
540
541
541
542
Parameters
@@ -566,10 +567,10 @@ def shp2recarray(shpname: Union[str, os.PathLike]):
566
567
def recarray2shp (
567
568
recarray ,
568
569
geoms ,
569
- shpname : Union [str , os . PathLike ] = "recarray.shp" ,
570
+ shpname : Union [str , PathLike ] = "recarray.shp" ,
570
571
mg = None ,
571
572
crs = None ,
572
- prjfile : Optional [ Union [str , os . PathLike ] ] = None ,
573
+ prjfile : Union [str , PathLike , None ] = None ,
573
574
verbose = False ,
574
575
** kwargs ,
575
576
):
@@ -599,7 +600,7 @@ def recarray2shp(
599
600
The value can be anything accepted by
600
601
:meth:`pyproj.CRS.from_user_input() <pyproj.crs.CRS.from_user_input>`,
601
602
such as an authority string (eg "EPSG:26916") or a WKT string.
602
- prjfile : str or pathlike , optional if `crs` is specified
603
+ prjfile : str or PathLike , optional if `crs` is specified
603
604
ESRI-style projection file with well-known text defining the CRS
604
605
for the model grid (must be projected; geographic CRS are not supported).
605
606
**kwargs : dict, optional
0 commit comments