Issue #1271: Derived fields that return data with incorrect shape should raise errors (yt_analysis/yt)

2 Sep
2016
2 Sep
'16
3 a.m.
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-...
Nathan Goldbaum:
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.
Responsible: ngoldbaum
2646
Age (days ago)
2646
Last active (days ago)
0 comments
1 participants
participants (1)
-
Nathan Goldbaum