Skip to content

Commit

Permalink
Merge branch 'pyproj4:main' into query-geodetic-datum
Browse files Browse the repository at this point in the history
  • Loading branch information
jjimenezshaw authored Apr 19, 2024
2 parents e237f2e + 24a7b7f commit e457169
Show file tree
Hide file tree
Showing 24 changed files with 145 additions and 229 deletions.
3 changes: 2 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/22159116?v=4",
"profile": "https://cyschneck.com/",
"contributions": [
"doc"
"doc",
"test"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true

env:
PROJ_VERSION: "9.3.0"
PROJ_VERSION: "9.4.0"
DEBIAN_FRONTEND: noninteractive

jobs:
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,12 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
proj-version: ['9.3.0']
proj-version: ['9.4.0']
include:
- python-version: '3.10'
proj-version: '9.2.1'
- python-version: '3.10'
proj-version: '9.1.1'
proj-version: '9.3.1'
- python-version: '3.10'
proj-version: '9.1.0'
- python-version: '3.10'
proj-version: '9.0.1'
proj-version: '9.2.1'
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -134,10 +130,6 @@ jobs:
# python-version: '*'
# python-implementation: pypy
# proj-version: '*'
- os: ubuntu-latest
python-version: '*'
python-implementation: python
proj-version: '9.1.1'
steps:
- uses: actions/checkout@v4

Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ repos:
types:
- file
args: [--append-config=flake8/cython.cfg]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
2 changes: 1 addition & 1 deletion HOW_TO_RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Next, go through the history and add release notes (see: [automatically generate

Most of the wheels are tested with each merge to main and uploaded to pypi on release in GitHub Actions. However, the arm64 wheels are built separately. This provides instructions for those wheels:

1. linux arm64: Update the PR at https://github.com/pyproj4/pyproj-wheels with the release tag & merge. The wheels will automatically upload to pypi when the CI runs suceed.
1. linux arm64: Update the PR at https://github.com/pyproj4/pyproj-wheels with the release tag & merge. The wheels will automatically upload to pypi when the CI runs succeed.
2. macos arm64: Download the release wheel artifacts from the Cirrus CI build and upload manually to pypi.

### Verify conda-forge build is correct
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="https://github.com/rhugonnet"><img src="https://avatars.githubusercontent.com/u/28896516?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Romain Hugonnet</b></sub></a><br /><a href="https://github.com/pyproj4/pyproj/commits?author=rhugonnet" title="Code">💻</a> <a href="https://github.com/pyproj4/pyproj/commits?author=rhugonnet" title="Documentation">📖</a> <a href="https://github.com/pyproj4/pyproj/commits?author=rhugonnet" title="Tests">⚠️</a></td>
<td align="center"><a href="https://javier.jimenezshaw.com/"><img src="https://avatars.githubusercontent.com/u/15678366?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Javier Jimenez Shaw</b></sub></a><br /><a href="https://github.com/pyproj4/pyproj/commits?author=jjimenezshaw" title="Code">💻</a> <a href="https://github.com/pyproj4/pyproj/commits?author=jjimenezshaw" title="Documentation">📖</a> <a href="https://github.com/pyproj4/pyproj/commits?author=jjimenezshaw" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/djm93dev"><img src="https://avatars.githubusercontent.com/u/101536185?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Daniel McDonald</b></sub></a><br /><a href="https://github.com/pyproj4/pyproj/commits?author=djm93dev" title="Documentation">📖</a></td>
<td align="center"><a href="https://cyschneck.com/"><img src="https://avatars.githubusercontent.com/u/22159116?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cora Schneck</b></sub></a><br /><a href="https://github.com/pyproj4/pyproj/commits?author=cyschneck" title="Documentation">📖</a></td>
<td align="center"><a href="https://cyschneck.com/"><img src="https://avatars.githubusercontent.com/u/22159116?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cora Schneck</b></sub></a><br /><a href="https://github.com/pyproj4/pyproj/commits?author=cyschneck" title="Documentation">📖</a> <a href="https://github.com/pyproj4/pyproj/commits?author=cyschneck" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/zanejgr"><img src="https://avatars.githubusercontent.com/u/14795919?v=4?s=100" width="100px;" alt=""/><br /><sub><b>zanejgr</b></sub></a><br /><a href="https://github.com/pyproj4/pyproj/commits?author=zanejgr" title="Documentation">📖</a></td>
</tr>
</table>
Expand Down
37 changes: 26 additions & 11 deletions ci/proj-compile-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# INSTALL PROJ & DEPENDENCIES FOR WHEELS
# Test for macOS with [ -n "$IS_MACOS" ]
SQLITE_VERSION=3420000
LIBTIFF_VERSION=4.5.0
CURL_VERSION=8.1.2
NGHTTP2_VERSION=1.54.0
SQLITE_VERSION=450100
LIBTIFF_VERSION=4.6.0
CURL_VERSION=8.6.0
NGHTTP2_VERSION=1.60.0


# ------------------------------------------
# From: https://github.com/multi-build/multibuild/
# ------------------------------------------
BUILD_PREFIX="${BUILD_PREFIX:-/usr/local}"
OPENSSL_ROOT=${OPENSSL_ROOT:-openssl-1.1.1l}
# Hash from https://www.openssl.org/source/openssl-1.1.1?.tar.gz.sha256
OPENSSL_HASH=${OPENSSL_HASH:-0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1}
OPENSSL_ROOT=${OPENSSL_ROOT:-openssl-3.2.1}
# Hash from https://www.openssl.org/source/openssl-3.2.1.tar.gz.sha256
OPENSSL_HASH=${OPENSSL_HASH:-6ae015467dabf0469b139ada93319327be24b98251ffaeceda0221848dc09262}
OPENSSL_DOWNLOAD_URL=${OPENSSL_DOWNLOAD_URL:-https://www.openssl.org/source}

if [ $(uname) == "Darwin" ]; then
Expand Down Expand Up @@ -207,8 +207,23 @@ function build_zlib {
touch zlib-stamp
}

function build_perl {
if [ -n "$IS_MACOS" ]; then return; fi # OSX has perl already
if [ -e perl-stamp ]; then return; fi
if [[ $MB_ML_VER == "_2_24" ]]; then
# debian:9 based distro
apt-get install -y perl
else
# centos based distro
yum_install perl-core
fi
touch perl-stamp
}


function build_openssl {
if [ -e openssl-stamp ]; then return; fi
suppress build_perl
fetch_unpack ${OPENSSL_DOWNLOAD_URL}/${OPENSSL_ROOT}.tar.gz
check_sha256sum $ARCHIVE_SDIR/${OPENSSL_ROOT}.tar.gz ${OPENSSL_HASH}
(cd ${OPENSSL_ROOT} \
Expand Down Expand Up @@ -240,7 +255,7 @@ function build_curl_ssl {
flags="$flags --with-darwinssl"
else # manylinux
suppress build_openssl
flags="$flags --with-ssl"
flags="$flags --with-ssl --without-libpsl"
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BUILD_PREFIX/lib
fi
fetch_unpack https://curl.se/download/curl-${CURL_VERSION}.tar.gz
Expand All @@ -265,13 +280,13 @@ function build_sqlite {
CFLAGS="$CFLAGS -DHAVE_PREAD64 -DHAVE_PWRITE64"
fi
if [ -e sqlite-stamp ]; then return; fi
build_simple sqlite-autoconf $SQLITE_VERSION https://www.sqlite.org/2023
build_simple sqlite-autoconf $SQLITE_VERSION https://www.sqlite.org/2024
touch sqlite-stamp
}

function build_proj {
if [ -e proj-stamp ]; then return; fi
get_modern_cmake
suppress get_modern_cmake
fetch_unpack https://download.osgeo.org/proj/proj-${PROJ_VERSION}.tar.gz
suppress build_curl_ssl
(cd proj-${PROJ_VERSION:0:5} \
Expand All @@ -290,7 +305,7 @@ function build_proj {
}

# Run installation process
update_env_for_build_prefix
suppress update_env_for_build_prefix
suppress build_zlib
suppress build_sqlite
suppress build_libtiff
Expand Down
6 changes: 3 additions & 3 deletions ci/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "pyproj",
"version": "3.6.0",
"version": "3.7.0",
"dependencies": [
{
"name": "proj",
"version>=": "9.3.0"
"version>=": "9.4.0"
}
],
"builtin-baseline": "7b5ca09708ae42dba9517d4e0a0c975d087f1061"
"builtin-baseline": "46542ddc124d692945b66cf6dda9876b9eef1dc3"
}
4 changes: 3 additions & 1 deletion docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Change Log

Latest
------
- WHL: Wheels contain PROJ 9.4.0 (pull #1386)
- DEP: Minimum supported Python version 3.10 (pull #1357)
- DEP: Minimum PROJ version 9.2 (pull #1394)
- ENH: Add :meth:`CRS.is_deprecated` and :meth:`CRS.get_non_deprecated` (pull #1383)
- ENH: Add :meth:`database.query_geodetic_crs_from_datum` (pull #1390)

Expand Down Expand Up @@ -156,7 +158,7 @@ Latest
* ENH: Added :ref:`network_api` (#675, #691, #695)
* ENH: Added ability to use global context (issue #661)
* ENH: Added transformation grid sync API/CLI (issue #572)
* ENH: Support obects with '__array__' method (pandas.Series, xarray.DataArray, dask.array.Array) (issue #573)
* ENH: Support objects with '__array__' method (pandas.Series, xarray.DataArray, dask.array.Array) (issue #573)
* ENH: Added :func:`pyproj.datadir.get_user_data_dir` (pull #636)
* ENH: Added :attr:`pyproj.transformer.Transformer.is_network_enabled` (issue #629)
* ENH: Added :meth:`pyproj.transformer.TransformerGroup.download_grids` (pull #643)
Expand Down
1 change: 1 addition & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pyproj PROJ
3.3 8.0-9.1
3.4+ 8.2+
3.5+ 9+
3.7+ 9.2+
============ ============

Setup PROJ
Expand Down
18 changes: 5 additions & 13 deletions pyproj/_crs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2342,10 +2342,9 @@ cdef dict _CRS_TYPE_MAP = {
PJ_TYPE_ENGINEERING_CRS: "Engineering CRS",
PJ_TYPE_BOUND_CRS: "Bound CRS",
PJ_TYPE_OTHER_CRS: "Other CRS",
PJ_TYPE_DERIVED_PROJECTED_CRS: "Derived Projected CRS",
}

IF (CTE_PROJ_VERSION_MAJOR, CTE_PROJ_VERSION_MINOR) >= (9, 2):
_CRS_TYPE_MAP[PJ_TYPE_DERIVED_PROJECTED_CRS] = "Derived Projected CRS"

cdef class _CRS(Base):
"""
Expand Down Expand Up @@ -2396,21 +2395,14 @@ cdef class _CRS(Base):
if self._type_name is not None:
return self._type_name
self._type_name = _CRS_TYPE_MAP[self._type]
if not self.is_derived or self._type == PJ_TYPE_PROJECTED_CRS:
if not self.is_derived or self._type in (
PJ_TYPE_PROJECTED_CRS,
PJ_TYPE_DERIVED_PROJECTED_CRS,
):
# Projected CRS are derived by definition
# https://github.com/OSGeo/PROJ/issues/3525#issuecomment-1365790999
return self._type_name

# Handle Derived Projected CRS
# https://github.com/OSGeo/PROJ/issues/3525#issuecomment-1366002289
IF (CTE_PROJ_VERSION_MAJOR, CTE_PROJ_VERSION_MINOR) < (9, 2):
if self._type == PJ_TYPE_OTHER_CRS:
self._type_name = "Derived Projected CRS"
return self._type_name
ELSE:
if self._type == PJ_TYPE_DERIVED_PROJECTED_CRS:
return self._type_name

self._type_name = f"Derived {self._type_name}"
return self._type_name

Expand Down
52 changes: 21 additions & 31 deletions pyproj/_transformer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ proj_version_str = f"{PROJ_VERSION_MAJOR}.{PROJ_VERSION_MINOR}.{PROJ_VERSION_PAT
PROJ_VERSION = (PROJ_VERSION_MAJOR, PROJ_VERSION_MINOR, PROJ_VERSION_PATCH)
_AUTH_CODE_RE = re.compile(r"(?P<authority>\w+)\:(?P<code>\w+)")

IF (CTE_PROJ_VERSION_MAJOR, CTE_PROJ_VERSION_MINOR) >= (9, 1):
cdef extern from "proj.h" nogil:
PJ* proj_trans_get_last_used_operation(PJ *P)


cdef dict _TRANSFORMER_TYPE_MAP = {
PJ_TYPE_UNKNOWN: "Unknown Transformer",
Expand Down Expand Up @@ -322,13 +318,10 @@ cdef PJ* proj_create_crs_to_crs(
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):
if only_best:
options[options_index] = b"ONLY_BEST=YES"
else:
options[options_index] = b"ONLY_BEST=NO"
ELSE:
raise NotImplementedError("only_best requires PROJ 9.2+.")
if only_best:
options[options_index] = b"ONLY_BEST=YES"
else:
options[options_index] = b"ONLY_BEST=NO"

cdef PJ* transform = NULL
with nogil:
Expand Down Expand Up @@ -468,27 +461,24 @@ cdef class _Transformer(Base):
return self._operations

def get_last_used_operation(self):
IF (CTE_PROJ_VERSION_MAJOR, CTE_PROJ_VERSION_MINOR) >= (9, 1):
cdef PJ* last_used_operation = proj_trans_get_last_used_operation(self.projobj)
if last_used_operation == NULL:
raise ProjError(
"Last used operation not found. "
"This is likely due to not initiating a transform."
)
cdef PJ_CONTEXT* context = NULL
try:
context = pyproj_context_create()
except:
proj_destroy(last_used_operation)
raise
proj_assign_context(last_used_operation, context)
return _Transformer._from_pj(
context,
last_used_operation,
False,
cdef PJ* last_used_operation = proj_trans_get_last_used_operation(self.projobj)
if last_used_operation == NULL:
raise ProjError(
"Last used operation not found. "
"This is likely due to not initiating a transform."
)
ELSE:
raise NotImplementedError("PROJ 9.1+ required to get last used operation.")
cdef PJ_CONTEXT* context = NULL
try:
context = pyproj_context_create()
except:
proj_destroy(last_used_operation)
raise
proj_assign_context(last_used_operation, context)
return _Transformer._from_pj(
context,
last_used_operation,
False,
)

@property
def is_network_enabled(self):
Expand Down
2 changes: 1 addition & 1 deletion pyproj/crs/coordinate_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ class VerticalPerspectiveConversion(CoordinateOperation):
"""
.. versionadded:: 2.5.0
Class for constructing the Vetical Perspective conversion.
Class for constructing the Vertical Perspective conversion.
:ref:`PROJ docs <nsper>`
"""
Expand Down
2 changes: 1 addition & 1 deletion pyproj/crs/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ class VerticalCRS(CustomConstructorCRS):
"""
.. versionadded:: 2.5.0
This class is for building a Vetical CRS.
This class is for building a Vertical CRS.
.. warning:: geoid_model support only exists in PROJ >= 6.3.0
Expand Down
8 changes: 1 addition & 7 deletions pyproj/database.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,15 @@ cdef dict _PJ_TYPE_MAP = {
PJType.TRANSFORMATION: PJ_TYPE_TRANSFORMATION,
PJType.CONCATENATED_OPERATION: PJ_TYPE_CONCATENATED_OPERATION,
PJType.OTHER_COORDINATE_OPERATION: PJ_TYPE_OTHER_COORDINATE_OPERATION,
PJType.DERIVED_PROJECTED_CRS: PJ_TYPE_DERIVED_PROJECTED_CRS,
}
IF (CTE_PROJ_VERSION_MAJOR, CTE_PROJ_VERSION_MINOR) >= (9, 2):
_PJ_TYPE_MAP[PJType.DERIVED_PROJECTED_CRS] = PJ_TYPE_DERIVED_PROJECTED_CRS

cdef dict _INV_PJ_TYPE_MAP = {value: key for key, value in _PJ_TYPE_MAP.items()}


cdef PJ_TYPE get_pj_type(pj_type) except *:
if not isinstance(pj_type, PJType):
pj_type = PJType.create(pj_type)
IF (CTE_PROJ_VERSION_MAJOR, CTE_PROJ_VERSION_MINOR) < (9, 2):
if pj_type is PJType.DERIVED_PROJECTED_CRS:
raise NotImplementedError(
"DERIVED_PROJECTED_CRS requires PROJ 9.2+"
)
return _PJ_TYPE_MAP[pj_type]


Expand Down
1 change: 1 addition & 0 deletions pyproj/proj.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ cdef extern from "proj.h" nogil:
double* out_ymax,
int densify_pts
)
PJ* proj_trans_get_last_used_operation(PJ *P)
ctypedef struct PJ_AREA
PJ *proj_create_crs_to_crs_from_pj(
PJ_CONTEXT *ctx,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from setuptools import Extension, setup

PROJ_MIN_VERSION = (9, 0, 0)
PROJ_MIN_VERSION = (9, 2, 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
5 changes: 0 additions & 5 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

_NETWORK_ENABLED = pyproj.network.is_network_enabled()
PROJ_LOOSE_VERSION = version.parse(pyproj.__proj_version__)
PROJ_911 = PROJ_LOOSE_VERSION == version.parse("9.1.1")
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")
PROJ_GTE_92 = PROJ_LOOSE_VERSION >= version.parse("9.2.0")
PROJ_GTE_921 = PROJ_LOOSE_VERSION >= version.parse("9.2.1")
PROJ_GTE_93 = PROJ_LOOSE_VERSION >= version.parse("9.3.0")

Expand Down
Loading

0 comments on commit e457169

Please sign in to comment.