-
Notifications
You must be signed in to change notification settings - Fork 365
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
AzimuthalEquidistant Landarea Projection issue in the southern hemisphere #2030
Comments
I was going to make a new issue for exactly this, but it would be a duplicate so I'll try to poke this one. I've been encountering the same exact thing for quite a while, and it doesn't take the entire globe to show (nor do I have disappearing coastlines as appears to be the case above). It clearly does not have anything to do with the exact projection nor the fact that it's the southern hemisphere, as I get similar plots when using a TransverseMercator in the nothern hemisphere. I have not yet figured out what triggers the land color to fill everything. The following code: import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
def make_map(center_lat, center_lon):
radius_deg = 3
minlat, maxlat = center_lat-radius_deg, center_lat+radius_deg
minlon, maxlon = center_lon-radius_deg, center_lon+radius_deg
tm_proj = ccrs.TransverseMercator(central_longitude=center_lon,
central_latitude=center_lat)
fig, ax = plt.subplots(subplot_kw=dict(projection=tm_proj))
ax.set_extent((minlon, maxlon, minlat, maxlat), crs=ccrs.PlateCarree())
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.STATES)
ax.gridlines(draw_labels=True)
p1_lat, p1_lon = 45.556092, -122.640675 # Portland, OR
p2_lat, p2_lon = 48.422130, -123.357623 # Victoria, BC
make_map(p1_lat, p1_lon)
make_map(p2_lat, p2_lon)
plt.show() Produces these two plots: The one centered on Portland looks fine, the one centered on Victoria has "land" everywhere. I've tried changing the order of adding the features but that doesn't work. From my experience in the wild (I've been seeing this for a LONG time in my real-world application), it appears almost random which plots will have land everywhere and which won't. I'm seeing this in Cartopy 0.22, no differently than in previous versions. |
Update - I noticed that I do the coastlines differently in my example, so I probably would have disappearing coastlines if I just relied on the land feature's edges instead of the separate coastline feature. It looks like something isn't closing the shape somewhere, but I couldn't begin to figure out why. |
Yeah, takeaway was that somehow through projection the polygon from the continent is closed "the wrong way". But just like you, I wouldn't know where to begin to debug. I gave up on this one after poking a little more. |
#2470 fixes the original example here, but unfortunately not the example from #2030 (comment). |
Description
Hi Team,
I have been encountering an issue that may be related to other issues here concerning the accurate plotting of land areas when providing the keywords
central_longitude=??
andcentral_latitude=??
. I attached a working and a failing example. There is no error, but the plotting is weird. I'm running on macOS with a freshconda
environment with onlycartopy
andmatplotlib
installed like so:When creating a
AzimuthalEquidistant
projection instance usingThe land areas fill the entire map:
However, if I use a latitude just slightly closer to the equator the projection is completely fine:
Code to reproduce
Failing example
central_longitude=-66, central_latitude=-25
Working as expected example
central_longitude=-66, central_latitude=-22
System Summary
Note that anaconda is using
python=3.7.x
but thecartopy
environment is usingpython=3.10.x
.conda info
Operating system
macOS=12.1
Cartopy version
cartopy=0.20.2
conda list
pip list
The text was updated successfully, but these errors were encountered: