【问题标题】:Getting python xarray to work on windows让 python xarray 在 Windows 上工作
【发布时间】:2017-08-31 08:16:51
【问题描述】:

我正在尝试在 windows 上使用 python 中的 xarray 打开 hdf4 文件列表(特​​别是 HDF-EOS MOD11 文件):

import xarray, glob

files = glob.glob(r'E:\data\*.hdf')
dates = [ some_func(f) for f in files] # gives a list of datetime objects
ds = xarray.open_mfdataset(files, engine='netcdf4', concat_dim=dates)

但是我得到以下错误:

OSError: NetCDF: 未知文件格式

如果我尝试使用 netcdf4 打开任何文件,我会遇到同样的错误

我正在使用 python 3.52、xarray 0.92 和 netcdf4 1.2.7,它们都是在 windows 7 上使用 64 位 anaconda 安装的

感谢您的帮助!

【问题讨论】:

    标签: python python-xarray


    【解决方案1】:

    通过使用最新版本的 anaconda(4.3.1,Windows 64 位安装程序)重新安装 python,并使用 conda(python=3.6.0,netcdf4=1.2.7)安装包,我能够让 netCDF4 和 xarray 正常工作, xarray=0.9.2)。

    【讨论】:

      【解决方案2】:

      我相信 HDF4 是否与 netCDF4 一起使用取决于 netCDF 库的安装方式,这取决于 Anaconda 如何为 Python 构建 netCDF。您可以尝试在 Python-NetCDF4 bug tracker 上询问或尝试conda-forge conda 频道。

      【讨论】:

        猜你喜欢
        • 2021-07-21
        • 1970-01-01
        • 1970-01-01
        • 2016-09-19
        • 2018-03-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-05
        相关资源
        最近更新 更多