站点数据绘制等值线需要首先将站点数据插值为格点数据,MeteoInfo中提供了反距离权法(IDW)和cressman两个方法,其中IDW方法可以有插值半径的选项。这里示例读取一个MICAPS第一类数据(地面全要素观测),获取6小时累积降水数据(Precipitation6h),然后用站点数据的griddata函数将站点数据插值为格点数据,再利用contourfm函数创建等值线填色图层(等值线间隔和颜色可以自定义)。

脚本程序(经纬度投影):

#Set data folders
basedir = 'D:/MyProgram/Distribution/java/MeteoInfo/MeteoInfo'
datadir = os.path.join(basedir, 'sample/MICAPS')
mapdir = os.path.join(basedir, 'map')
#Read shape files
bou2_layer = shaperead(os.path.join(mapdir, 'bou2_4p.shp'))
bou1_layer = shaperead(os.path.join(mapdir, 'bou1_4l.shp'))
china_layer = shaperead(os.path.join(mapdir, 'china.shp'))
city_layer = shaperead(os.path.join(mapdir, 'res1_4m.shp'))
#Read station data
f = addfile_micaps(os.path.join(datadir, '10101414.000'))
pr = f.stationdata('Precipitation6h')
#griddata function - interpolate
x = arange(75, 135, 0.5)
y = arange(18, 55, 0.5)
prg = pr.griddata((x, y), method='idw', radius=3)
#Plot
axesm()
geoshow(bou2_layer, edgecolor='lightgray')
geoshow(bou1_layer, facecolor=(0,0,255))
geoshow(city_layer, facecolor='r', size=4, labelfield='NAME', fontname=u'楷体', fontsize=16, yoffset=15)
geoshow(china_layer, visible=False)
levs = [0.1, 1, 2, 5, 10, 20, 25, 50, 100]
cols = [(255,255,255),(170,240,255),(120,230,240),(200,220,50),(240,220,20),(255,120,10),(255,90,10), \
(240,40,0),(180,10,0),(120,10,0)]
layer = contourfm(prg, levs, colors=cols)
masklayer(china_layer, [layer])
colorbar(layer)
xlim(72, 136)
ylim(16, 55)
text(95, 52, u'全国降水量实况图', fontname=u'黑体', fontsize=16)
text(95, 50, u'(2010-10-14 08:00 至 2010-10-14 14:00)', fontname=u'黑体', fontsize=14)
#Add south China Sea
sc_layer = bou1_layer.clone()
axesm(position=[0.14,0.18,0.15,0.2], axison=False)
geoshow(sc_layer, facecolor=(0,0,255))
xlim(106, 123)
ylim(2, 23)

脚本程序(Lambert投影):

#Set data folders
basedir = 'D:/MyProgram/Distribution/java/MeteoInfo/MeteoInfo'
datadir = os.path.join(basedir, 'sample/MICAPS')
mapdir = os.path.join(basedir, 'map')
#Read shape files
bou2_layer = shaperead(os.path.join(mapdir, 'bou2_4p.shp'))
bou1_layer = shaperead(os.path.join(mapdir, 'bou1_4l.shp'))
china_layer = shaperead(os.path.join(mapdir, 'china.shp'))
city_layer = shaperead(os.path.join(mapdir, 'res1_4m.shp'))
#Read station data
f = addfile_micaps(os.path.join(datadir, '10101414.000'))
pr = f.stationdata('Precipitation6h')
#griddata function - interpolate
x = arange(75, 135, 0.5)
y = arange(18, 55, 0.5)
prg = pr.griddata((x, y), method='idw', radius=3)
#Plot
proj = projinfo(proj='lcc', lon_0=105, lat_1=25, lat_2=47)
axesm(projinfo=proj, position=[0, 0, 0.9, 1], axison=False, gridlabel=False, frameon=False)
geoshow(bou2_layer, edgecolor='lightgray')
geoshow(bou1_layer, facecolor=(0,0,255))
geoshow(city_layer, facecolor='r', size=4, labelfield='NAME', fontname=u'楷体', fontsize=16, yoffset=15)
geoshow(china_layer, visible=False)
levs = [0.1, 1, 2, 5, 10, 20, 25, 50, 100]
cols = [(255,255,255),(170,240,255),(120,230,240),(200,220,50),(240,220,20),(255,120,10),(255,90,10), \
(240,40,0),(180,10,0),(120,10,0)]
layer = contourfm(prg, levs, colors=cols)
masklayer(china_layer, [layer])
colorbar(layer, shrink=0.5, aspect=15)
axism([78, 130, 14, 53])
text(95, 53, u'全国降水量实况图', fontname=u'黑体', fontsize=18)
text(95, 51, u'(2010-10-14 08:00 至 2010-10-14 14:00)', fontname=u'黑体', fontsize=16)
#Add south China Sea
sc_layer = bou1_layer.clone()
axesm(position=[0.1,0.05,0.15,0.2], axison=False)
geoshow(sc_layer, facecolor=(0,0,255))
xlim(106, 123)
ylim(2, 23)

