Skip to content

Instantly share code, notes, and snippets.

@ngoldbaum
Created May 27, 2018 17:02
Show Gist options
  • Select an option

  • Save ngoldbaum/4d27987bda8ecbce5c9bd9b98bbbbf49 to your computer and use it in GitHub Desktop.

Select an option

Save ngoldbaum/4d27987bda8ecbce5c9bd9b98bbbbf49 to your computer and use it in GitHub Desktop.
import yt
def NewField(field, data):
q = data[('STAR', 'age')]
print("BBB",data)
return q
ds = yt.load("sizmbhloz-clref04SNth-rs9_a0.9011/sizmbhloz-clref04SNth-rs9_a0.9011.art")
ad = ds.all_data()
print("AAA", ad["STAR", "age"])
ds.add_field(("STAR", "new-field"), function=NewField,
units='auto', dimensions="time", sampling_type="particle")
print("CCC", ad["STAR", "new-field"].to('yr'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment