我正在尝试创建一个等高线图,显示从 1860 年到 1900 年的年度溶解铁浓度,并尝试排除高于一定量(0.000012)的所有值,因为这些值与我的数据丢失的特定区域有关。
下面是我正在使用的脚本,每个单独的部分都有效(在此之前我当然已经导入了所有相关模块)。
dissolved_iron = iris.load_cube('/home/em379/data/dis2/regriddedfiles/HadGEM2-ES_dfe_piControl_r1i1p1_regridded.nc')
dissolved_iron_timeslice = dissolved_iron.extract(iris.Constraint(time = lambda v: 1860 <= v <= 1900))
masked_dissolved_iron_timeslice = ma.masked_greater(dissolved_iron_timeslice.data, 0.000012)
qplt.contourf(masked_dissolved_iron_timeslice,25)
plt.show(block = False)
当我到达 stepqplt.contourf(masked_dissolved_iron_timeslice,25)
时,Python 返回错误:
AttributeError: 'numpy.ndarray' object has no attribute 'dim_coords':
>>> qplt.contourf(masked_dissolved_iron_timeslice,25)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/Iris-1.7.0_dev-py2.7.egg/iris/quickplot.py", line 184, in contourf
result = iplt.contourf(cube, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Iris-1.7.0_dev-py2.7.egg/iris/plot.py", line 579, in contourf
result = _draw_2d_from_points('contourf', None, cube, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Iris-1.7.0_dev-py2.7.egg/iris/plot.py", line 275, in _draw_2d_from_points
plot_defn = _get_plot_defn(cube, mode, ndims=2)
File "/usr/local/lib/python2.7/dist-packages/Iris-1.7.0_dev-py2.7.egg/iris/plot.py", line 127, in _get_plot_defn
for dim_coord in cube.dim_coords:
AttributeError: 'MaskedArray' object has no attribute 'dim_coords'