In [ ]:
from __future__ import print_function
import yt
import yt.units as u
import numpy as np

1. Load up the Enzo dataset `"DD0046/DD0046"` from the `"data"` directory, and create a sphere of 1.0 Mpc centered on the maximum density, using the `"max"` shorthand.


In [ ]:

2. Query the `"velocity_x"` field from the sphere and convert it to units of miles per hour, `"mile/hr"`


In [ ]:

3. Use the `"cell_mass"` and `"velocity_y"` fields to generate the kinetic energy of the y-component of velocity assuming $KE_y = \frac{1}{2}mv_y^2$. Print it in units of `"erg"`, `"J"`, `"keV"`, and `"ft*lbf"`.


In [ ]:

4. Use the `weighted_average_quantity` derived quantity to generate a weighted average of the temperature field `"kT"` where the weight is the field `"cell_mass"`.


In [ ]: