Skip to content

regression bug in cartopy 0.20?, as_geocentric() not functionning as expected #2032

@dja001

Description

@dja001

Description

I use cartopy.crs.Geodetic().as_geocentric() to get x,y,z coordinates from lat/lon. Since the introduction of cartopy 0.20, this functionality appears to be broken with the returned z-component always zero.

Code to reproduce

The problem can be reproduced with a few lines of code:

import numpy as np
import cartopy

crs = cartopy.crs.Geodetic()
geo_cent = crs.as_geocentric()

out = geo_cent.transform_points(crs, np.array([0.]), np.array([45.]))
print('[x,y,z] from lon=0, lat=45 : ', out)

In cartopy 0.19, output is :


[x,y,z] from  lon=0, lat=45 :  [[4517590.87884893       0.         4487348.40886592]]

as expected.

In cartopy 0.20 output is:


[x,y,z] from lon=0, lat=45 :  [[4517590.87884893       0.               0.        ]]

with the z component equal to zero while it should not.

Operating system

linux

Cartopy version

Problem in 0.20

conda list

Test environments created with:
conda create -n cartopy19 -c conda-forge cartopy=0.19.0.post1
and
conda create -n cartopy20 -c conda-forge cartopy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions