New issue 1271: Derived fields that return data with incorrect shape should raise errors https://bitbucket.org/yt_analysis/yt/issues/1271/derived-fields-that-return-...
Here's a test script that illustrates the problem:
import numpy as np import yt @yt.derived_field(name='wrong_field', units='') def wrong_field(field, data): return np.array([1, 2, 3]) ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030') ad = ds.all_data() ad['wrong_field']
On my machine, this prints:
YTArray([1, 2, 3]) (dimensionless)
The fact that this works without erroring out right now leads to broknness later and user confusion. See Issue #1270.