爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4831|回复: 3

MeteoInfoLab脚本示例:读远程HDF文件

[复制链接]

新浪微博达人勋

发表于 2016-1-16 20:20:58 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
示例一个读取OPeNDAP server上的远程HDF文件的例子,和本地文件的操作类似。

  1. fn = 'https://eosdap.hdfgroup.org:8080/opendap/data/NASAFILES/hdf5/OMI-Aura_L3-OMTO3d_2009m0102_v003-2009m0602t151018.he5'
  2. f = addfile(fn)
  3. vname = 'RadiativeCloudFraction'
  4. data = f[vname][:,:]
  5. #Plot
  6. axesm()
  7. mlayer = shaperead('D:/Temp/map/country1.shp')
  8. geoshow(mlayer)
  9. layer = imshowm(data, 20)
  10. colorbar(layer, orientation='horizontal')
  11. title(vname)


read_remote_2.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-4-8 17:18:33 | 显示全部楼层
老师,如果用的是ftp的数据应该怎么调用呢?比如ICARE网站上提供的数据网址是ftp://ftp.icare.univ-lille1.fr/SPACEBORNE/CALIOP/CAL_LID_L1.v4.10/2007/2007_08_01/***.hdf,这种类型的可以远程调用吗?我尝试在ICARE网站上用http的,但是出现很长一段错误。我是这样调用的
# Add file
fn = 'http://www.icare.univ-lille1.fr/archive/?dir=CALIOP/CAL_LID_L1.v4.10/2007/2007_07_15/CAL_LID_L1-Standard-V4-10.2007-07-15T00-14-29ZD.hdf'
f = addfile(fn)
出现的错误提示为
run script...
四月 08, 2018 5:07:38 下午 org.meteoinfo.data.meteodata.netcdf.NetCDFDataInfo readDataInfo
严重: null
java.io.IOException: Server does not support Content-Length
        at ucar.unidata.io.http.HTTPRandomAccessFile.<init>(HTTPRandomAccessFile.java:104)
        at ucar.unidata.io.http.HTTPRandomAccessFile.<init>(HTTPRandomAccessFile.java:69)
        at ucar.nc2.NetcdfFile.getRaf(NetcdfFile.java:536)
        at ucar.nc2.NetcdfFile.open(NetcdfFile.java:421)
        at ucar.nc2.dataset.NetcdfDataset.openOrAcquireFile(NetcdfDataset.java:755)
        at ucar.nc2.dataset.NetcdfDataset.openFile(NetcdfDataset.java:572)
        at org.meteoinfo.data.meteodata.netcdf.NetCDFDataInfo.readDataInfo(NetCDFDataInfo.java:180)
        at org.meteoinfo.data.meteodata.MeteoDataInfo.openNetCDFData(MeteoDataInfo.java:704)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:206)
        at org.python.core.PyObject.__call__(PyObject.java:497)
        at org.python.core.PyObject.__call__(PyObject.java:501)
        at org.python.core.PyMethod.__call__(PyMethod.java:141)
        at mipylib.dataset.midata$py.addfile_nc$7(D:/MyProgram/Java/MeteoInfoDev/MeteoInfoLab/pylib/mipylib/dataset/midata.py:175)
        at mipylib.dataset.midata$py.call_function(D:/MyProgram/Java/MeteoInfoDev/MeteoInfoLab/pylib/mipylib/dataset/midata.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:171)
        at org.python.core.PyBaseCode.call(PyBaseCode.java:154)
        at org.python.core.PyFunction.__call__(PyFunction.java:423)
        at mipylib.dataset.midata$py.addfile$5(D:/MyProgram/Java/MeteoInfoDev/MeteoInfoLab/pylib/mipylib/dataset/midata.py:142)
        at mipylib.dataset.midata$py.call_function(D:/MyProgram/Java/MeteoInfoDev/MeteoInfoLab/pylib/mipylib/dataset/midata.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:171)
        at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
        at org.python.core.PyBaseCode.call(PyBaseCode.java:132)
        at org.python.core.PyFunction.__call__(PyFunction.java:413)
        at org.python.pycode._pyx193.f$0(<iostream>:31)
        at org.python.pycode._pyx193.call_function(<iostream>)
        at org.python.core.PyTableCode.call(PyTableCode.java:171)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1614)
        at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:296)
        at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:291)
        at org.meteoinfo.laboratory.gui.PythonInteractiveInterpreter.execfile(PythonInteractiveInterpreter.java:123)
        at org.meteoinfo.laboratory.gui.ConsoleDockable$1.doInBackground(ConsoleDockable.java:296)
        at org.meteoinfo.laboratory.gui.ConsoleDockable$1.doInBackground(ConsoleDockable.java:272)
        at javax.swing.SwingWorker$1.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at javax.swing.SwingWorker.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

希望老师可以帮我看看,谢谢。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-6-25 14:47:22 | 显示全部楼层
王老师,运行到data = f[vname][:,:]语句,报错信息如下:RadiativeCloudFraction is not a variable name
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\ProgramData\MeteoInfo_2.2\MeteoInfo\pylib\mipylib\dataset\dimdatafile.py", line 45, in __getitem__
    raise ValueError()
ValueError
,问题该怎么解决呢?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-6-25 16:19:29 | 显示全部楼层
guo066600 发表于 2020-6-25 14:47
王老师,运行到data = f[vname][:,:]语句,报错信息如下:RadiativeCloudFraction is not a variable name
...

参考这里:http://www.meteothink.org/docs/m ... /data_tutorial.html
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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