[Yt-dev] Overloading EnzoStaticOutput causing problems with load

Matthew Turk matthewturk at gmail.com
Mon Oct 24 09:21:53 PDT 2011


Hi Dave,

There's probably a way, but I don't know what it is.  Feel free to dig
in and look.  If your debug level were set lower, such that
"load(...)" actually printed information out (instead of, as it looks,
set to something like 50) it would probably track things down.  My
guess is that the subclass allows for multiple candidates to return
true for _is_valid, which leads to an ambiguity, which load uses as a
reason not to return a value.

The kwargs support for load was added to support the use case of
supplying units as well as supplying additional information that is
required for instantiated some parameter files.

-Matt

On Mon, Oct 24, 2011 at 12:15 PM, david collins <antpuncher at gmail.com> wrote:
> Hi, Everybody--
>
> In order to get units to be converted properly for fields that do not
> have units information in the parameter file, I've been subclassing
> EnzoStaticOutput.  However, for some reason this shorts out the load
> function.  For instance merely subclassing EnzoStaticOutput as follows
> causes load to return None, instead of a parameter file.  This changed
> some time ago, but I've been ignoring it.  Is there a way I can
> continue subclassing the EnzoStaticOutput, so I have more control over
> my units and not lose the load function?
>
> Thanks,
> d.
>
>
> from yt.mods import *
> class FileStaticOutputFourPi(EnzoStaticOutput):
>    def __init__(self,*args,**kwargs):
>        fpi = na.sqrt(4*na.pi)
>        EnzoStaticOutput.__init__(self,*args,conversion_override={'Density': 1,
>                                                       'DivB': 1,
>                                                       'x-velocity': 1,
>                                                       'Total_Energy': 1},
>                                  parameter_override={'LengthUnits':
> 1,'LengthUnit': 1,
>                                                      'Time': 1},
>                                  **kwargs)
>
>>>> pf = load(path)
>>>> print pf
> None
> --
> Sent from my computer.
> _______________________________________________
> Yt-dev mailing list
> Yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>



More information about the yt-dev mailing list