matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
779 stars 392 forks source link

Matplotlib Example #389

Open wxprofessor opened 6 years ago

wxprofessor commented 6 years ago

Hello! ... I reported the following issue in the Matplotlib repo... and they said to bring it to your attention:

The Matplotlib Sample: "Plot Precip With Filled Contours" https://matplotlib.org/basemap/users/examples.html

code source: https://matplotlib.org/basemap/users/figures/plotprecip.py

seems to be dated... I say "seems" because this is my first week of python! :)

Code for reproduction The variables as specified in your code do not seem to exist: latcorners = nc.variables['lat'][:] loncorners = -nc.variables['lon'][:] lon_0 = -nc.variables['true_lon'].getValue() lat_0 = nc.variables['true_lat'].getValue()

I'm guessing because that data is from 2006 and something has changed since then :)

I have been failing with new data located here: http://water.weather.gov/precip/downloads/2018/01/24/nws_precip_1day_20180124_conus.nc

surely there is a way for matplotlib to cull the information needed from the file? if not I figure I'll do the long math..

use your code located here code source: https://matplotlib.org/basemap/users/figures/plotprecip.py

but also notice that not only are the lat lon variables present, your variable: prcpvar = nc.variables['amountofprecip']

will need to be adjusted to prcpvar = nc.variables['observation']

and the units are now inches instead of mm.

Here is the issue I submitted to matplotlib: https://github.com/matplotlib/matplotlib/issues/10318

dopplershift commented 6 years ago

Since Basemap is on its last legs, I took the liberty of both solving your netCDF file problems (these files are...interesting, though I appreciate the effort by NWS to try to do CF-compliance), and I ported to CartoPy. I've turned it into an example for Unidata's Python gallery: https://github.com/Unidata/python-gallery/pull/63

Happy to take any relevant questions on that pull request.

gpotter2 commented 6 years ago

@dopplershift Hi ! I'm very new to this..

What is the status of the basemap project ? Is it dead ? Should we use CartoPy instead or will it be still maintained ?

Thanks a lot for answering !

WeatherGod commented 6 years ago

I am the sole maintainer of basemap, and I am more here to make sure the lights get turned off.

I am supporting basemap until 2020. This means that I'll fix things as I come across them, and I'll review and merge pull requests that others make, but I am not doing active development. Cartopy can do much of what basemap could do, just differently. All new development should be done first with Cartopy. If a feature is missing in cartopy that is in basemap, then it should be considered a bug in Cartopy. Contributions and efforts should be directed towards cartopy, not basemap.

On Sat, Jan 27, 2018 at 12:56 PM, gpotter2 notifications@github.com wrote:

@dopplershift https://github.com/dopplershift Hi ! I'm very new to this..

What is the status of the basemap project ? Is it dead ? Should we use CartoPy instead or will it be still maintained ?

Thanks a lot for answering !

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/matplotlib/basemap/issues/389#issuecomment-361002082, or mute the thread https://github.com/notifications/unsubscribe-auth/AARy-IGgOnt9YxTije-RRaR9zpp1L41nks5tO2MzgaJpZM4Rs6kG .

gpotter2 commented 6 years ago

@WeatherGod Thanks a lot for clarifying !

jdkloe commented 6 years ago

so wouldn't it be an idea to make cartopy a requirement for basemap and replace the basemap code behind the scenes with cartopy calls?

WeatherGod commented 6 years ago

I doubt that would be possible. The fundamental design of cartopy is very different from basemap. Even the data that basemap works off of is different from cartopy uses.

If you want to investigate that avenue, feel free to do so, but I have no resources or inclination to do so myself.

On Mon, Jan 29, 2018 at 3:51 AM, Jos de Kloe notifications@github.com wrote:

so wouldn't it be an idea to make cartopy a requirement for basemap and replace the basemap code behind the scenes with cartopy calls?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/matplotlib/basemap/issues/389#issuecomment-361177807, or mute the thread https://github.com/notifications/unsubscribe-auth/AARy-FSLBwgBbvCMcVT7w3KMEanr6y1cks5tPYajgaJpZM4Rs6kG .

jdkloe commented 6 years ago

Thanks, I understand the difficulty. Same for me, I don't have the possibility to spend a huge amount of time doing this. Another idea is to provide some hints to the users. Maybe some of the example scripts could be modified to show how the same could be achieved using cartopy? With a little switch on top to choose the one or the other implementation?

dopplershift commented 6 years ago

I think the right answer is to get comparable examples at one of these two spots:

http://scitools.org.uk/cartopy/docs/v0.15/gallery.html https://unidata.github.io/python-gallery

efiring commented 6 years ago

Right, cartopy badly needs attention, including additional examples. Examples or tutorials along the lines of "how to translate this basemap plot into cartopy" would be enormously helpful. As would clear identification of things one can easily do in basemap but not (yet) in cartopy.