爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
楼主: MeteoInfo

MeteoInfoLab脚本示例:CAPLIPSO数据

[复制链接]

新浪微博达人勋

发表于 2017-10-23 19:05:14 | 显示全部楼层
我想问一下 运行后报错 显示

Traceback (most recent call last):
  File "<string>", line 7, in <module>
NameError: name 'addfile' is not defined


这个是程序
# Add file

fn = ' D:/Temp/hdf/CAL_LID_L1-ValStage1-V3-40.2016-12-06T05-47-20ZD.hdf'

# Read data
f = addfile('D:/Temp/hdf/' + fn)
vname = 'Total_Attenuated_Backscatter_532'

var = f[vname]

data = var[:1000,:]

data = rot90(data)

lats = f['latitude'][:1000,0]

latstrs = []

for lat in lats:

    latstrs.append('%.1f' % lat)

height = f['metadata'][None]

m = height.findMember('Lidar_Data_Altitudes')

h = array(height.getArray(0, m))

h = h[::-1]

hstrs = []

for hh in h:

    hstrs.append('%.1f' % hh)


# Plot

levs = [0.0001,0.0002,0.0003,0.0004,0.0005,0.0006,0.0007,0.0008,0.0009,\

    0.001,0.0015,0.002,0.0025,0.003,0.0035,0.004,0.0045,0.005,0.0055,0.006,\

    0.0065,0.007,0.0075,0.008,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,01]

layer = imshow(data, levs, cmap='MPL_terrain')

xticks(data.dimvalue(1), latstrs)

yticks(data.dimvalue(0), hstrs)

xlabel('Latitude')

ylabel('Altitude (km)')

colorbar(layer, label=r'$\rm{km}^{-1}$ \rm{sr}$^{-1}')

basename = os.path.basename(fn)

title('{0}\n{1}'.format(basename, vname))
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-10-23 21:21:26 | 显示全部楼层
python  的 ccplot 库专门针对这个啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-10-23 22:17:23 | 显示全部楼层
sun92 发表于 2017-10-23 19:05
我想问一下 运行后报错 显示

Traceback (most recent call last):

脚本要在MeteoInfoLab中运行,参考此贴:http://bbs.06climate.com/forum.p ... &extra=page%3D1
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-10-24 15:10:52 | 显示全部楼层
MeteoInfo 发表于 2017-10-23 22:17
脚本要在MeteoInfoLab中运行,参考此贴:http://bbs.06climate.com/forum.php?mod=viewthread&tid=36151& ...

哥哥  你用的软件是哪个啊?
MeteoInfo Desktop Application
Java edition (Major development)
MeteoInfo 1.4.6R14 - Java (for all systems)
C# edition
MeteoInfo 1.1.3.5 - C#
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-10-24 15:23:34 | 显示全部楼层
sun92 发表于 2017-10-24 15:10
哥哥  你用的软件是哪个啊?
MeteoInfo Desktop Application
Java edition (Major development)

Java版本
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-10-24 17:18:14 | 显示全部楼层
哥哥好   我在java版本中运行了  提示报错
这个是脚本  提示报错行是标黑这一行
第一次接触这个软件
完全没有头绪
真的看了好多帖子
但还是不会改
请哥哥帮帮我
谢谢您
# Add file
folder = 'D:/Temp/hdf/'
fns = 'CAL_LID_L1-ValStage1-V3-40.2016-12-06T05-47-20ZD.hdf'
fn = folder + fns
# Read data
f = addfile(fn)
vname = 'Total_Attenuated_Backscatter_532'
var = f[vname]
data = var[:1000,:]
data = rot90(data)
lats = f['latitude'][:1000,0]
latstrs = []
for lat in lats:
    latstrs.append('%.1f' % lat)
height = f['metadata'][None]
m = height.findMember('Lidar_Data_Altitudes')
h = array(height.getArray(0, m))
h = h[::-1]
hstrs = []
for hh in h:
    hstrs.append('%.1f' % hh)
# Plot
levs = [0.0001,0.0002,0.0003,0.0004,0.0005,0.0006,0.0007,0.0008,0.0009,\
    0.001,0.0015,0.002,0.0025,0.003,0.0035,0.004,0.0045,0.005,0.0055,0.006,\
    0.0065,0.007,0.0075,0.008,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,01]
layer = imshow(data, levs, cmap='MPL_terrain')
xticks(data.dimvalue(1), latstrs)
yticks(data.dimvalue(0), hstrs)
xlabel('Latitude')
ylabel('Altitude (km)')
colorbar(layer, label=r'$\rm{km}^{-1}$ \rm{sr}$^{-1}')
basename = os.path.basename(fn)
title('{0}\n{1}'.format(basename, vname))


这个是报错的
latitude is not a variable name
Traceback (most recent call last):
  File "<iostream>", line 11, in <module>
  File "D:\Temp\hdf\MeteoInfo_1.4.6R14\MeteoInfo\pylib\mipylib\dataset\dimdatafile.py", line 45, in __getitem__
    raise ValueError()
ValueError

这个是看了帖子后运行的
>>> data.dims
[Name: fakeDim41
Min value: 104.0
Max value: 105.0
Size: 2
Delta: 1.0, Name: fakeDim40
Min value: 28.0
Max value: 29.0
Size: 2
Delta: 1.0]

我真的不会改 尝试很多次都改不出来
我就是想横坐标显示 28° 到 29°
竖坐标 显示 0到5km高度

应该怎么改啊
您教教我
拜托您了
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-10-24 19:11:53 | 显示全部楼层
[/img]哥哥   图片显示出来了  我改好了
但有个问题 数据显示 28-29
出图后却是  -64 到 -64
>>> data.dims
[Name: fakeDim41
Min value: 104.0
Max value: 105.0
Size: 2
Delta: 1.0, Name: fakeDim40
Min value: 28.0
Max value: 29.0
Size: 2
Delta: 1.0]

我就是想横坐标显示 28° 到 29°
竖坐标 显示 0到5km高度

应该怎么改啊
您教教我
拜托您了
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-10-24 20:00:45 | 显示全部楼层
sun92 发表于 2017-10-24 19:11
[/img]哥哥   图片显示出来了  我改好了
但有个问题 数据显示 28-29
出图后却是  -64 到 -64

参考这里:http://www.meteothinker.com/exam ... ellite/calipso.html
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-10-28 12:13:47 | 显示全部楼层
MeteoInfo 发表于 2017-10-24 20:00
参考这里:http://www.meteothinker.com/examples/meteoinfolab/satellite/calipso.html

老师您好  我参考了这个资料,可我依然改不出来横坐标的数值,我用的v3-40的2017年的数据,'CAL_LID_L1-ValStage1-V3-40.2016-12-06T05-47-20ZD.hdf'
不知道应该怎么改了,整个周末我都在尝试
>>> data.dims
[Name: fakeDim41
Min value: 104.0
Max value: 105.0
Size: 2
Delta: 1.0, Name: fakeDim40
Min value: 28.0
Max value: 29.0
Size: 2
Delta: 1.0]
我就是想横坐标显示 28° 到 29°
竖坐标 显示 0到5km高度

这个是数据,麻烦老师帮我看一下
链接:http://pan.baidu.com/s/1jHVw4aM 密码:4q68
链接:http://pan.baidu.com/s/1c2jfWkC 密码:ubvf
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-11-1 10:18:46 来自手机 | 显示全部楼层
谢谢楼主分享~
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表