<div dir="ltr">Hi all:<br><br>I am having trouble creating a gradient field in yt3. What I want is the gradient of logP, where logP is defined as:<br><br>@derived_field(name="logP",units="")<br>def _logP(field,data):<br>    return numpy.log(numpy.array(data["gas","pressure"]))<br><br>Then I add the gradient field:<br><br>pf.add_gradient_fields(("gas","logP"))<br><br>which seems to work and I can find it in pf.derived_field_list.<br><br>But if I try to use it, I get this error message:<br>yt.units.unit_object.UnitParseError: Cannot parse for unit data from '()'. Please supply an expression of only Unit, Symbol, Pow, and Mulobjects.<br><br>Is this because logP does not have a unit? <br><br>Also, I had another unrelated question about the gradient fields: <br>Can I add the gradient fields globally instead of to a specific dataset? <br><br><br>Thanks!<br>Yuan</div>