Skip to content
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

Matplotlib Example #389

Open
wxprofessor opened this issue Jan 25, 2018 · 9 comments
Open

Matplotlib Example #389

wxprofessor opened this issue Jan 25, 2018 · 9 comments

Comments

@wxprofessor
Copy link

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:
matplotlib/matplotlib#10318

@dopplershift
Copy link
Contributor

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: Unidata/python-gallery#63

Happy to take any relevant questions on that pull request.

@gpotter2
Copy link

@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
Copy link
Member

WeatherGod commented Jan 27, 2018 via email

@gpotter2
Copy link

@WeatherGod Thanks a lot for clarifying !

@jdkloe
Copy link

jdkloe commented Jan 29, 2018

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
Copy link
Member

WeatherGod commented Jan 29, 2018 via email

@jdkloe
Copy link

jdkloe commented Jan 30, 2018

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
Copy link
Contributor

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
Copy link
Member

efiring commented Jan 30, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants