I am trying to create a contour plot showing annual dissolved iron concentrations for the years to 1860-1900 and am trying to exclude all values above a certain amount (0.000012) because these relate to a specific region which is throwing my data off.
Below is the script I am using, and each individual part works (before this I have of course imported all the relevant modules).
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)
When I get to the step qplt.contourf(masked_dissolved_iron_timeslice,25)
, Python returns the error:
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'