-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transform_vector is wrong / not linear for some projections #2279
Comments
Reading /cartopy/blob/main/lib/cartopy/crs.py#L438, , This assumption is not physical. Projecting a vector from one basis (the tangent space of one projection) to another is a general linear transformation, and there's no guarantee that vector magnitudes should be preserved. Hell, if I define 'PlateCareeHalfDegree' which is just a lat-lon projection denominated in 1/2-degree increments, then the vector angles should remain unchanged while the vector magnitudes should double/halve as appropriate. |
The vectors are assumed to be in the "projection" coordinates, not necessarily the geographic coordinates. See this PR for an attempt to rectify some of this: #1926 which I think is related to your issues here? |
This is more than just a question of projection coordinates. PR #1926 is more related to the unintuitive behaviour of defining vectors as Δdegree on a lat/lon plot rather than the more commonly-used and intuitive Δdistance (m/s, for example). The reproducing issue here treats the vectors as Δdeg throughout: Δ1-deg at the equator of the rotated lat-lon projection is Δ√2-deg on the PlateCaree projection. The finite difference calculation gets this correct, but |
Description
I'm using (attempting to use)
cartopy.crs.transform_vectors
to transform map-coordinate wind vectors from one projection to another, currently from a rotated lat-lon projection to an ordinary lat-lon projection. In so doing, I could never quite get the wind speeds to match up after converting from (presumably) degrees/sec back to meters/second.In drilling down to simpler and simpler reproductions, I've found that for at least
cartopy.crs.RotatedPole
,transform_vector
isn't even linear. I could understand some scale-based difference between the output oftransform_vector
and a finite difference approximation viatransform_points
, but I can't think of any reason that the transformation should behave nonlinearly.Code to reproduce
Output
Full environment definition
Operating system
Ubuntu 22.04.2
Cartopy version
0.22
conda list
pip list
The text was updated successfully, but these errors were encountered: