Skip to content

Commit

Permalink
DEP: Minimum PROJ version 9.0 (#1244)
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 committed Feb 25, 2023
1 parent 9dfbb24 commit 8109fc4
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 46 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ jobs:
python-version: ['3.8', '3.9', '3.10', '3.11']
proj-version: ['9.1.0']
include:
- python-version: '3.8'
proj-version: '8.2.1'
- python-version: '3.9'
proj-version: '9.0.1'
steps:
Expand Down
1 change: 1 addition & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Change Log

Latest
------
- DEP: Minimum PROJ version 9.0 (issue #1223)
- ENH: Add `return_back_azimuth: bool` to allow compatibility between the azimuth output of the following functions (issue #1163):
`fwd` and `fwd_intermediate`, `inv` and `inv_intermediate`,
Note: BREAKING CHANGE for the default value `return_back_azimuth=True` in the functions `fwd_intermediate` and `inv_intermediate`
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Python interface to `PROJ <https://proj.org/>`_ (cartographic projections and c

GitHub Repository: https://github.com/pyproj4/pyproj

.. note:: Minimum supported PROJ version is 8.2
.. note:: Minimum supported PROJ version is 9.0

.. note:: Minimum supported Python version is 3.8

Expand Down
1 change: 1 addition & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pyproj PROJ
3.0.1-3.2 7.2-9.1
3.3 8.0-9.1
3.4+ 8.2+
3.5+ 9+
============ ============

Setup PROJ
Expand Down
5 changes: 1 addition & 4 deletions flake8/cython.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[flake8]
filename = *.pyx,*.pxd
max-line-length=88
select=E302,E203,E111,E114,E221,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403,C400,C401,C402,C403,C404,C405,C406,C407,C408,C409,C410,C411
# Temporarily disabled until proj_trans_bounds
# used in PROJ 8.2+
# E501, E303
select=E302,E203,E111,E114,E221,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403,C400,C401,C402,C403,C404,C405,C406,C407,C408,C409,C410,C411,E501,E303
5 changes: 1 addition & 4 deletions pyproj/_transformer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,7 @@ cdef PJ* proj_create_crs_to_crs(
options[options_index] = b"ALLOW_BALLPARK=NO"
options_index += 1
if force_over:
IF CTE_PROJ_VERSION_MAJOR >= 9:
options[options_index] = b"FORCE_OVER=YES"
ELSE:
raise NotImplementedError("force_over requires PROJ 9+.")
options[options_index] = b"FORCE_OVER=YES"
options_index += 1
if only_best is not None:
IF (CTE_PROJ_VERSION_MAJOR, CTE_PROJ_VERSION_MINOR) >= (9, 2):
Expand Down
8 changes: 0 additions & 8 deletions pyproj/crs/coordinate_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing import Any

from pyproj._crs import CoordinateOperation
from pyproj._transformer import PROJ_VERSION
from pyproj.exceptions import CRSError


Expand Down Expand Up @@ -1437,13 +1436,6 @@ def __new__(
Longitude of the North pole of the unrotated source CRS,
expressed in the rotated geographic CRS (o_lon_p).
"""
if PROJ_VERSION < (8, 2, 0):
# https://github.com/pyproj4/pyproj/issues/927
return RotatedLatitudeLongitudeConversion(
o_lat_p=grid_north_pole_latitude,
o_lon_p=north_pole_grid_longitude,
lon_0=grid_north_pole_longitude + 180,
)
rot_latlon_json = {
"$schema": "https://proj.org/schemas/v0.4/projjson.schema.json",
"type": "Conversion",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pkg_resources import parse_version
from setuptools import Extension, setup

PROJ_MIN_VERSION = parse_version("8.2.0")
PROJ_MIN_VERSION = parse_version("9.0.0")
CURRENT_FILE_PATH = Path(__file__).absolute().parent
BASE_INTERNAL_PROJ_DIR = Path("proj_dir")
INTERNAL_PROJ_DIR = CURRENT_FILE_PATH / "pyproj" / BASE_INTERNAL_PROJ_DIR
Expand Down
1 change: 0 additions & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

_NETWORK_ENABLED = pyproj.network.is_network_enabled()
PROJ_LOOSE_VERSION = version.parse(pyproj.__proj_version__)
PROJ_GTE_9 = PROJ_LOOSE_VERSION >= version.parse("9.0.0")
PROJ_GTE_901 = PROJ_LOOSE_VERSION >= version.parse("9.0.1")
PROJ_GTE_91 = PROJ_LOOSE_VERSION >= version.parse("9.1")
PROJ_GTE_911 = PROJ_LOOSE_VERSION >= version.parse("9.1.1")
Expand Down
45 changes: 20 additions & 25 deletions test/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from pyproj.exceptions import ProjError
from pyproj.transformer import AreaOfInterest, TransformerGroup
from test.conftest import (
PROJ_GTE_9,
PROJ_GTE_91,
PROJ_GTE_92,
grids_available,
Expand Down Expand Up @@ -1663,30 +1662,26 @@ def test_transformer_group_authority_filter():


def test_transformer_force_over():
if PROJ_GTE_9:
transformer = Transformer.from_crs("EPSG:4326", "EPSG:3857", force_over=True)
# Test a point along the equator.
# The same point, but in two different representations.
xxx, yyy = transformer.transform(0, 140)
xxx_over, yyy_over = transformer.transform(0, -220)
# Web Mercator x's between 0 and 180 longitude come out positive.
# But when forcing the over flag, the -220 calculation makes it flip.
assert xxx > 0
assert xxx_over < 0
# check it works in both directions
xxx_inverse, yyy_inverse = transformer.transform(
xxx, yyy, direction=TransformDirection.INVERSE
)
xxx_over_inverse, yyy_over_inverse = transformer.transform(
xxx_over, yyy_over, direction=TransformDirection.INVERSE
)
assert_almost_equal(xxx_inverse, 0)
assert_almost_equal(xxx_over_inverse, 0)
assert_almost_equal(yyy_inverse, 140)
assert_almost_equal(yyy_over_inverse, -220)
else:
with pytest.raises(NotImplementedError, match="force_over requires PROJ 9"):
Transformer.from_crs("EPSG:4326", "EPSG:3857", force_over=True)
transformer = Transformer.from_crs("EPSG:4326", "EPSG:3857", force_over=True)
# Test a point along the equator.
# The same point, but in two different representations.
xxx, yyy = transformer.transform(0, 140)
xxx_over, yyy_over = transformer.transform(0, -220)
# Web Mercator x's between 0 and 180 longitude come out positive.
# But when forcing the over flag, the -220 calculation makes it flip.
assert xxx > 0
assert xxx_over < 0
# check it works in both directions
xxx_inverse, yyy_inverse = transformer.transform(
xxx, yyy, direction=TransformDirection.INVERSE
)
xxx_over_inverse, yyy_over_inverse = transformer.transform(
xxx_over, yyy_over, direction=TransformDirection.INVERSE
)
assert_almost_equal(xxx_inverse, 0)
assert_almost_equal(xxx_over_inverse, 0)
assert_almost_equal(yyy_inverse, 140)
assert_almost_equal(yyy_over_inverse, -220)


def test_transformer__get_last_used_operation():
Expand Down

0 comments on commit 8109fc4

Please sign in to comment.