运行结果:

MeteoInfoLab脚本示例:站点数据绘制等值线的更多相关文章

  1. MeteoInfoLab脚本示例:数据投影-FLEXPART

    FLEXPART是一个类似HYSPLIT的扩散模式,它输出的netcdf文件参照了WRF,可惜全局属性没有写全,比如只有一个投影名称(例如Lambert),没有相关的投影参数:中央经度,标准纬度等等. ...

  2. MeteoInfoLab脚本示例:读取文本文件绘制散度图

    MeteoInfoLab中读取文本文件数据的函数是asciiread,获取文本文件行.列数的函数是numasciirow和numasciicol,和NCL中函数名一致,但都是小写字母.本例中的示例数据 ...

  3. MeteoInfoLab脚本示例:站点填图

    打开包含站点填图的站点数据文件(比如micaps 1)之后,用文件对象的smodeldata函数获取StationModel数据对象,然后用stationmodel函数绘制站点填图图层.脚本程序: # ...

  4. MeteoInfoLab脚本示例:AMSR-E卫星数据投影

    AMSR-E(http://nsidc.org/data/amsre/index.html)数据中的Land3数据是HDF-EOS4格式,投影是Cylindrical_Equal_Area.这里示例读 ...

  5. MeteoInfoLab脚本示例:FY-3C全球火点HDF数据

    FY-3C全球火点HDF数据包含一个FIRES二维变量,第一维是火点数,第二维是一些属性,其中第3.4列分别是火点的纬度和经度.下面的脚本示例读出所有火点经纬度并绘图.脚本程序: #Add data ...

  6. MeteoInfoLab脚本示例:闪电位置图

    这个脚本示例读取文本格式的闪电数据,读出每条闪电记录的经纬度和强度,在地图上绘制出每个闪电的位置,并用符号和颜色区分强度正负.数据格式如下:0 2009-06-06 00:01:16.6195722 ...

  7. MeteoInfoLab脚本示例:计算垂直螺旋度

    尝试编写MeteoInfoLab脚本计算垂直螺旋度,结果未经验证. 脚本程序: print 'Open data files...' f_uwnd = addfile('D:/Temp/nc/uwnd ...

  8. MeteoInfoLab脚本示例:站点数据散点图

    这里演示从micaps第一类数据(地面全要素观测)中读取一个变量(用DimDataFile类的stationdata方法),然后maskout掉中国区域之外的数据,利用scatterm函数绘制散点图. ...

  9. MeteoInfoLab脚本示例:AVHRR HDF数据

    这里演示读取和绘制AVHRR hdf格式数据,以sst(海表面温度)为例. 脚本程序: #Add data file f = addfile('D:/Temp/hdf/2006001-2006005. ...

随机推荐

  1. Mybatis动态SQL配置

    使用 if where foreach标签对映射配置文件中sql语句进行动态配置 1.首先在dao接口中设置两个查询方法 package sun.dao; import sun.domain.Quer ...

  2. java 求水仙花数

    package com.yc.bean; public class ShuiXianHua { public static void main(String[] args) { /** * 题目:打印 ...

  3. 通过Xshell实现socket代理访问公司内网

    首先连接上Server,点击查看---隧道窗格 之后点击转移规则--空白处右键,添加 选择Dynamic,之后选择一个本地没有被占用的端口, 确定 浏览器设置 之后就可以访问公司内部的网站了

  4. java面试题2-自己整合的

    1.HashMap的底层实现原理 HashMap是数组+链表组成的实现了Map.Cloneable.Serializable接口,继承了AbstractMap类 HashMap是否线程安全? Hash ...

  5. python-字符串,字典,列表

    0x01 字符串 python单双引号都可以 str = "hello world" str_test = "yicunyiye" print(str,str_ ...

  6. [LCTF]bestphp's revenge 给我的启发学习

    bestphp's revenge flag.php: only localhost can get flag!sessionstart(); echo 'only localhost can get ...

  7. python ---倒酒!!

    #!/usr/bin/env python3# -*- coding: utf-8 -*-import numbersimport numpyimport math'''三个容器分别为12升.8升.5 ...

  8. Python-通过实例方法调用-统一接口的实现-getter methodcaller

    某项目中,我们的代码使用的2个不同库中的图形类: Circle,Triangle 这两个类中都有一个获取面积的方法接口,但是接口的名字不一样 统一这些接口,不关心具体的接口,只要我调用统一的接口,对应 ...

  9. selenium3介绍

    1.  简介 Selenium是用于测试 Web应用程序用户界面 (UI)的常用框架.它是一款用于运行端到端功能测试的超强工具.您可以使用多个编程语言编写测试,并且 Selenium能够在一个或多个浏 ...

  10. 理解RESTful:理论与最佳实践

    什么是 REST 什么是 RESTful Richardson 成熟度模型 RESTful API 设计最佳实践 补充:HTTP 状态码及说明 什么是 REST REST 一词,是由 HTTP 协议的 ...