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

I've encountered a bug with this 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), then it breaks with this error

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@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org