On Wed, Oct 1, 2014 at 1:22 PM, Hilary Egan firstname.lastname@example.org wrote:
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:
, 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.
yt-dev mailing list email@example.com http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org