-
Notifications
You must be signed in to change notification settings - Fork 394
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
Bug in hammer projection with lon_0>0 #463
Comments
I have the same problem in Basemap 'robin' projection. I had updated the basemap to 1.2.1 and matplotlib 3.1. And I think there is another problem is relative to this problem. When lon_0 is not equal 0, all the background functions, like drawlsmask(), bluemarble(), ..., are useless. |
Same issue with eck4 using basemap 1.2.0, matplotlib 3.0.3, python 3.7.1. @William-gregory / @ghzuo - were you able to use a different version to circumvent this issue? |
Most likely, the issue is related to pyproj4 or proj4 as most of the work
for transforms are off-loaded to proj4.
…On Thu, Aug 15, 2019 at 7:52 PM pochedls ***@***.***> wrote:
Same issue with eck4 using basemap 1.2.0, matplotlib 3.0.3, python 3.7.1.
@William-gregory <https://github.com/William-gregory> / @ghzuo
<https://github.com/ghzuo> - were you able to use a different version to
circumvent this issue?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#463?email_source=notifications&email_token=AACHF6FVJSIHRPGOI5LZ6W3QEXT2NA5CNFSM4HYWK6GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4NJOIQ#issuecomment-521836322>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACHF6D3UOT3UOKJROGOCX3QEXT2NANCNFSM4HYWK6GA>
.
|
I also find that, in order for the code to even run (in an anaconda environment), I need to preface it with: import os Previously, this preface was not needed. I do not know whether this is related to the bug the OP reported. The inverted images occur with many of the map projections, but not for 'cyl', which is just a lat-long projection. |
@sbonaime - I have largely transitioned to cartopy, but I recall using a negative value, e.g., |
@pochedls I should update my old script ! |
@sbonaime - I assume it would be possible to address this with an older library (perhaps just creating a conda environment with an older version of basemap would work). |
@pochedls lon_0=-345 is not working... Maybe I should take some time to update to cartopy. Thanks |
So, I've hit a similar issue, code I've used to reproduce, blue-marble with robin projection from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
m = Basemap(projection="robin", lon_0=0, resolution=None)
m.bluemarble()
plt.show() It works on all tested base map versions - 1.1.0 - 1.3.4 only if I downgrade matplotlib to TL;DR try downgrading matplotlib, ~3.4.3 worked for me |
@PhillCli Thanks for the feedback and the hint about the |
It's a silent failure, the plot is generated but is completely empty except for an outline. Just like in this post comment There is a warning, but it's also present in the working case:
EDIT: |
@PhillCli Removing the From your code snippet, if you try to do the following with the Robin projection:
you can see that the transformed image is actually there and it is transformed correctly (note that the image will appear upside down in the figure, but this also occurs in
So the problem does not seem to be with the projection transformations but with the rendering of the image by
The problem that you described propagates to all the |
Going a bit more into the
so |
@molinav Thanks for the investigation, I'm not that familiar with the internals of Basemap. Good to know the image is still properly transformed, and just a matter of explicitly adding it to Axes object. That would make sense that something about rendering changed in 3.5.3 that breaks the default Basemap imshow, wonder if that was also the case for the @sbonaime issue. It might be valuable to update the docs I think that's where the snippet I tried to fix originated from here. |
I have the similar issue with "moll" projection, and find a very rough solution. See if the steps described in #577 can solve your problem.
|
I have the similar issue with "moll" projection, and find a very rough solution. See if the steps described in #577 can solve your problem.
|
I have the similar issue with "moll" projection, and find a very rough solution. See if the steps described in #577 can solve your problem. In basemap-1.3.7, Line 3206, you can add ",fill_color='none'" for limb2, the modified code looks like:
|
Tracing back with Python 3.7, the failure related to the flipped coastlines occurs in the transition of the |
Solves GitHub issue #463. The bug appears in the `pyproj` transition from version 1.9.6 to 2.0.0, which corresponds when `pyproj` migrated from PROJ 4.x to PROJ 6.0.
I close this issue as complete after applying the patch proposed by @YilongWang. If any problem persists, please free to reopen this issue or to create a new one. |
When using Basemap 'hammer' projection with lon_0 set to anything greater than 0 degrees, the map is plotted as the mirror image of reality. Setting lon_0 to negative values (like -180) works fine, but I don't want to do this as then none of my data would fit this projection and I would have to re-grid everything.
I've subsequently uninstalled & reinstalled anaconda3 (now have python 3.7) and have also reinstalled Basemap (v.1.2.0), and am still getting the same problem.
Here is the code:
import matplotlib as mpl
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
m = Basemap(projection='hammer', resolution = 'l', lon_0=180)
fig = plt.figure(figsize=(12,12))
m.drawcoastlines(linewidth=0.3)
m.fillcontinents(color='lightgrey',lake_color='white')
m.drawmapboundary(fill_color='white')
plt.show()
The text was updated successfully, but these errors were encountered: