Open matthewturk opened 1 month ago
oops, just merged #4904 and this one automatically closed. but since that PR only covered the simpler case when weight_field is not None, this issue should stay open, ya?
Sure! Or not. I'm ambivalent!
On Wed, May 15, 2024 at 4:05 PM Chris Havlin @.***> wrote:
oops, just merged #4904 https://github.com/yt-project/yt/pull/4904 and this one automatically closed. but since that PR only covered the simpler case when weight_field is not None, this issue should stay open, ya?
— Reply to this email directly, view it on GitHub https://github.com/yt-project/yt/issues/4903#issuecomment-2113454144, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVXOZRKXENTCUALV3NPWDZCPEZLAVCNFSM6AAAAABHYW24OOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJTGQ2TIMJUGQ . You are receiving this because you authored the thread.Message ID: @.***>
Calling
ds.r[:].mean([("gas", "density"), ("gas", "temperature")])
fails, claiming it can't identify the field[("gas", "density"), ("gas", "temperature")]
.This is because it calls
weight_field = sanitize_weight_field(self.ds, field, weight)
, which tries to regardfield
as a single field name.A simple fix, which would only fix in the case of manually specifying the
weight_field
, would be to put thefield_object
assignment inside the conditional for ifweight_field is None
. A slightly better fix would be to have it check that the type is the same for all the specified fields, which would require some "ensure this is a list of field types" or something.