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

Nathan Goldbaum issues-reply at bitbucket.org
Thu Sep 1 18:00:19 PDT 2016


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-data-with

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


More information about the yt-dev mailing list