MatPlotLib(Basemap)与Grads、NCL和GMT的对比
来源:互联网 发布:手机淘宝旺旺名在哪里 编辑:程序博客网 时间:2024/06/05 16:52
MatPlotLib是python中大名鼎鼎的绘图包,在绘制图形方面比Grads、NCL(NCAR Command Language)和GMT要强大的多,并且借助于python简洁的语法,编程也容易得多,远非后两者可以与之相提并论的.Grads、NCL和GMT只是在Earth System Modeling 和Global Climate Modeling等方面,一直遥遥领先.不过情况已悄悄变化,现在MatPlotLib已推出basemap 1.0.7,可以说basemap在处理文件 (netCDF,hdf,shapefile等) 和 绘图方面,基本上实现了Grads、NCL和GMT的所有功能.
绘制的结果如下:
下面给个例子,让大家感受一下basemap:
from mpl_toolkits.basemap import Basemapimport matplotlib.pyplot as pltimport 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()
绘制的结果如下:
更多的例子,去Basemap的Example Gallery看看吧:
Basemap的的文档链接为:http://matplotlib.org/basemap/index.html
Wiki也提供了一点coolbook:
http://wiki.scipy.org/Cookbook/Matplotlib/Maps
- MatPlotLib(Basemap)与Grads、NCL和GMT的对比
- matplotlib之Basemap与PyQt4一例
- 使用Python的netCDF4和matplotlib.basemap包进行气象数据的可视化
- basemap and matplotlib
- 安装matplotlib basemap
- NCL基于顺序结构的绘图程序和基于对象的绘图程序对比
- Linux Mint安装matplotlib basemap
- [matplotlib]Basemap 安装使用简介
- GrADS在Unix/Linux和Windows下的安装与设置
- NCL的简介和安装方法
- GMT和UTC的区别
- GMT 和 UTC 的区别
- GMT和CST的转换
- GMT与Etc/GMT地区信息的时区转换
- 【利用python进行数据分析-学习记录】python-matplotlib中Basemap插件的安装
- matplotlib basemap 绘制多边形区域曲线
- grads环境变量的设置
- NCL介绍与安装 记一次不平凡的经历!
- queue
- Android相机开发(一)之预览拍照查看图片基本功能的实现
- Matlab 安装libsvm-3.1工具箱介绍
- 【Deep Learning学习笔记】Modeling Documents with a Deep Boltzmann Machine_Hinton_uai2013
- css优化技巧
- MatPlotLib(Basemap)与Grads、NCL和GMT的对比
- 用代码创建UITabBarController
- Thinking in Java(第四版)习题--第三章
- hdu 2896 病毒侵袭 AC自动机
- glBlendFunc();--混合
- learning puppet 4--template and function
- Cgroup文件系统
- ubuntu下安装zend-framework
- sleep()和 wait()有什么区别