Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

basemap python

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
# set up orthographic map projection with
# perspective of satellite looking down at 50N, 100W.
# use low resolution coastlines.
map = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l')
# draw coastlines, country boundaries, fill continents.
map.drawcoastlines(linewidth=0.25)
map.drawcountries(linewidth=0.25)
map.fillcontinents(color='coral',lake_color='aqua')
# draw the edge of the map projection region (the projection limb)
map.drawmapboundary(fill_color='aqua')
# draw lat/lon grid lines every 30 degrees.
map.drawmeridians(np.arange(0,360,30))
map.drawparallels(np.arange(-90,90,30))
# make up some data on a regular lat/lon grid.
nlats = 73; nlons = 145; delta = 2.*np.pi/(nlons-1)
lats = (0.5*np.pi-delta*np.indices((nlats,nlons))[0,:,:])
lons = (delta*np.indices((nlats,nlons))[1,:,:])
wave = 0.75*(np.sin(2.*lats)**8*np.cos(4.*lons))
mean = 0.5*np.cos(2.*lats)*((np.sin(2.*lats))**2 + 2.)
# compute native map projection coordinates of lat/lon grid.
x, y = map(lons*180./np.pi, lats*180./np.pi)
# contour data over the map.
cs = map.contour(x,y,wave+mean,15,linewidths=1.5)
plt.title('contour lines over filled continent background')
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: django models using Value 
Python :: django check if queryset is empty 
Python :: how to take multiple input in list in python 
Python :: port 5432 failed: timeout expired 
Python :: remove duplicates python 
Python :: Python make directories recursively 
Python :: program arguments python 
Python :: how to transpose a 2d list in python 
Python :: write page source to text file python 
Python :: how to draw a rectangle in pygame 
Python :: how to print sum of two numbers in python 
Python :: merge two dict python 3 
Python :: max pooling tf keras 
Python :: python set intersection 
Python :: python list of colors 
Python :: pandas read csv skip first line 
Python :: print textbox value in tkinter 
Python :: python numpy array to list 
Python :: python unlist flatten nested lists 
Python :: create an empty dataframe 
Python :: display 2d numpy array as image 
Python :: Prime numbers within given range in python 
Python :: python get string from decimal 
Python :: orderd set in python 
Python :: assignment 7.1 python data structures 
Python :: zip django template 
Python :: pandas add list to dataframe as column 
Python :: sqlite check if table exists 
Python :: python: measure time code 
Python :: python convert dict to xml 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =