flopy.utils.crs module

Utilities related to coordinate reference system handling.

get_authority_crs(crs)[source]

Try to get the authority representation for a coordinate reference system (CRS), for more robust comparison with other CRS objects.

Parameters:

crs (pyproj.CRS, int, str) – Coordinate reference system (CRS) for the model grid (must be projected; geographic CRS are not supported). The value can be anything accepted by pyproj.CRS.from_user_input(), such as an authority string (eg “EPSG:26916”) or a WKT string.

Returns:

CRS instance initialized with the name and authority code (e.g. “epsg:5070”) produced by pyproj.crs.CRS.to_authority()

Return type:

pyproj.CRS instance

Notes

pyproj.crs.CRS.to_authority() will return None if a matching authority name and code can’t be found. In this case, the input crs instance will be returned.

References

http://pyproj4.github.io/pyproj/stable/api/crs/crs.html

get_crs(prjfile=None, crs=None, **kwargs)[source]

Helper function to produce a pyproj.CRS object from various input.

Notes

Longer-term, this would just handle the crs and prjfile arguments, but in the near term, we need to warn users about deprecating the prj, epsg, proj4 and wkt_string inputs.

Parameters:
  • prjfile (str or pathlike, optional) – ESRI-style projection file with well-known text defining the CRS for the model grid (must be projected; geographic CRS are not supported).

  • crs (pyproj.CRS, int, str, optional if prjfile is specified) – Coordinate reference system (CRS) for the model grid (must be projected; geographic CRS are not supported). The value can be anything accepted by pyproj.CRS.from_user_input(), such as an authority string (eg “EPSG:26916”) or a WKT string.

  • **kwargs (dict, optional) –

    Support deprecated keyword options.

    Deprecated since version 3.4: The following keyword options will be removed for FloPy 3.6:

    • prj (str or pathlike): use prjfile instead.

    • epsg (int): use crs instead.

    • proj4 (str): use crs instead.

    • wkt_string (str): use crs instead.

Return type:

pyproj.CRS instance

get_shapefile_crs(shapefile)[source]

Get the coordinate reference system for a shapefile.

Parameters:

shapefile (str or pathlike) – Path to a shapefile or an associated projection (.prj) file.

Return type:

pyproj.CRS instance