matplotlib-basemap

Python solution to transforming polar stereographic data to mercator projection

爷,独闯天下 提交于 2019-12-08 06:24:24
问题 I've data in polar stereographic projection and the lat and lon values as well. But I cannot seem to find a simple way to transform this to a mercator (regular square lat and lon) projection in Basemap. Does anyone have a simple solution to this problem? Appreciate your help with this, /M 来源: https://stackoverflow.com/questions/15574507/python-solution-to-transforming-polar-stereographic-data-to-mercator-projection

Fill oceans in basemap [duplicate]

感情迁移 提交于 2019-12-07 17:52:04
问题 This question already has answers here : Plot only on continent in matplotlib (5 answers) Closed last year . I am trying to plot 1x1 degree data on a matplotlib.Basemap , and I want to fill the ocean with white. However, in order for the boundaries of the ocean to follow the coastlines drawn by matplotlib , the resolution of the white ocean mask should be much higher than the resolution of my data. After searching around for a long time I tried the two possible solutions: (1) maskoceans() and

How to plot the grid line only using pcolor/pcolormesh

时光怂恿深爱的人放手 提交于 2019-12-07 17:05:53
问题 By using ax.axhline & ax.axvline I can plot the grid network shows like this: http://i4.tietuku.com/e90652c9a56b5e61.png the code are reproduced here: lon_grid = np.linspace(113.5,115.49,36) lat_grid = np.linspace(37.40,38.78,30) lon_grid,lat_grid = np.linspace(xc1,xc2,36), np.linspace(yc1,yc2,30) for i in range(0,len(lon_grid),1): ax.axvline(x=lon_grid[i], linestyle='-', color='black', linewidth=0.75, zorder=3) for i in range(0,len(lat_grid),1): ax.axhline(y=lat_grid[i], linestyle='-', color

Map projection and forced interpolation

泄露秘密 提交于 2019-12-07 13:42:13
问题 I have a weird behaviour using different projections of Basemap. The measurementgrid that I want to plot onto a worldmap is of shape [181,83]. That means I have values for each 2°/2° point, ranging from -180° - 180° longitude and -82° - 82° latitude. from mpl_toolkits.basemap import Basemap import numpy as np measurementgrid = np.random.random_sample((181,83)) m = Basemap(projection='cyl',llcrnrlon=-180, llcrnrlat=-82, urcrnrlon=180, urcrnrlat=82, resolution='l') m.drawcoastlines() m

Plotting a map with matplotlib basemap - horribly slow

筅森魡賤 提交于 2019-12-07 13:30:29
问题 Plotting a very, very simple map of only europe in matplotlib / basemap takes so much time ( around 10 seconds! ). This is just unreal!? Setting of resolution is only "l" (low). Here is the very simple code: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap m = Basemap(projection='stere',lon_0=5,lat_0=90.0,rsphere=6371200.,\ llcrnrlon=-25.0,urcrnrlon=72.0,llcrnrlat=26.0,urcrnrlat=65.0,resolution='l') m.drawcoastlines(linewidth=0.2

Resample grid from center coordinates to external (i.e. corner) coordinates

末鹿安然 提交于 2019-12-07 11:55:27
问题 Is there a readily available method for extrapolating the grid corner positions (blue dots) from grid center positions (red dots)? The grid I am working with is not rectangular, so regular bi-linear interpolation doesn't seem like it would be the best way; though, this is just so that I my plot my data use pyplot.pcolormesh() , so perhaps that doesn't matter so much. Example grid data : import numpy as np lons = np.array([[ 109.93299681, 109.08091365, 108.18301276, 107.23602539], [ 108

How to plot geolocated RGB data faster using Python basemap

落爺英雄遲暮 提交于 2019-12-07 11:00:48
问题 I'm having an issue plotting an RGB image using Python's Basemap module with latitude and longitude data. Now, I am able to make the plots that I want, but the problem is how slow it is, since it is able to plot single channel data much faster than the RGB data, and in general, plotting RGB images on their own is also fast. Since I have lat/lon data, that is where things get complicated. I've checked out the solution to this problem: How to plot an irregular spaced RGB image using python and

How can I install Basemap in Python 3 / Matplotlib 2 on Ubuntu 16.04?

六月ゝ 毕业季﹏ 提交于 2019-12-07 02:07:21
问题 I tried pip3 install basemap but Basemap seems not to be on PyPI. There is an old question but it has no answer. What I did I downloaded basemap 1.07 (source) Matplotlib 2, numpy 1.11, PIL, python3-dev is installed I'm not sure where / how to get GEOS ( libgeos-dev ?). I think I followed the README and it didn't show any errors, but when trying the first line of this $ python3 >>> from mpl_toolkits.basemap import Basemap I get ImportError: libgeos-3.3.3.so: cannot open shared object file: No

Custom markers using Python (matplotlib)

不羁岁月 提交于 2019-12-06 21:09:44
I would like to know how I can generate the marker for the black colored line shown in this picture. (Source: NCEP & NOAA) It's the marker for a storm or hurricane in standard weather maps. I can probably generate an image file of the marker symbol. But, I am not aware of how I can tell matplotlib to use the image as a marker. The marker looks like a 6 . If this is the case, you can use a 6 as a marker as follows: import matplotlib.pyplot as plt x = [1,2,3,4] y = [2,3,1,4] plt.scatter(x,y, s= 100,marker="$6$") plt.show() If this is not an option, you may define your custom marker using a path.

Python solution to transforming polar stereographic data to mercator projection

梦想的初衷 提交于 2019-12-06 16:45:24
I've data in polar stereographic projection and the lat and lon values as well. But I cannot seem to find a simple way to transform this to a mercator (regular square lat and lon) projection in Basemap. Does anyone have a simple solution to this problem? Appreciate your help with this, /M 来源: https://stackoverflow.com/questions/15574507/python-solution-to-transforming-polar-stereographic-data-to-mercator-projection