pytroll / pytroll/pyresample

Switch to pyproj 2.3+ for Transformer and CRS objects

Open
#267 20 comments 0 reactions 4 assignees View on GitHub

@pnuu is already working on this.

Since Apr 13, 2020.

enhancement
Dominant language
Python
Stars
385
Forks
102
Avg merge
4d 2h
Merged PRs (30d)
9

Description

Background

Pyresample has used old pyproj interfaces for a long time and depends heavily on the Proj class to transform between lon/lat degree coordinates and X/Y projection coordinates. We also depend heavily on PROJ parameter dictionaries and strings. PROJ strings are overall deprecated and are unable of representing all Coordinate Reference Systems (CRS) out there. The PROJ library suggests WellKnownText (WKT).

Forgive me for the lack of references to the claims in this issue.

Suggestions

  1. Drop the custom Proj classes in:

    https://github.com/pytroll/pyresample/blob/3d6d38d40a30e2ae943dbbe7fe46766db7a77a19/pyresample/_spatial_mp.py#L129-L137

    These checks are meant to produce lon/lat degrees when dealing with a geographic CRS (+proj=latlong). As of pyproj 2.3.0 this is done by default. This current check also makes it so certain geographic CRSes are not possible (ex. +proj=latlong +pm=180).

  2. Switch to the pyproj Transformer class for all current Proj uses. It is the recommended interface and would go something like this (I think):

    from pyproj import Transformer, CRS
    t = Transformer.from_crs(CRS('EPSG:4326'), area_def.crs, always_xy=True)
    x, y = t.transform(lon, lat)
    

    Without the always_xy=True this would flip the expected/returned order of the axes. In the case of EPSG:4326, this expects latitude first, longitude second.

  3. Drop PROJ parameters as internally stored representation of CRS information. See #264 for first attempts at storing WKT instead.

CC @snowman2 (pyproj maintainer). If you have any other suggestions, corrections, or other feedback, please let us know.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.