[yt-dev] Field Parameters Bug

Nathan Goldbaum nathan12343 at gmail.com
Wed Oct 1 13:25:57 PDT 2014


On Wed, Oct 1, 2014 at 1:22 PM, Hilary Egan <hilaryye at gmail.com> wrote:

> Hi all,
>
> I've encountered a bug with this example
> <http://yt-project.org/doc/developing/creating_derived_fields.html#a-more-complicated-example> in
> the docs of getting/setting field parameters of a dataset for use in a
> derived field. The example works fine for known yt field parameters like
> bulk_velocity, but if you change every instance of "bulk_velocity" to
> "my_bulk_velocity" (sample script <http://paste.yt-project.org/show/5142/>),
> then it breaks with this error <http://paste.yt-project.org/show/5140/>.
>
> It seems as though this breaks because `has_field_parameter` always
> returns True
>

Note that this is specifically has_field_parameter as defined in the
field_detector class:

https://bitbucket.org/yt_analysis/yt/src/05de9b2f84be6cc8b933f0af75ac211a57a44d7d/yt/fields/field_detector.py?at=yt#cl-215


> , and there is no way to know ahead of time what units a user-defined
> field parameter will take, so the mock field data can't be set up
> correctly. Nathan suggested via IRC that this might necessitate creating a
> way to register user-defined field parameters, but it's probably worth
> brain-storming about if anyone else has any other suggestions!
>

The main issue with the way field parameters work right now is that we
can't know the units ahead of time for user-defined field parameters. We
could either have a field parameter registry where users would encode that
before loading their data, or we could temporarily disable the unit system
during field detection, which I am loathe to do since it will cause bugs.


>
> -Hilary
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20141001/b635f861/attachment.html>


More information about the yt-dev mailing list