我坚持使用简单的netCDF4示例。
import numpy as np
from netCDF4 import Dataset
argo_file = Dataset('R20130811_prof.nc', 'r')
n_prof = len(argo_file.dimensions["N_PROF"])
platform_numbers = argo_file.variables["PLATFORM_NUMBER"]
for profile_idx in range(0, n_prof):
print platform_numbers[profile_idx]
运行它时出现以下错误:
$python netcdf4_ex.py
Traceback (most recent call last):
File "netcdf4_ex.py", line 9, in <module>
print platform_numbers[profile_idx]
File "netCDF4.pyx", line 2780, in netCDF4.Variable.__getitem__ (netCDF4.c:34558)
File "netCDF4.pyx", line 2819, in netCDF4.Variable._toma (netCDF4.c:35257)
TypeError: Not implemented for this type
代码段取自现有的生产代码,因此不会出错。这个问题应该与我的netcdf4安装有关。
我在Mac OsX上运行:
任何提示在哪里寻找解决方案?