[yt-svn] commit/yt: 19 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Sep 27 22:42:59 PDT 2016


19 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/d8dcc8339b23/
Changeset:   d8dcc8339b23
Branch:      yt
User:        al007
Date:        2016-09-19 19:54:45+00:00
Summary:     Make sampler_type required for built-in derived fields.
Affected #:  19 files

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -1043,7 +1043,7 @@
         self._quan = functools.partial(YTQuantity, registry=self.unit_registry)
         return self._quan
 
-    def add_field(self, name, function=None, **kwargs):
+    def add_field(self, name, sampling_type="cell", function=None, **kwargs):
         """
         Dataset-specific call to add_field
 
@@ -1081,7 +1081,7 @@
         if not override and name in self.field_info:
             mylog.warning("Field %s already exists. To override use " +
                           "force_override=True.", name)
-        self.field_info.add_field(name, function=function, **kwargs)
+        self.field_info.add_field(name, sampling_type, function=function, **kwargs)
         self.field_info._show_field_errors.append(name)
         deps, _ = self.field_info.check_derived_fields([name])
         self.field_dependencies.update(deps)

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/angular_momentum.py
--- a/yt/fields/angular_momentum.py
+++ b/yt/fields/angular_momentum.py
@@ -59,15 +59,15 @@
         rv = data.ds.arr(rv, input_units = data["index", "x"].units)
         return xv * rv[...,1] - yv * rv[...,0]
 
-    registry.add_field((ftype, "specific_angular_momentum_x"),
+    registry.add_field((ftype, "specific_angular_momentum_x"), "cell", 
                         function=_specific_angular_momentum_x,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
-    registry.add_field((ftype, "specific_angular_momentum_y"),
+    registry.add_field((ftype, "specific_angular_momentum_y"), "cell", 
                         function=_specific_angular_momentum_y,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
-    registry.add_field((ftype, "specific_angular_momentum_z"),
+    registry.add_field((ftype, "specific_angular_momentum_z"), "cell", 
                         function=_specific_angular_momentum_z,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
@@ -78,7 +78,7 @@
     def _angular_momentum_x(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_x"]
-    registry.add_field((ftype, "angular_momentum_x"),
+    registry.add_field((ftype, "angular_momentum_x"), "cell", 
                        function=_angular_momentum_x,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])
@@ -86,7 +86,7 @@
     def _angular_momentum_y(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_y"]
-    registry.add_field((ftype, "angular_momentum_y"),
+    registry.add_field((ftype, "angular_momentum_y"), "cell", 
                        function=_angular_momentum_y,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])
@@ -94,7 +94,7 @@
     def _angular_momentum_z(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_z"]
-    registry.add_field((ftype, "angular_momentum_z"),
+    registry.add_field((ftype, "angular_momentum_z"), "cell", 
                        function=_angular_momentum_z,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/astro_fields.py
--- a/yt/fields/astro_fields.py
+++ b/yt/fields/astro_fields.py
@@ -52,7 +52,7 @@
         """
         return np.sqrt(3.0 * np.pi / (16.0 * G * data[ftype, "density"]))
 
-    registry.add_field((ftype, "dynamical_time"),
+    registry.add_field((ftype, "dynamical_time"), "cell", 
                        function=_dynamical_time,
                        units=unit_system["time"])
 
@@ -65,7 +65,7 @@
              (data[ftype, "density"]**(-0.5)))
         return u
 
-    registry.add_field((ftype, "jeans_mass"),
+    registry.add_field((ftype, "jeans_mass"), "cell", 
                        function=_jeans_mass,
                        units=unit_system["mass"])
 
@@ -88,7 +88,7 @@
                                     - 1.6667 * logT0**1  - 0.2193 * logT0)),
                            "") # add correct units here
 
-    registry.add_field((ftype, "chandra_emissivity"),
+    registry.add_field((ftype, "chandra_emissivity"), "cell", 
                        function=_chandra_emissivity,
                        units="") # add correct units here
 
@@ -102,7 +102,7 @@
         nenh *= 0.5*(1.+X_H)*X_H*data["cell_volume"]
         return nenh
     
-    registry.add_field((ftype, "emission_measure"),
+    registry.add_field((ftype, "emission_measure"), "cell", 
                        function=_emission_measure,
                        units=unit_system["number_density"])
 
@@ -112,7 +112,7 @@
                            * data[ftype, "temperature"].to_ndarray()**0.5,
                            "") # add correct units here
 
-    registry.add_field((ftype, "xray_emissivity"),
+    registry.add_field((ftype, "xray_emissivity"), "cell", 
                        function=_xray_emissivity,
                        units="") # add correct units here
 
@@ -121,7 +121,7 @@
         # Only useful as a weight_field for temperature, metallicity, velocity
         return data["density"]*data["density"]*data["kT"]**-0.25/mh/mh
 
-    registry.add_field((ftype,"mazzotta_weighting"),
+    registry.add_field((ftype,"mazzotta_weighting"), "cell", 
                        function=_mazzotta_weighting,
                        units="keV**-0.25*cm**-6")
 
@@ -135,7 +135,7 @@
         # See issue #1225
         return -scale * vel * data[ftype, "density"]
 
-    registry.add_field((ftype, "sz_kinetic"),
+    registry.add_field((ftype, "sz_kinetic"), "cell", 
                        function=_sz_kinetic,
                        units=unit_system["length"]**-1,
                        validators=[
@@ -145,6 +145,6 @@
         scale = 0.88 / mh * kboltz / (me * clight*clight) * sigma_thompson
         return scale * data[ftype, "density"] * data[ftype, "temperature"]
 
-    registry.add_field((ftype, "szy"),
+    registry.add_field((ftype, "szy"), "cell", 
                        function=_szy,
                        units=unit_system["length"]**-1)

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/cosmology_fields.py
--- a/yt/fields/cosmology_fields.py
+++ b/yt/fields/cosmology_fields.py
@@ -45,14 +45,14 @@
         return data[ftype, "density"] + \
           data[ftype, "dark_matter_density"]
 
-    registry.add_field((ftype, "matter_density"),
+    registry.add_field((ftype, "matter_density"), "cell", 
                        function=_matter_density,
                        units=unit_system["density"])
 
     def _matter_mass(field, data):
         return data[ftype, "matter_density"] * data["index", "cell_volume"]
 
-    registry.add_field((ftype, "matter_mass"),
+    registry.add_field((ftype, "matter_mass"), "cell", 
                        function=_matter_mass,
                        units=unit_system["mass"])
 
@@ -65,7 +65,7 @@
         return data[ftype, "matter_density"] / \
           co.critical_density(data.ds.current_redshift)
 
-    registry.add_field((ftype, "overdensity"),
+    registry.add_field((ftype, "overdensity"), "cell", 
                        function=_overdensity,
                        units="")
 
@@ -83,7 +83,7 @@
         return data[ftype, "density"] / omega_baryon / co.critical_density(0.0) / \
           (1.0 + data.ds.current_redshift)**3
 
-    registry.add_field((ftype, "baryon_overdensity"),
+    registry.add_field((ftype, "baryon_overdensity"), "cell", 
                        function=_baryon_overdensity,
                        units="",
                        validators=[ValidateParameter("omega_baryon")])
@@ -100,7 +100,7 @@
           co.critical_density(0.0) / \
           (1.0 + data.ds.current_redshift)**3
 
-    registry.add_field((ftype, "matter_overdensity"),
+    registry.add_field((ftype, "matter_overdensity"), "cell", 
                        function=_matter_overdensity,
                        units="")
 
@@ -109,7 +109,7 @@
         virial_radius = data.get_field_parameter("virial_radius")
         return data["radius"] / virial_radius
 
-    registry.add_field(("index", "virial_radius_fraction"),
+    registry.add_field(("index", "virial_radius_fraction"), "cell", 
                        function=_virial_radius_fraction,
                        validators=[ValidateParameter("virial_radius")],
                        units="")
@@ -137,7 +137,7 @@
         return (1.5 * (co.hubble_constant / speed_of_light_cgs)**2 * (dl * dls / ds) * \
           data[ftype, "matter_overdensity"]).in_units("1/cm")
 
-    registry.add_field((ftype, "weak_lensing_convergence"),
+    registry.add_field((ftype, "weak_lensing_convergence"), "cell", 
                        function=_weak_lensing_convergence,
                        units=unit_system["length"]**-1,
         validators=[ValidateParameter("observer_redshift"),

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/derived_field.py
--- a/yt/fields/derived_field.py
+++ b/yt/fields/derived_field.py
@@ -91,8 +91,8 @@
        The dimensions of the field, only needed if units="auto" and only used
        for error checking.
     """
-    def __init__(self, name, function, units=None,
-                 take_log=True, validators=None, sampling_type = "mesh",
+    def __init__(self, name, sampling_type, function, units=None,
+                 take_log=True, validators=None,
                  particle_type=None, vector_field=False, display_field=True,
                  not_in_all=False, display_name=None, output_units=None,
                  dimensions=None, ds=None):

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/field_info_container.py
--- a/yt/fields/field_info_container.py
+++ b/yt/fields/field_info_container.py
@@ -97,9 +97,9 @@
                 output_units = units
             if (ptype, f) not in self.field_list:
                 continue
-            self.add_output_field((ptype, f),
-                units = units, sampling_type = "particle",
-                display_name = dn, output_units = output_units)
+            self.add_output_field((ptype, f), "particle",
+                units = units, display_name = dn, 
+                output_units = output_units)
             for alias in aliases:
                 self.alias((ptype, alias), (ptype, f), units = output_units)
 
@@ -134,9 +134,8 @@
                 raise RuntimeError
             if field[0] not in self.ds.particle_types:
                 continue
-            self.add_output_field(field, 
-                                  units = self.ds.field_units.get(field, ""),
-                                  sampling_type = "particle")
+            self.add_output_field(field, "particle",
+                                  units = self.ds.field_units.get(field, ""))
         self.setup_smoothed_fields(ptype, 
                                    num_neighbors=num_neighbors,
                                    ftype=ftype)
@@ -196,12 +195,12 @@
                 units = ""
             elif units == 1.0:
                 units = ""
-            self.add_output_field(field, units = units,
+            self.add_output_field(field, "cell", units = units,
                                   display_name = display_name)
             for alias in aliases:
                 self.alias(("gas", alias), field)
 
-    def add_field(self, name, function=None, **kwargs):
+    def add_field(self, name, sampling_type, function=None, **kwargs):
         """
         Add a new field, along with supplemental metadata, to the list of
         available fields.  This respects a number of arguments, all of which
@@ -250,12 +249,12 @@
         kwargs.setdefault('ds', self.ds)
         if function is None:
             def create_function(f):
-                self[name] = DerivedField(name, f, **kwargs)
+                self[name] = DerivedField(name, sampling_type, f, **kwargs)
                 return f
             return create_function
 
         if isinstance(name, tuple):
-            self[name] = DerivedField(name, function, **kwargs)
+            self[name] = DerivedField(name, sampling_type, function, **kwargs)
             return
 
         if kwargs.get("particle_type", False):
@@ -265,10 +264,11 @@
 
         if (ftype, name) not in self:
             tuple_name = (ftype, name)
-            self[tuple_name] = DerivedField(tuple_name, function, **kwargs)
+            self[tuple_name] = DerivedField(tuple_name, sampling_type, function,
+                                            **kwargs)
             self.alias(name, tuple_name)
         else:
-            self[name] = DerivedField(name, function, **kwargs)
+            self[name] = DerivedField(name, sampling_type, function, **kwargs)
 
     def load_all_plugins(self, ftype="gas"):
         loaded = []
@@ -296,9 +296,9 @@
         self.ds.derived_field_list = list(sorted(dfl, key=tupleize))
         return loaded, unavailable
 
-    def add_output_field(self, name, **kwargs):
+    def add_output_field(self, name, sampling_type, **kwargs):
         kwargs.setdefault('ds', self.ds)
-        self[name] = DerivedField(name, NullFunc, **kwargs)
+        self[name] = DerivedField(name, sampling_type, NullFunc, **kwargs)
 
     def alias(self, alias_name, original_name, units = None):
         if original_name not in self: return

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/fluid_fields.py
--- a/yt/fields/fluid_fields.py
+++ b/yt/fields/fluid_fields.py
@@ -59,14 +59,14 @@
     def _cell_mass(field, data):
         return data[ftype, "density"] * data[ftype, "cell_volume"]
 
-    registry.add_field((ftype, "cell_mass"),
+    registry.add_field((ftype, "cell_mass"), "cell", 
         function=_cell_mass,
         units=unit_system["mass"])
 
     def _sound_speed(field, data):
         tr = data.ds.gamma * data[ftype, "pressure"] / data[ftype, "density"]
         return np.sqrt(tr)
-    registry.add_field((ftype, "sound_speed"),
+    registry.add_field((ftype, "sound_speed"), "cell", 
              function=_sound_speed,
              units=unit_system["velocity"])
 
@@ -74,7 +74,7 @@
         """ Radial component of M{|v|/c_sound} """
         tr = data[ftype, "radial_velocity"] / data[ftype, "sound_speed"]
         return np.abs(tr)
-    registry.add_field((ftype, "radial_mach_number"),
+    registry.add_field((ftype, "radial_mach_number"), "cell", 
              function=_radial_mach_number,
              units = "")
 
@@ -82,14 +82,14 @@
         return 0.5*data[ftype, "density"] * ( data[ftype, "velocity_x"]**2.0
                                               + data[ftype, "velocity_y"]**2.0
                                               + data[ftype, "velocity_z"]**2.0 )
-    registry.add_field((ftype, "kinetic_energy"),
+    registry.add_field((ftype, "kinetic_energy"), "cell", 
                        function = _kin_energy,
                        units = unit_system["pressure"])
 
     def _mach_number(field, data):
         """ M{|v|/c_sound} """
         return data[ftype, "velocity_magnitude"] / data[ftype, "sound_speed"]
-    registry.add_field((ftype, "mach_number"),
+    registry.add_field((ftype, "mach_number"), "cell", 
             function=_mach_number,
             units = "")
 
@@ -103,7 +103,7 @@
         tr = np.minimum(np.minimum(t1, t2), t3)
         return tr
 
-    registry.add_field((ftype, "courant_time_step"),
+    registry.add_field((ftype, "courant_time_step"), "cell", 
              function=_courant_time_step,
              units=unit_system["time"])
 
@@ -113,13 +113,13 @@
            * (data[ftype, "density"] * data[ftype, "thermal_energy"])
         return tr
 
-    registry.add_field((ftype, "pressure"),
+    registry.add_field((ftype, "pressure"), "cell", 
              function=_pressure,
              units=unit_system["pressure"])
 
     def _kT(field, data):
         return (kboltz*data[ftype, "temperature"]).in_units("keV")
-    registry.add_field((ftype, "kT"),
+    registry.add_field((ftype, "kT"), "cell", 
                        function=_kT,
                        units="keV",
                        display_name="Temperature")
@@ -132,7 +132,7 @@
         gammam1 = 2./3.
         tr = data[ftype,"kT"] / ((data[ftype, "density"]/mw)**gammam1)
         return data.apply_units(tr, field.units)
-    registry.add_field((ftype, "entropy"),
+    registry.add_field((ftype, "entropy"), "cell", 
              units="keV*cm**2",
              function=_entropy)
 
@@ -140,13 +140,13 @@
         tr = data[ftype, "metal_density"] / data[ftype, "density"]
         tr /= metallicity_sun
         return data.apply_units(tr, "Zsun")
-    registry.add_field((ftype, "metallicity"),
+    registry.add_field((ftype, "metallicity"), "cell", 
              function=_metallicity,
              units="Zsun")
 
     def _metal_mass(field, data):
         return data[ftype, "metal_density"] * data[ftype, "cell_volume"]
-    registry.add_field((ftype, "metal_mass"),
+    registry.add_field((ftype, "metal_mass"), "cell", 
                        function=_metal_mass,
                        units=unit_system["mass"])
 
@@ -156,13 +156,13 @@
         for species in data.ds.field_info.species_names:
             field_data += data["gas", "%s_number_density" % species]
         return field_data
-    registry.add_field((ftype, "number_density"),
+    registry.add_field((ftype, "number_density"), "cell", 
                        function = _number_density,
                        units=unit_system["number_density"])
     
     def _mean_molecular_weight(field, data):
         return (data[ftype, "density"] / (mh * data[ftype, "number_density"]))
-    registry.add_field((ftype, "mean_molecular_weight"),
+    registry.add_field((ftype, "mean_molecular_weight"), "cell", 
               function=_mean_molecular_weight,
               units="")
 
@@ -207,7 +207,7 @@
 
     for axi, ax in enumerate('xyz'):
         f = grad_func(axi, ax)
-        registry.add_field((ftype, "%s_gradient_%s" % (fname, ax)),
+        registry.add_field((ftype, "%s_gradient_%s" % (fname, ax)), "cell", 
                            function = f,
                            validators = [ValidateSpatial(1, [grad_field])],
                            units = grad_units)

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/fluid_vector_fields.py
--- a/yt/fields/fluid_vector_fields.py
+++ b/yt/fields/fluid_vector_fields.py
@@ -67,7 +67,7 @@
     bv_validators = [ValidateSpatial(1, [(ftype, "density"), (ftype, "pressure")])]
     for ax in 'xyz':
         n = "baroclinic_vorticity_%s" % ax
-        registry.add_field((ftype, n), function=eval("_%s" % n),
+        registry.add_field((ftype, n), "cell",  function=eval("_%s" % n),
                            validators=bv_validators,
                            units=unit_system["frequency"]**2)
 
@@ -119,7 +119,7 @@
                              (ftype, "velocity_z")])]
     for ax in 'xyz':
         n = "vorticity_%s" % ax
-        registry.add_field((ftype, n),
+        registry.add_field((ftype, n), "cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"],
                            validators=vort_validators)
@@ -138,7 +138,7 @@
         return data[ftype, "velocity_divergence"] * data[ftype, "vorticity_z"]
     for ax in 'xyz':
         n = "vorticity_stretching_%s" % ax
-        registry.add_field((ftype, n), 
+        registry.add_field((ftype, n), "cell",  
                            function=eval("_%s" % n),
                            units = unit_system["frequency"]**2,
                            validators=vort_validators)
@@ -159,7 +159,7 @@
           data[ftype, "baroclinic_vorticity_z"]
     for ax in 'xyz':
         n = "vorticity_growth_%s" % ax
-        registry.add_field((ftype, n),
+        registry.add_field((ftype, n), "cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vort_validators)
@@ -175,7 +175,7 @@
         result = np.sign(dot) * result
         return result
     
-    registry.add_field((ftype, "vorticity_growth_magnitude"),
+    registry.add_field((ftype, "vorticity_growth_magnitude"), "cell", 
               function=_vorticity_growth_magnitude,
               units=unit_system["frequency"]**2,
               validators=vort_validators,
@@ -186,7 +186,7 @@
                        data[ftype, "vorticity_growth_y"]**2 +
                        data[ftype, "vorticity_growth_z"]**2)
     
-    registry.add_field((ftype, "vorticity_growth_magnitude_absolute"),
+    registry.add_field((ftype, "vorticity_growth_magnitude_absolute"), "cell", 
                        function=_vorticity_growth_magnitude_absolute,
                        units=unit_system["frequency"]**2,
                        validators=vort_validators)
@@ -197,7 +197,7 @@
         domegaz_dt = data[ftype, "vorticity_z"] / data[ftype, "vorticity_growth_z"]
         return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
     
-    registry.add_field((ftype, "vorticity_growth_timescale"),
+    registry.add_field((ftype, "vorticity_growth_timescale"), "cell", 
                        function=_vorticity_growth_timescale,
                        units=unit_system["time"],
                        validators=vort_validators)
@@ -232,7 +232,7 @@
                              (ftype, "radiation_acceleration_z")])]
     for ax in 'xyz':
         n = "vorticity_radiation_pressure_%s" % ax
-        registry.add_field((ftype, n),
+        registry.add_field((ftype, n), "cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vrp_validators)
@@ -257,7 +257,7 @@
                
     for ax in 'xyz':
         n = "vorticity_radiation_pressure_growth_%s" % ax
-        registry.add_field((ftype, n),
+        registry.add_field((ftype, n), "cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vrp_validators)
@@ -273,7 +273,7 @@
         result = np.sign(dot) * result
         return result
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude"),
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude"), "cell", 
                        function=_vorticity_radiation_pressure_growth_magnitude,
                        units=unit_system["frequency"]**2,
                        validators=vrp_validators,
@@ -284,7 +284,7 @@
                        data[ftype, "vorticity_radiation_pressure_growth_y"]**2 +
                        data[ftype, "vorticity_radiation_pressure_growth_z"]**2)
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude_absolute"),
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude_absolute"), "cell", 
                        function=_vorticity_radiation_pressure_growth_magnitude_absolute,
                        units="s**(-2)",
                        validators=vrp_validators)
@@ -298,7 +298,7 @@
           data[ftype, "vorticity_radiation_pressure_growth_z"]
         return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_timescale"),
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_timescale"), "cell", 
                        function=_vorticity_radiation_pressure_growth_timescale,
                        units=unit_system["time"],
                        validators=vrp_validators)
@@ -344,7 +344,7 @@
         new_field[sl_center, sl_center, sl_center] = f
         return new_field
     
-    registry.add_field((ftype, "shear"),
+    registry.add_field((ftype, "shear"), "cell", 
                        function=_shear,
                        validators=[ValidateSpatial(1,
                         [(ftype, "velocity_x"),
@@ -361,7 +361,7 @@
         
         return data[ftype, "shear"] / data[ftype, "sound_speed"]
 
-    registry.add_field((ftype, "shear_criterion"),
+    registry.add_field((ftype, "shear_criterion"), "cell", 
                        function=_shear_criterion,
                        units=unit_system["length"]**-1,
                        validators=[ValidateSpatial(1,
@@ -417,7 +417,7 @@
         new_field[sl_center, sl_center, sl_center] = f
         return new_field
     
-    registry.add_field((ftype, "shear_mach"),
+    registry.add_field((ftype, "shear_mach"), "cell", 
                        function=_shear_mach,
                        units="",
                        validators=[ValidateSpatial(1,

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/geometric_fields.py
--- a/yt/fields/geometric_fields.py
+++ b/yt/fields/geometric_fields.py
@@ -46,7 +46,7 @@
         """
         return get_radius(data, "")
 
-    registry.add_field(("index", "radius"),
+    registry.add_field(("index", "radius"), "cell", 
                        function=_radius,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -59,7 +59,7 @@
             return data._reshape_vals(arr)
         return arr
 
-    registry.add_field(("index", "grid_level"),
+    registry.add_field(("index", "grid_level"), "cell", 
                        function=_grid_level,
                        units="",
                        validators=[ValidateSpatial(0)])
@@ -76,7 +76,7 @@
             return data._reshape_vals(arr)
         return arr
 
-    registry.add_field(("index", "grid_indices"),
+    registry.add_field(("index", "grid_indices"), "cell", 
                        function=_grid_indices,
                        units="",
                        validators=[ValidateSpatial(0)],
@@ -87,7 +87,7 @@
         return np.ones(data["index", "ones"].shape,
                        dtype="float64")/data["index", "dx"]
 
-    registry.add_field(("index", "ones_over_dx"),
+    registry.add_field(("index", "ones_over_dx"), "cell", 
                        function=_ones_over_dx,
                        units=unit_system["length"]**-1,
                        display_field=False)
@@ -97,7 +97,7 @@
         arr = np.zeros(data["index", "ones"].shape, dtype='float64')
         return data.apply_units(arr, field.units)
 
-    registry.add_field(("index", "zeros"),
+    registry.add_field(("index", "zeros"), "cell", 
                        function=_zeros,
                        units="",
                        display_field=False)
@@ -109,7 +109,7 @@
             return data._reshape_vals(arr)
         return data.apply_units(arr, field.units)
 
-    registry.add_field(("index", "ones"),
+    registry.add_field(("index", "ones"), "cell", 
                        function=_ones,
                        units="",
                        display_field=False)
@@ -132,7 +132,7 @@
                                 data["index", "z"].ravel(), LE, RE)
         morton.shape = data["index", "x"].shape
         return morton.view("f8")
-    registry.add_field(("index", "morton_index"), function=_morton_index,
+    registry.add_field(("index", "morton_index"), "cell",  function=_morton_index,
                        units = "")
         
     def _spherical_radius(field, data):
@@ -144,7 +144,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_sph_r(coords), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "spherical_radius"),
+    registry.add_field(("index", "spherical_radius"), "cell", 
                        function=_spherical_radius,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -153,7 +153,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data['index', 'spherical_radius']
 
-    registry.add_field(("index", "spherical_r"),
+    registry.add_field(("index", "spherical_r"), "cell", 
                        function=_spherical_r,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -171,7 +171,7 @@
         coords = get_periodic_rvec(data)
         return get_sph_theta(coords, normal)
 
-    registry.add_field(("index", "spherical_theta"),
+    registry.add_field(("index", "spherical_theta"), "cell", 
                        function=_spherical_theta,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -190,7 +190,7 @@
         coords = get_periodic_rvec(data)
         return get_sph_phi(coords, normal)
 
-    registry.add_field(("index", "spherical_phi"),
+    registry.add_field(("index", "spherical_phi"), "cell", 
                        function=_spherical_phi,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -206,7 +206,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_cyl_r(coords, normal), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "cylindrical_radius"),
+    registry.add_field(("index", "cylindrical_radius"), "cell", 
                        function=_cylindrical_radius,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -216,7 +216,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data['index', 'cylindrical_radius']
 
-    registry.add_field(("index", "cylindrical_r"),
+    registry.add_field(("index", "cylindrical_r"), "cell", 
                        function=_cylindrical_r,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -231,7 +231,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_cyl_z(coords, normal), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "cylindrical_z"),
+    registry.add_field(("index", "cylindrical_z"), "cell", 
                        function=_cylindrical_z,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -250,7 +250,7 @@
         coords = get_periodic_rvec(data)
         return get_cyl_theta(coords, normal)
 
-    registry.add_field(("index", "cylindrical_theta"),
+    registry.add_field(("index", "cylindrical_theta"), "cell", 
                        function=_cylindrical_theta,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -260,7 +260,7 @@
         """This field is dprecated and will be removed in a future release"""
         return data["index", "spherical_theta"]
 
-    registry.add_field(("index", "disk_angle"),
+    registry.add_field(("index", "disk_angle"), "cell", 
                        function=_disk_angle,
                        take_log=False,
                        display_field=False,
@@ -272,7 +272,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data["index", "cylindrical_z"]
 
-    registry.add_field(("index", "height"),
+    registry.add_field(("index", "height"), "cell", 
                        function=_height,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/magnetic_field.py
--- a/yt/fields/magnetic_field.py
+++ b/yt/fields/magnetic_field.py
@@ -46,26 +46,26 @@
               data[ftype,"magnetic_field_y"]**2 +
               data[ftype,"magnetic_field_z"]**2)
         return np.sqrt(B2)
-    registry.add_field((ftype,"magnetic_field_strength"),
+    registry.add_field((ftype,"magnetic_field_strength"), "cell", 
                        function=_magnetic_field_strength,
                        units=u)
 
     def _magnetic_energy(field, data):
         B = data[ftype,"magnetic_field_strength"]
         return 0.5*B*B/mag_factors[B.units.dimensions]
-    registry.add_field((ftype, "magnetic_energy"),
+    registry.add_field((ftype, "magnetic_energy"), "cell", 
              function=_magnetic_energy,
              units=unit_system["pressure"])
 
     def _plasma_beta(field,data):
         return data[ftype,'pressure']/data[ftype,'magnetic_energy']
-    registry.add_field((ftype, "plasma_beta"),
+    registry.add_field((ftype, "plasma_beta"), "cell", 
              function=_plasma_beta,
              units="")
 
     def _magnetic_pressure(field,data):
         return data[ftype,'magnetic_energy']
-    registry.add_field((ftype, "magnetic_pressure"),
+    registry.add_field((ftype, "magnetic_pressure"), "cell", 
              function=_magnetic_pressure,
              units=unit_system["pressure"])
 
@@ -83,7 +83,7 @@
 
         return get_sph_theta_component(Bfields, theta, phi, normal)
 
-    registry.add_field((ftype, "magnetic_field_poloidal"),
+    registry.add_field((ftype, "magnetic_field_poloidal"), "cell", 
              function=_magnetic_field_poloidal,
              units=u, validators=[ValidateParameter("normal")])
 
@@ -99,19 +99,19 @@
         phi = data["index", 'spherical_phi']
         return get_sph_phi_component(Bfields, phi, normal)
 
-    registry.add_field((ftype, "magnetic_field_toroidal"),
+    registry.add_field((ftype, "magnetic_field_toroidal"), "cell", 
              function=_magnetic_field_toroidal,
              units=u, validators=[ValidateParameter("normal")])
 
     def _alfven_speed(field,data):
         B = data[ftype,'magnetic_field_strength']
         return B/np.sqrt(mag_factors[B.units.dimensions]*data[ftype,'density'])
-    registry.add_field((ftype, "alfven_speed"), function=_alfven_speed,
+    registry.add_field((ftype, "alfven_speed"), "cell",  function=_alfven_speed,
                        units=unit_system["velocity"])
 
     def _mach_alfven(field,data):
         return data[ftype,'velocity_magnitude']/data[ftype,'alfven_speed']
-    registry.add_field((ftype, "mach_alfven"), function=_mach_alfven,
+    registry.add_field((ftype, "mach_alfven"), "cell",  function=_mach_alfven,
                        units="dimensionless")
 
 def setup_magnetic_field_aliases(registry, ds_ftype, ds_fields, ftype="gas"):
@@ -161,6 +161,6 @@
             return convert(data[fd])
         return _mag_field
     for ax, fd in zip("xyz", ds_fields):
-        registry.add_field((ftype,"magnetic_field_%s" % ax),
+        registry.add_field((ftype,"magnetic_field_%s" % ax), "cell", 
                            function=mag_field(fd),
-                           units=unit_system[to_units.dimensions])
\ No newline at end of file
+                           units=unit_system[to_units.dimensions])

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -103,6 +103,7 @@
         return data.apply_units(d, field.units)
 
     registry.add_field(("deposit", "%s_count" % ptype),
+             "cell",          
              function = particle_count,
              validators = [ValidateSpatial()],
              units = '',
@@ -116,6 +117,7 @@
         return data.apply_units(d, field.units)
 
     registry.add_field(("deposit", "%s_mass" % ptype),
+             "cell",          
              function = particle_mass,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s Mass}" % ptype_dn,
@@ -130,6 +132,7 @@
         return d
 
     registry.add_field(("deposit", "%s_density" % ptype),
+             "cell",          
              function = particle_density,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s Density}" % ptype_dn,
@@ -143,6 +146,7 @@
         return d
 
     registry.add_field(("deposit", "%s_cic" % ptype),
+             "cell",          
              function = particle_cic,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s CIC Density}" % ptype_dn,
@@ -171,7 +175,7 @@
             function = _get_density_weighted_deposit_field(
                 "particle_velocity_%s" % ax, "cm/s", method)
             registry.add_field(
-                ("deposit", ("%s_"+name+"_velocity_%s") % (ptype, ax)),
+                ("deposit", ("%s_"+name+"_velocity_%s") % (ptype, ax)), "cell",
                 function=function, units=unit_system["velocity"], take_log=False,
                 validators=[ValidateSpatial(0)])
 
@@ -179,7 +183,7 @@
         function = _get_density_weighted_deposit_field(
             "age", "s", method)
         registry.add_field(
-            ("deposit", ("%s_"+name+"_age") % (ptype)),
+            ("deposit", ("%s_"+name+"_age") % (ptype)), "cell",
             function=function, units=unit_system["time"], take_log=False,
             validators=[ValidateSpatial(0)])
 
@@ -190,8 +194,8 @@
         return data.apply_units(v, field.units)
 
     registry.add_field((ptype, "particle_ones"),
+                       "particle",
                        function = particle_ones,
-                       sampling_type = "particle",
                        units = "",
                        display_name = r"Particle Count")
 
@@ -204,10 +208,10 @@
         data.deposit(pos, [ids], method = "mesh_id")
         return data.apply_units(ids, "")
     registry.add_field((ptype, "mesh_id"),
+            "particle",           
             function = particle_mesh_ids,
             validators = [ValidateSpatial()],
-            units = '',
-            sampling_type = "particle")
+            units = '')
 
     return list(set(registry.keys()).difference(orig))
 
@@ -228,11 +232,9 @@
     for axi, ax in enumerate("xyz"):
         v, p = _get_coord_funcs(axi, ptype)
         registry.add_field((ptype, "particle_velocity_%s" % ax),
-            sampling_type = "particle", function = v,
-            units = "code_velocity")
+            "particle", function = v, units = "code_velocity")
         registry.add_field((ptype, "particle_position_%s" % ax),
-            sampling_type = "particle", function = p,
-            units = "code_length")
+            "particle", function = p, units = "code_length")
 
 def particle_vector_functions(ptype, coord_names, vel_names, registry):
 
@@ -248,13 +250,13 @@
             return data.apply_units(c, field.units)
         return particle_vectors
     registry.add_field((ptype, "particle_position"),
+                       "particle",
                        function=_get_vec_func(ptype, coord_names),
-                       units = "code_length",
-                       particle_type=True)
+                       units = "code_length")
     registry.add_field((ptype, "particle_velocity"),
+                       "particle",
                        function=_get_vec_func(ptype, vel_names),
-                       units = unit_system["velocity"],
-                       particle_type=True)
+                       units = unit_system["velocity"])
 
 def get_angular_momentum_components(ptype, data, spos, svel):
     if data.has_field_parameter("normal"):
@@ -282,8 +284,8 @@
                      + (data[ptype, svel % 'z'] - bulk_velocity[2])**2 )
 
     registry.add_field((ptype, "particle_velocity_magnitude"),
+                  "particle",
                   function=_particle_velocity_magnitude,
-                  particle_type=True,
                   take_log=False,
                   units=unit_system["velocity"])
 
@@ -301,8 +303,8 @@
 
 
     registry.add_field((ptype, "particle_specific_angular_momentum"),
+              "particle",
               function=_particle_specific_angular_momentum,
-              particle_type=True,
               units=unit_system["specific_angular_momentum"],
               validators=[ValidateParameter("center")])
 
@@ -322,7 +324,7 @@
             validators=[ValidateParameter("center")]
         )
         registry.add_field((ptype, "particle_angular_momentum_%s" % ax),
-            function=v, units=unit_system["angular_momentum"], particle_type=True,
+            "particle", function=v, units=unit_system["angular_momentum"],
             validators=[ValidateParameter('center')])
 
     def _particle_angular_momentum(field, data):
@@ -330,8 +332,8 @@
         return am.T
 
     registry.add_field((ptype, "particle_angular_momentum"),
+              "particle",
               function=_particle_angular_momentum,
-              particle_type=True,
               units=unit_system["angular_momentum"],
               validators=[ValidateParameter("center")])
 
@@ -349,9 +351,9 @@
 
     registry.add_field(
         (ptype, "particle_radius"),
+        "particle",
         function=_particle_radius,
         units=unit_system["length"],
-        particle_type=True,
         validators=[ValidateParameter("center")])
 
     def _particle_position_relative(field, data):
@@ -370,8 +372,8 @@
 
     registry.add_field(
         (ptype, "particle_position_relative"),
+        "particle",
         function=_particle_position_relative,
-        particle_type=True,
         units=unit_system["length"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -391,8 +393,9 @@
         return vel
 
     registry.add_field((ptype, "particle_velocity_relative"),
+              "particle",
               function=_particle_velocity_relative,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -406,18 +409,17 @@
     for axi, ax in enumerate("xyz"):
         v, p = _get_coord_funcs_relative(axi, ptype)
         registry.add_field((ptype, "particle_velocity_relative_%s" % ax),
-            sampling_type = "particle", function = v,
-            units = "code_velocity")
+            "particle", function = v, units = "code_velocity")
         registry.add_field((ptype, "particle_position_relative_%s" % ax),
-            sampling_type = "particle", function = p,
-            units = "code_length")
+            "particle", function = p, units = "code_length")
 
 
     # this is just particle radius but we add it with an alias for the sake of
     # consistent naming
     registry.add_field((ptype, "particle_position_spherical_radius"),
+              "particle",
               function=_particle_radius,
-              particle_type=True, units=unit_system["length"],
+              units=unit_system["length"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -426,8 +428,9 @@
         return data[ptype, 'particle_position_spherical_radius']
 
     registry.add_field((ptype, "particle_spherical_position_radius"),
+              "particle",  
               function=_particle_spherical_position_radius,
-              particle_type=True, units=unit_system["length"],
+              units=unit_system["length"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -445,8 +448,8 @@
 
     registry.add_field(
         (ptype, "particle_position_spherical_theta"),
+        "particle",
         function=_particle_position_spherical_theta,
-        particle_type=True,
         units="",
         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
@@ -455,8 +458,9 @@
         return data[ptype, 'particle_position_spherical_theta']
 
     registry.add_field((ptype, "particle_spherical_position_theta"),
+              "particle",
               function=_particle_spherical_position_theta,
-              particle_type=True, units="",
+              units="",
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -474,8 +478,8 @@
 
     registry.add_field(
         (ptype, "particle_position_spherical_phi"),
+        "particle",
         function=_particle_position_spherical_phi,
-        particle_type=True,
         units="",
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -484,8 +488,9 @@
         return data[ptype, 'particle_position_spherical_phi']
 
     registry.add_field((ptype, "particle_spherical_position_phi"),
+             "particle",
              function=_particle_spherical_position_phi,
-             particle_type=True, units="",
+             units="",
              validators=[ValidateParameter("center"),
                          ValidateParameter("normal")])
 
@@ -509,8 +514,9 @@
         return sphr
 
     registry.add_field((ptype, "particle_velocity_spherical_radius"),
+              "particle",
               function=_particle_velocity_spherical_radius,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -519,16 +525,18 @@
         return data[ptype, 'particle_velocity_spherical_radius']
 
     registry.add_field((ptype, "particle_spherical_velocity_radius"),
+              "particle",
               function=_particle_spherical_velocity_radius,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
     # particel_velocity_spherical_radius is simply aliased to
     # "particle_radial_velocity" for convenience
     registry.add_field((ptype, "particle_radial_velocity"),
+              "particle",
               function=_particle_spherical_velocity_radius,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -553,8 +561,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_spherical_theta"),
+        "particle",
         function=_particle_velocity_spherical_theta,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -563,8 +571,9 @@
         return data[ptype, 'particle_velocity_spherical_theta']
 
     registry.add_field((ptype, "particle_spherical_velocity_theta"),
+              "particle",
               function=_particle_spherical_velocity_theta,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -587,8 +596,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_spherical_phi"),
+        "particle",
         function=_particle_velocity_spherical_phi,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -597,8 +606,9 @@
         return data[ptype, 'particle_spherical_velocity_theta']
 
     registry.add_field((ptype, "particle_spherical_velocity_phi"),
+              "particle",
               function=_particle_spherical_velocity_phi,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -617,9 +627,9 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_radius"),
+        "particle",
         function=_particle_position_cylindrical_radius,
         units=unit_system["length"],
-        particle_type=True,
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
     def _particle_position_cylindrical_theta(field,data):
@@ -636,8 +646,8 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_theta"),
+        "particle",
         function=_particle_position_cylindrical_theta,
-        particle_type=True,
         units="",
         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
@@ -656,9 +666,9 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_z"),
+        "particle",
         function=_particle_position_cylindrical_z,
         units=unit_system["length"],
-        particle_type=True,
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
     def _particle_velocity_cylindrical_radius(field, data):
@@ -680,8 +690,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_radius"),
+        "particle",
         function=_particle_velocity_cylindrical_radius,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -704,8 +714,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_theta"),
+        "particle",
         function=_particle_velocity_cylindrical_theta,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -714,8 +724,9 @@
         return data[ptype, 'particle_velocity_cylindrical_theta']
 
     registry.add_field((ptype, "particle_cylindrical_velocity_theta"),
+              "particle",
               function=_particle_cylindrical_velocity_theta,
-              particle_type=True, units="cm/s",
+              units="cm/s",
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -737,8 +748,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_z"),
+        "particle",
         function=_particle_velocity_cylindrical_z,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -747,8 +758,9 @@
         return data[ptype, "particle_velocity_cylindrical_z"]
 
     registry.add_field((ptype, "particle_cylindrical_velocity_z"),
+              "particle",
               function=_particle_cylindrical_velocity_z,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -769,9 +781,8 @@
         v[np.isnan(v)] = 0.0
         return v
     fn = ("deposit", "%s_avg_%s" % (ptype, field_name))
-    registry.add_field(fn, function=_pfunc_avg,
+    registry.add_field(fn, "cell", function=_pfunc_avg,
                        validators = [ValidateSpatial(0)],
-                       particle_type = False,
                        units = field_units)
     return fn
 
@@ -816,7 +827,7 @@
         rv /= hsml.uq**3 / hsml.uq.in_base(unit_system.name).uq**3
         rv = data.apply_units(rv, field_units)
         return rv
-    registry.add_field(field_name, function = _vol_weight,
+    registry.add_field(field_name, "cell", function = _vol_weight,
                        validators = [ValidateSpatial(0)],
                        units = field_units)
     registry.find_dependencies((field_name,))
@@ -833,9 +844,8 @@
                          nneighbors = nneighbors)
         # Now some quick unit conversions.
         return distances
-    registry.add_field(field_name, function = _nth_neighbor,
+    registry.add_field(field_name, "particle", function = _nth_neighbor,
                        validators = [ValidateSpatial(0)],
-                       sampling_type = "particle",
                        units = "code_length")
     return [field_name]
 
@@ -850,6 +860,6 @@
                              for dep_type in data.ds.particle_types_raw])
 
     registry.add_field((ptype, field_name),
+                       "particle",
                        function=_cat_field,
-                       particle_type=True,
                        units=units)

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -75,17 +75,17 @@
     """
     unit_system = registry.ds.unit_system
 
-    registry.add_field((ftype, "%s_fraction" % species), 
+    registry.add_field((ftype, "%s_fraction" % species), "cell",  
                        function = _create_fraction_func(ftype, species),
                        particle_type = particle_type,
                        units = "")
 
-    registry.add_field((ftype, "%s_mass" % species),
+    registry.add_field((ftype, "%s_mass" % species), "cell", 
                        function = _create_mass_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["mass"])
 
-    registry.add_field((ftype, "%s_number_density" % species),
+    registry.add_field((ftype, "%s_number_density" % species), "cell", 
                        function = _create_number_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["number_density"])
@@ -103,17 +103,17 @@
     """
     unit_system = registry.ds.unit_system
 
-    registry.add_field((ftype, "%s_density" % species), 
+    registry.add_field((ftype, "%s_density" % species), "cell",  
                        function = _create_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["density"])
 
-    registry.add_field((ftype, "%s_mass" % species),
+    registry.add_field((ftype, "%s_mass" % species), "cell", 
                        function = _create_mass_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["mass"])
 
-    registry.add_field((ftype, "%s_number_density" % species),
+    registry.add_field((ftype, "%s_number_density" % species), "cell", 
                        function = _create_number_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["number_density"])
@@ -145,13 +145,13 @@
     unit_system = registry.ds.unit_system
     elements = _get_all_elements(registry.species_names)
     for element in elements:
-        registry.add_field((ftype, "%s_nuclei_density" % element),
+        registry.add_field((ftype, "%s_nuclei_density" % element), "cell", 
                            function = _nuclei_density,
                            particle_type = particle_type,
                            units = unit_system["number_density"])
     if len(elements) == 0:
         for element in ["H", "He"]:
-            registry.add_field((ftype, "%s_nuclei_density" % element),
+            registry.add_field((ftype, "%s_nuclei_density" % element), "cell", 
                                function = _default_nuclei_density,
                                particle_type = particle_type,
                                units = unit_system["number_density"])

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/fields/vector_operations.py
--- a/yt/fields/vector_operations.py
+++ b/yt/fields/vector_operations.py
@@ -44,7 +44,7 @@
             mag += data[fn] * data[fn]
         return np.sqrt(mag)
 
-    registry.add_field((ftype, "%s_magnitude" % basename),
+    registry.add_field((ftype, "%s_magnitude" % basename), "cell", 
                        function=_magnitude, units=field_units,
                        validators=validators, particle_type=particle_type)
 
@@ -62,7 +62,7 @@
             squared += data[fn] * data[fn]
         return squared
 
-    registry.add_field((ftype, "%s_squared" % basename),
+    registry.add_field((ftype, "%s_squared" % basename), "cell", 
                        function=_squared, units=field_units,
                        validators=validators, particle_type=particle_type)
 
@@ -110,7 +110,7 @@
         rv[np.isnan(theta)] = 0.0
         return rv
 
-    registry.add_field((ftype, "%s_spherical_radius" % basename),
+    registry.add_field((ftype, "%s_spherical_radius" % basename), "cell", 
                        function=_spherical_radius_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -127,17 +127,17 @@
         return np.sqrt(data[ftype, "%s_magnitude" % basename]**2.0 -
                        data[ftype, "%s_spherical_radius" % basename]**2.0)
 
-    registry.add_field((ftype, "radial_%s" % basename),
+    registry.add_field((ftype, "radial_%s" % basename), "cell", 
                        function=_radial,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
                                    ValidateParameter("center")])
 
-    registry.add_field((ftype, "radial_%s_absolute" % basename),
+    registry.add_field((ftype, "radial_%s_absolute" % basename), "cell", 
                        function=_radial_absolute,
                        units=field_units)
 
-    registry.add_field((ftype, "tangential_%s" % basename),
+    registry.add_field((ftype, "tangential_%s" % basename), "cell", 
                        function=_tangential,
                        units=field_units)
 
@@ -154,7 +154,7 @@
         phi = resize_vector(data["index", "spherical_phi"], vectors)
         return get_sph_theta_component(vectors, theta, phi, normal)
 
-    registry.add_field((ftype, "%s_spherical_theta" % basename),
+    registry.add_field((ftype, "%s_spherical_theta" % basename), "cell", 
                        function=_spherical_theta_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -173,7 +173,7 @@
         phi = resize_vector(data["index", "spherical_phi"], vectors)
         return get_sph_phi_component(vectors, phi, normal)
 
-    registry.add_field((ftype, "%s_spherical_phi" % basename),
+    registry.add_field((ftype, "%s_spherical_phi" % basename), "cell", 
                        function=_spherical_phi_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -192,13 +192,13 @@
             return tr
         return _cp_val
 
-    registry.add_field((ftype, "cutting_plane_%s_x" % basename),
+    registry.add_field((ftype, "cutting_plane_%s_x" % basename), "cell", 
                        function=_cp_vectors('x'),
                        units=field_units)
-    registry.add_field((ftype, "cutting_plane_%s_y" % basename),
+    registry.add_field((ftype, "cutting_plane_%s_y" % basename), "cell", 
                        function=_cp_vectors('y'),
                        units=field_units)
-    registry.add_field((ftype, "cutting_plane_%s_z" % basename),
+    registry.add_field((ftype, "cutting_plane_%s_z" % basename), "cell", 
                        function=_cp_vectors('z'),
                        units=field_units)
 
@@ -223,12 +223,12 @@
     field_units = Unit(field_units, registry=registry.ds.unit_registry)
     div_units = field_units / registry.ds.unit_system["length"]
 
-    registry.add_field((ftype, "%s_divergence" % basename),
+    registry.add_field((ftype, "%s_divergence" % basename), "cell", 
                        function=_divergence,
                        units=div_units,
                        validators=[ValidateSpatial(1)])
     
-    registry.add_field((ftype, "%s_divergence_absolute" % basename),
+    registry.add_field((ftype, "%s_divergence_absolute" % basename), "cell", 
                        function=_divergence_abs,
                        units=div_units)
 
@@ -236,7 +236,7 @@
         tr = data[ftype, "tangential_%s" % basename] / \
              data[ftype, "%s_magnitude" % basename]
         return np.abs(tr)
-    registry.add_field((ftype, "tangential_over_%s_magnitude" % basename),
+    registry.add_field((ftype, "tangential_over_%s_magnitude" % basename), "cell", 
              function=_tangential_over_magnitude,
              take_log=False)
 
@@ -252,7 +252,7 @@
         theta = resize_vector(data["index", 'cylindrical_theta'], vectors)
         return get_cyl_r_component(vectors, theta, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_radius" % basename),
+    registry.add_field((ftype, "%s_cylindrical_radius" % basename), "cell", 
                        function=_cylindrical_radius_component,
                        units=field_units,
                        validators=[ValidateParameter("normal")])
@@ -261,7 +261,7 @@
         """This field is deprecated and will be removed in a future version"""
         return data[ftype, '%s_cylindrical_radius' % basename]
 
-    registry.add_field((ftype, "cylindrical_radial_%s" % basename),
+    registry.add_field((ftype, "cylindrical_radial_%s" % basename), "cell", 
                        function=_cylindrical_radial,
                        units=field_units)
 
@@ -269,7 +269,7 @@
         """This field is deprecated and will be removed in a future version"""
         return np.abs(data[ftype, '%s_cylindrical_radius' % basename])
 
-    registry.add_field((ftype, "cylindrical_radial_%s_absolute" % basename),
+    registry.add_field((ftype, "cylindrical_radial_%s_absolute" % basename), "cell", 
                        function=_cylindrical_radial_absolute,
                        units=field_units,
                        validators=[ValidateParameter("normal")])
@@ -287,7 +287,7 @@
         theta = np.tile(theta, (3,) + (1,)*len(theta.shape))
         return get_cyl_theta_component(vectors, theta, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_theta" % basename),
+    registry.add_field((ftype, "%s_cylindrical_theta" % basename), "cell", 
                        function=_cylindrical_theta_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -302,11 +302,11 @@
         """This field is deprecated and will be removed in a future release"""
         return np.abs(data['cylindrical_tangential_%s' % basename])
 
-    registry.add_field((ftype, "cylindrical_tangential_%s" % basename),
+    registry.add_field((ftype, "cylindrical_tangential_%s" % basename), "cell", 
                        function=_cylindrical_tangential,
                        units=field_units)
 
-    registry.add_field((ftype, "cylindrical_tangential_%s_absolute" % basename),
+    registry.add_field((ftype, "cylindrical_tangential_%s_absolute" % basename), "cell", 
                        function=_cylindrical_tangential_absolute,
                        units=field_units)
 
@@ -320,7 +320,7 @@
         vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
         return get_cyl_z_component(vectors, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_z" % basename),
+    registry.add_field((ftype, "%s_cylindrical_z" % basename), "cell", 
                        function=_cylindrical_z_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -356,7 +356,7 @@
         new_field2[1:-1, 1:-1, 1:-1] = new_field / weight_field
         return new_field2
 
-    registry.add_field((ftype, "averaged_%s" % basename),
+    registry.add_field((ftype, "averaged_%s" % basename), "cell", 
                        function=_averaged_field,
                        units=field_units,
                        validators=validators)

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/frontends/stream/fields.py
--- a/yt/frontends/stream/fields.py
+++ b/yt/frontends/stream/fields.py
@@ -75,10 +75,10 @@
             setup_magnetic_field_aliases
         for field in self.ds.stream_handler.field_units:
             units = self.ds.stream_handler.field_units[field]
-            if units != '': self.add_output_field(field, units=units)
+            if units != '': self.add_output_field(field, "cell", units=units)
         setup_magnetic_field_aliases(self, "stream", ["magnetic_field_%s" % ax for ax in "xyz"])
 
-    def add_output_field(self, name, **kwargs):
+    def add_output_field(self, name, sampling_type, **kwargs):
         if name in self.ds.stream_handler.field_units:
             kwargs['units'] = self.ds.stream_handler.field_units[name]
-        super(StreamFieldInfo, self).add_output_field(name, **kwargs)
+        super(StreamFieldInfo, self).add_output_field(name, sampling_type, **kwargs)

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/geometry/coordinates/cartesian_coordinates.py
--- a/yt/geometry/coordinates/cartesian_coordinates.py
+++ b/yt/geometry/coordinates/cartesian_coordinates.py
@@ -37,17 +37,17 @@
     def setup_fields(self, registry):
         for axi, ax in enumerate(self.axis_order):
             f1, f2 = _get_coord_fields(axi)
-            registry.add_field(("index", "d%s" % ax), function = f1,
+            registry.add_field(("index", "d%s" % ax), "cell",  function = f1,
                                display_field = False,
                                units = "code_length")
-            registry.add_field(("index", "path_element_%s" % ax), function = f1,
+            registry.add_field(("index", "path_element_%s" % ax), "cell",  function = f1,
                                display_field = False,
                                units = "code_length")
-            registry.add_field(("index", "%s" % ax), function = f2,
+            registry.add_field(("index", "%s" % ax), "cell",  function = f2,
                                display_field = False,
                                units = "code_length")
             f3 = _get_vert_fields(axi)
-            registry.add_field(("index", "vertex_%s" % ax), function = f3,
+            registry.add_field(("index", "vertex_%s" % ax), "cell",  function = f3,
                                display_field = False,
                                units = "code_length")
         def _cell_volume(field, data):
@@ -55,7 +55,7 @@
             rv *= data["index", "dy"]
             rv *= data["index", "dz"]
             return rv
-        registry.add_field(("index", "cell_volume"), function=_cell_volume,
+        registry.add_field(("index", "cell_volume"), "cell",  function=_cell_volume,
                            display_field=False, units = "code_length**3")
         registry.check_derived_fields(
             [("index", "dx"), ("index", "dy"), ("index", "dz"),

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/geometry/coordinates/cylindrical_coordinates.py
--- a/yt/geometry/coordinates/cylindrical_coordinates.py
+++ b/yt/geometry/coordinates/cylindrical_coordinates.py
@@ -39,31 +39,31 @@
 
     def setup_fields(self, registry):
         # return the fields for r, z, theta
-        registry.add_field(("index", "dx"), function=_unknown_coord)
-        registry.add_field(("index", "dy"), function=_unknown_coord)
-        registry.add_field(("index", "x"), function=_unknown_coord)
-        registry.add_field(("index", "y"), function=_unknown_coord)
+        registry.add_field(("index", "dx"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "dy"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "x"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "y"), "cell",  function=_unknown_coord)
         f1, f2 = _get_coord_fields(self.axis_id['r'])
-        registry.add_field(("index", "dr"), function = f1,
+        registry.add_field(("index", "dr"), "cell",  function = f1,
                            display_field = False,
                            units = "code_length")
-        registry.add_field(("index", "r"), function = f2,
+        registry.add_field(("index", "r"), "cell",  function = f2,
                            display_field = False,
                            units = "code_length")
 
         f1, f2 = _get_coord_fields(self.axis_id['z'])
-        registry.add_field(("index", "dz"), function = f1,
+        registry.add_field(("index", "dz"), "cell",  function = f1,
                            display_field = False,
                            units = "code_length")
-        registry.add_field(("index", "z"), function = f2,
+        registry.add_field(("index", "z"), "cell",  function = f2,
                            display_field = False,
                            units = "code_length")
 
         f1, f2 = _get_coord_fields(self.axis_id['theta'], "")
-        registry.add_field(("index", "dtheta"), function = f1,
+        registry.add_field(("index", "dtheta"), "cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "theta"), function = f2,
+        registry.add_field(("index", "theta"), "cell",  function = f2,
                            display_field = False,
                            units = "")
 
@@ -72,24 +72,24 @@
                  * data["index", "r"] \
                  * data["index", "dr"] \
                  * data["index", "dz"]
-        registry.add_field(("index", "cell_volume"),
+        registry.add_field(("index", "cell_volume"), "cell", 
                  function=_CylindricalVolume,
                  units = "code_length**3")
 
         def _path_r(field, data):
             return data["index", "dr"]
-        registry.add_field(("index", "path_element_r"),
+        registry.add_field(("index", "path_element_r"), "cell", 
                  function = _path_r,
                  units = "code_length")
         def _path_theta(field, data):
             # Note: this already assumes cell-centered
             return data["index", "r"] * data["index", "dtheta"]
-        registry.add_field(("index", "path_element_theta"),
+        registry.add_field(("index", "path_element_theta"), "cell", 
                  function = _path_theta,
                  units = "code_length")
         def _path_z(field, data):
             return data["index", "dz"]
-        registry.add_field(("index", "path_element_z"),
+        registry.add_field(("index", "path_element_z"), "cell", 
                  function = _path_z,
                  units = "code_length")
 

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/geometry/coordinates/geographic_coordinates.py
--- a/yt/geometry/coordinates/geographic_coordinates.py
+++ b/yt/geometry/coordinates/geographic_coordinates.py
@@ -37,33 +37,33 @@
 
     def setup_fields(self, registry):
         # return the fields for r, z, theta
-        registry.add_field(("index", "dx"), function=_unknown_coord)
-        registry.add_field(("index", "dy"), function=_unknown_coord)
-        registry.add_field(("index", "dz"), function=_unknown_coord)
-        registry.add_field(("index", "x"), function=_unknown_coord)
-        registry.add_field(("index", "y"), function=_unknown_coord)
-        registry.add_field(("index", "z"), function=_unknown_coord)
+        registry.add_field(("index", "dx"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "dy"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "dz"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "x"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "y"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "z"), "cell",  function=_unknown_coord)
         f1, f2 = _get_coord_fields(self.axis_id['latitude'], "")
-        registry.add_field(("index", "dlatitude"), function = f1,
+        registry.add_field(("index", "dlatitude"), "cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "latitude"), function = f2,
+        registry.add_field(("index", "latitude"), "cell",  function = f2,
                            display_field = False,
                            units = "")
 
         f1, f2 = _get_coord_fields(self.axis_id['longitude'], "")
-        registry.add_field(("index", "dlongitude"), function = f1,
+        registry.add_field(("index", "dlongitude"), "cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "longitude"), function = f2,
+        registry.add_field(("index", "longitude"), "cell",  function = f2,
                            display_field = False,
                            units = "")
 
         f1, f2 = _get_coord_fields(self.axis_id[self.radial_axis])
-        registry.add_field(("index", "d%s" % (self.radial_axis,)), function = f1,
+        registry.add_field(("index", "d%s" % (self.radial_axis,)), "cell",  function = f1,
                            display_field = False,
                            units = "code_length")
-        registry.add_field(("index", self.radial_axis), function = f2,
+        registry.add_field(("index", self.radial_axis), "cell",  function = f2,
                            display_field = False,
                            units = "code_length")
 
@@ -76,20 +76,20 @@
             vol *= data["index", "dtheta"]
             vol *= data["index", "dphi"]
             return vol
-        registry.add_field(("index", "cell_volume"),
+        registry.add_field(("index", "cell_volume"), "cell", 
                  function=_SphericalVolume,
                  units = "code_length**3")
 
         def _path_radial_axis(field, data):
             return data["index", "d%s" % self.radial_axis]
-        registry.add_field(("index", "path_element_%s" % self.radial_axis),
+        registry.add_field(("index", "path_element_%s" % self.radial_axis), "cell", 
                  function = _path_radial_axis,
                  units = "code_length")
         def _path_latitude(field, data):
             # We use r here explicitly
             return data["index", "r"] * \
                 data["index", "dlatitude"] * np.pi/180.0
-        registry.add_field(("index", "path_element_latitude"),
+        registry.add_field(("index", "path_element_latitude"), "cell", 
                  function = _path_latitude,
                  units = "code_length")
         def _path_longitude(field, data):
@@ -97,31 +97,31 @@
             return data["index", "r"] \
                     * data["index", "dlongitude"] * np.pi/180.0 \
                     * np.sin((data["index", "latitude"] + 90.0) * np.pi/180.0)
-        registry.add_field(("index", "path_element_longitude"),
+        registry.add_field(("index", "path_element_longitude"), "cell", 
                  function = _path_longitude,
                  units = "code_length")
 
         def _latitude_to_theta(field, data):
             # latitude runs from -90 to 90
             return (data["latitude"] + 90) * np.pi/180.0
-        registry.add_field(("index", "theta"),
+        registry.add_field(("index", "theta"), "cell", 
                  function = _latitude_to_theta,
                  units = "")
         def _dlatitude_to_dtheta(field, data):
             return data["dlatitude"] * np.pi/180.0
-        registry.add_field(("index", "dtheta"),
+        registry.add_field(("index", "dtheta"), "cell", 
                  function = _dlatitude_to_dtheta,
                  units = "")
 
         def _longitude_to_phi(field, data):
             # longitude runs from -180 to 180
             return (data["longitude"] + 180) * np.pi/180.0
-        registry.add_field(("index", "phi"),
+        registry.add_field(("index", "phi"), "cell", 
                  function = _longitude_to_phi,
                  units = "")
         def _dlongitude_to_dphi(field, data):
             return data["dlongitude"] * np.pi/180.0
-        registry.add_field(("index", "dphi"),
+        registry.add_field(("index", "dphi"), "cell", 
                  function = _dlongitude_to_dphi,
                  units = "")
 
@@ -138,7 +138,7 @@
                 else:
                     surface_height = data.ds.quan(0.0, "code_length")
             return data["altitude"] + surface_height
-        registry.add_field(("index", "r"),
+        registry.add_field(("index", "r"), "cell", 
                  function=_altitude_to_radius,
                  units = "code_length")
         registry.alias(("index", "dr"), ("index", "daltitude"))
@@ -341,7 +341,7 @@
                     rax = self.axis_id[self.radial_axis]
                     outer_radius = data.ds.domain_right_edge[rax]
             return -1.0 * data["depth"] + outer_radius
-        registry.add_field(("index", "r"),
+        registry.add_field(("index", "r"), "cell", 
                  function=_depth_to_radius,
                  units = "code_length")
         registry.alias(("index", "dr"), ("index", "ddepth"))

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/geometry/coordinates/spec_cube_coordinates.py
--- a/yt/geometry/coordinates/spec_cube_coordinates.py
+++ b/yt/geometry/coordinates/spec_cube_coordinates.py
@@ -67,14 +67,14 @@
                     rv[:] = 1.0
                     return rv
                 return _length_func
-            registry.add_field(("index", "d%s" % ax), function = f1,
+            registry.add_field(("index", "d%s" % ax), "cell",  function = f1,
                                display_field = False,
                                units = "code_length")
-            registry.add_field(("index", "path_element_%s" % ax),
+            registry.add_field(("index", "path_element_%s" % ax), "cell", 
                                function = _get_length_func(),
                                display_field = False,
                                units = "")
-            registry.add_field(("index", "%s" % ax), function = f2,
+            registry.add_field(("index", "%s" % ax), "cell",  function = f2,
                                display_field = False,
                                units = "code_length")
         def _cell_volume(field, data):
@@ -82,7 +82,7 @@
             rv *= data["index", "dy"]
             rv *= data["index", "dz"]
             return rv
-        registry.add_field(("index", "cell_volume"), function=_cell_volume,
+        registry.add_field(("index", "cell_volume"), "cell",  function=_cell_volume,
                            display_field=False, units = "code_length**3")
         registry.check_derived_fields(
             [("index", "dx"), ("index", "dy"), ("index", "dz"),

diff -r a61d336de1d82ffff73485333120e95e717a7d5e -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b yt/geometry/coordinates/spherical_coordinates.py
--- a/yt/geometry/coordinates/spherical_coordinates.py
+++ b/yt/geometry/coordinates/spherical_coordinates.py
@@ -35,33 +35,33 @@
 
     def setup_fields(self, registry):
         # return the fields for r, z, theta
-        registry.add_field(("index", "dx"), function=_unknown_coord)
-        registry.add_field(("index", "dy"), function=_unknown_coord)
-        registry.add_field(("index", "dz"), function=_unknown_coord)
-        registry.add_field(("index", "x"), function=_unknown_coord)
-        registry.add_field(("index", "y"), function=_unknown_coord)
-        registry.add_field(("index", "z"), function=_unknown_coord)
+        registry.add_field(("index", "dx"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "dy"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "dz"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "x"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "y"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "z"), "cell",  function=_unknown_coord)
         f1, f2 = _get_coord_fields(self.axis_id['r'])
-        registry.add_field(("index", "dr"), function = f1,
+        registry.add_field(("index", "dr"), "cell",  function = f1,
                            display_field = False,
                            units = "code_length")
-        registry.add_field(("index", "r"), function = f2,
+        registry.add_field(("index", "r"), "cell",  function = f2,
                            display_field = False,
                            units = "code_length")
 
         f1, f2 = _get_coord_fields(self.axis_id['theta'], "")
-        registry.add_field(("index", "dtheta"), function = f1,
+        registry.add_field(("index", "dtheta"), "cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "theta"), function = f2,
+        registry.add_field(("index", "theta"), "cell",  function = f2,
                            display_field = False,
                            units = "")
 
         f1, f2 = _get_coord_fields(self.axis_id['phi'], "")
-        registry.add_field(("index", "dphi"), function = f1,
+        registry.add_field(("index", "dphi"), "cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "phi"), function = f2,
+        registry.add_field(("index", "phi"), "cell",  function = f2,
                            display_field = False,
                            units = "")
 
@@ -73,19 +73,19 @@
             vol *= data["index", "dtheta"]
             vol *= data["index", "dphi"]
             return vol
-        registry.add_field(("index", "cell_volume"),
+        registry.add_field(("index", "cell_volume"), "cell", 
                  function=_SphericalVolume,
                  units = "code_length**3")
 
         def _path_r(field, data):
             return data["index", "dr"]
-        registry.add_field(("index", "path_element_r"),
+        registry.add_field(("index", "path_element_r"), "cell", 
                  function = _path_r,
                  units = "code_length")
         def _path_theta(field, data):
             # Note: this already assumes cell-centered
             return data["index", "r"] * data["index", "dtheta"]
-        registry.add_field(("index", "path_element_theta"),
+        registry.add_field(("index", "path_element_theta"), "cell", 
                  function = _path_theta,
                  units = "code_length")
         def _path_phi(field, data):
@@ -93,7 +93,7 @@
             return data["index", "r"] \
                     * data["index", "dphi"] \
                     * np.sin(data["index", "theta"])
-        registry.add_field(("index", "path_element_phi"),
+        registry.add_field(("index", "path_element_phi"), "cell", 
                  function = _path_phi,
                  units = "code_length")
 


https://bitbucket.org/yt_analysis/yt/commits/9725f3030c06/
Changeset:   9725f3030c06
Branch:      yt
User:        al007
Date:        2016-09-23 22:05:07+00:00
Summary:     Merge yt-tip.
Affected #:  31 files

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda doc/source/examining/loading_data.rst
--- a/doc/source/examining/loading_data.rst
+++ b/doc/source/examining/loading_data.rst
@@ -1519,6 +1519,57 @@
    # The halo mass
    print(ad["FOF", "particle_mass"])
 
+.. _loading-openpmd-data:
+
+openPMD Data
+---------
+
+`openPMD <http://www.openpmd.org>`_ is an open source meta-standard and naming
+scheme for mesh based data and particle data. It does not actually define a file
+format.
+
+HDF5-containers respecting the minimal set of meta information from
+versions 1.0.0 and 1.0.1 of the standard are compatible.
+Support for the ED-PIC extension is not available. Mesh data in cartesian coordinates
+and particle data can be read by this frontend.
+
+To load the first in-file iteration of a openPMD datasets using the standard HDF5
+output format:
+
+.. code-block:: python
+
+   import yt
+   ds = yt.load('example-3d/hdf5/data00000100.h5')
+
+If you operate on large files, you may want to modify the virtual chunking behaviour through
+``open_pmd_virtual_gridsize``. The supplied value is an estimate of the size of a single read request
+for each particle attribute/mesh (in Byte).
+
+.. code-block:: python
+
+  import yt
+  ds = yt.load('example-3d/hdf5/data00000100.h5', open_pmd_virtual_gridsize=10e4)
+  sp = yt.SlicePlot(ds, 'x', 'rho')
+  sp.show()
+
+Particle data is fully supported:
+
+.. code-block:: python
+
+  import yt
+  ds = yt.load('example-3d/hdf5/data00000100.h5')
+  ad = f.all_data()
+  ppp = yt.ParticlePhasePlot(ad, 'particle_position_y', 'particle_momentum_y', 'particle_weighting')
+  ppp.show()
+
+.. rubric:: Caveats
+
+* 1D, 2D and 3D data is compatible, but lower dimensional data might yield
+  strange results since it gets padded and treated as 3D. Extraneous dimensions are
+  set to be of length 1.0m and have a width of one cell.
+* The frontend has hardcoded logic for renaming the openPMD ``position``
+  of particles to ``positionCoarse``
+
 .. _loading-pyne-data:
 
 PyNE Data

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda doc/source/reference/api/api.rst
--- a/doc/source/reference/api/api.rst
+++ b/doc/source/reference/api/api.rst
@@ -323,6 +323,21 @@
    ~yt.frontends.moab.io.IOHandlerMoabH5MHex8
    ~yt.frontends.moab.io.IOHandlerMoabPyneHex8
 
+OpenPMD
+^^^^^^^
+
+.. autosummary::
+   :toctree: generated/
+
+   ~yt.frontends.open_pmd.data_structures.OpenPMDGrid
+   ~yt.frontends.open_pmd.data_structures.OpenPMDHierarchy
+   ~yt.frontends.open_pmd.data_structures.OpenPMDDataset
+   ~yt.frontends.open_pmd.fields.OpenPMDFieldInfo
+   ~yt.frontends.open_pmd.io.IOHandlerOpenPMDHDF5
+   ~yt.frontends.open_pmd.misc.parse_unit_dimension
+   ~yt.frontends.open_pmd.misc.is_const_component
+   ~yt.frontends.open_pmd.misc.get_component
+
 RAMSES
 ^^^^^^
 

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda doc/source/reference/code_support.rst
--- a/doc/source/reference/code_support.rst
+++ b/doc/source/reference/code_support.rst
@@ -48,6 +48,8 @@
 +-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
 | Nyx                   |     Y      |     N     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
 +-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
+| openPMD               |     Y      |     Y     |      N     |   Y   |    Y     |    Y     |     N      | Partial  |
++-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
 | Orion                 |     Y      |     Y     |      Y     |   Y   |    Y     |    Y     |     Y      |   Full   |
 +-----------------------+------------+-----------+------------+-------+----------+----------+------------+----------+
 | OWLS/EAGLE            |     Y      |     Y     |      Y     |   Y   | Y [#f2]_ |    Y     |     Y      |   Full   |

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda tests/tests.yaml
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -35,10 +35,10 @@
     - yt/frontends/owls_subfind/tests/test_outputs.py
     - yt/frontends/gadget_fof/tests/test_outputs.py:test_fields_g5
     - yt/frontends/gadget_fof/tests/test_outputs.py:test_fields_g42
-  
+
   local_owls_000:
     - yt/frontends/owls/tests/test_outputs.py
-  
+
   local_pw_006:
     - yt/visualization/tests/test_plotwindow.py:test_attributes
     - yt/visualization/tests/test_plotwindow.py:test_attributes_wt
@@ -46,24 +46,25 @@
     - yt/visualization/tests/test_particle_plot.py:test_particle_projection_answers
     - yt/visualization/tests/test_particle_plot.py:test_particle_projection_filter
     - yt/visualization/tests/test_particle_plot.py:test_particle_phase_answers
-  
+
   local_tipsy_001:
     - yt/frontends/tipsy/tests/test_outputs.py
-  
-  local_varia_003:
+
+  local_varia_004:
     - yt/analysis_modules/radmc3d_export
     - yt/frontends/moab/tests/test_c5.py
     - yt/analysis_modules/photon_simulator/tests/test_spectra.py
     - yt/analysis_modules/photon_simulator/tests/test_sloshing.py
     - yt/visualization/volume_rendering/tests/test_vr_orientation.py
     - yt/visualization/volume_rendering/tests/test_mesh_render.py
+    - yt/visualization/tests/test_mesh_slices.py:test_tri2
 
   local_orion_000:
     - yt/frontends/boxlib/tests/test_orion.py
-  
+
   local_ramses_000:
     - yt/frontends/ramses/tests/test_outputs.py
-  
+
   local_ytdata_000:
     - yt/frontends/ytdata
 
@@ -81,6 +82,7 @@
 other_tests:
   unittests:
      - '-v'
+     - '--exclude=test_mesh_slices'  # disable randomly failing test
   cookbook:
      - '-v'
      - 'doc/source/cookbook/tests/test_cookbook.py'

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/api.py
--- a/yt/frontends/api.py
+++ b/yt/frontends/api.py
@@ -35,6 +35,7 @@
     'halo_catalog',
     'http_stream',
     'moab',
+    'open_pmd',
     'owls',
     'owls_subfind',
     'ramses',

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/open_pmd/__init__.py
--- /dev/null
+++ b/yt/frontends/open_pmd/__init__.py
@@ -0,0 +1,15 @@
+"""
+API for yt.frontends.open_pmd
+
+
+
+"""
+
+# -----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+# Copyright (c) 2015, Daniel Grassinger (HZDR)
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+# -----------------------------------------------------------------------------

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/open_pmd/api.py
--- /dev/null
+++ b/yt/frontends/open_pmd/api.py
@@ -0,0 +1,29 @@
+"""
+API for yt.frontends.open_pmd
+
+
+
+"""
+
+# -----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+# Copyright (c) 2015, Daniel Grassinger (HZDR)
+# Copyright (c) 2016, Fabian Koller (HZDR)
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+# -----------------------------------------------------------------------------
+
+from .data_structures import \
+    OpenPMDDataset, \
+    OpenPMDGrid, \
+    OpenPMDHierarchy
+
+from .fields import \
+    OpenPMDFieldInfo
+
+from .io import \
+    IOHandlerOpenPMDHDF5
+
+from . import \
+    tests

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/open_pmd/data_structures.py
--- /dev/null
+++ b/yt/frontends/open_pmd/data_structures.py
@@ -0,0 +1,517 @@
+"""
+openPMD data structures
+
+
+"""
+
+# -----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+# Copyright (c) 2015, Daniel Grassinger (HZDR)
+# Copyright (c) 2016, Fabian Koller (HZDR)
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+# -----------------------------------------------------------------------------
+
+from distutils.version import StrictVersion
+from functools import reduce
+from operator import mul
+from os import \
+    path, \
+    listdir
+from re import match
+
+import numpy as np
+from yt.data_objects.grid_patch import AMRGridPatch
+from yt.data_objects.static_output import Dataset
+from yt.frontends.open_pmd.fields import OpenPMDFieldInfo
+from yt.frontends.open_pmd.misc import \
+    is_const_component, \
+    get_component
+from yt.funcs import setdefaultattr
+from yt.geometry.grid_geometry_handler import GridIndex
+from yt.utilities.file_handler import HDF5FileHandler
+from yt.utilities.logger import ytLogger as mylog
+from yt.utilities.on_demand_imports import _h5py as h5
+
+
+class OpenPMDGrid(AMRGridPatch):
+    """Represents chunk of data on-disk.
+
+    This defines the index and offset for every mesh and particle type.
+    It also defines parents and children grids. Since openPMD does not have multiple levels of refinement,
+    there are no parents or children for any grid.
+    """
+    _id_offset = 0
+    __slots__ = ["_level_id"]
+    # Every particle species and mesh might have different hdf5-indices and offsets
+    ftypes=[]
+    ptypes=[]
+    findex = 0
+    foffset = 0
+    pindex = 0
+    poffset = 0
+
+    def __init__(self, gid, index, level=-1, fi=0, fo=0, pi=0, po=0, ft=[], pt=[]):
+        AMRGridPatch.__init__(self, gid, filename=index.index_filename,
+                              index=index)
+        self.findex = fi
+        self.foffset = fo
+        self.pindex = pi
+        self.poffset = po
+        self.ftypes = ft
+        self.ptypes = pt
+        self.Parent = None
+        self.Children = []
+        self.Level = level
+
+    def __repr__(self):
+        return "OpenPMDGrid_%04i (%s)" % (self.id, self.ActiveDimensions)
+
+
+class OpenPMDHierarchy(GridIndex):
+    """Defines which fields and particles are created and read from disk.
+
+    Furthermore it defines the characteristics of the grids.
+    """
+    grid = OpenPMDGrid
+
+    def __init__(self, ds, dataset_type="openPMD"):
+        self.dataset_type = dataset_type
+        self.dataset = ds
+        self.index_filename = ds.parameter_filename
+        self.directory = path.dirname(self.index_filename)
+        GridIndex.__init__(self, ds, dataset_type)
+
+    def _get_particle_type_counts(self):
+        """Reads the active number of particles for every species.
+
+        Returns
+        -------
+        dict
+            keys are ptypes
+            values are integer counts of the ptype
+        """
+        result = {}
+        f = self.dataset._handle
+        bp = self.dataset.base_path
+        pp = self.dataset.particles_path
+        for ptype in self.ds.particle_types_raw:
+            if str(ptype) == "io":
+                spec = list(f[bp + pp].keys())[0]
+            else:
+                spec = ptype
+            axis = list(f[bp + pp + "/" + spec + "/position"].keys())[0]
+            pos = f[bp + pp + "/" + spec + "/position/" + axis]
+            if is_const_component(pos):
+                result[ptype] = pos.attrs["shape"]
+            else:
+                result[ptype] = pos.len()
+        return result
+
+    def _detect_output_fields(self):
+        """Populates ``self.field_list`` with native fields (mesh and particle) on disk.
+
+        Each entry is a tuple of two strings. The first element is the on-disk fluid type or particle type.
+        The second element is the name of the field in yt. This string is later used for accessing the data.
+        Convention suggests that the on-disk fluid type should be "openPMD",
+        the on-disk particle type (for a single species of particles) is "io"
+        or (for multiple species of particles) the particle name on-disk.
+        """
+        f = self.dataset._handle
+        bp = self.dataset.base_path
+        mp = self.dataset.meshes_path
+        pp = self.dataset.particles_path
+
+        mesh_fields = []
+        try:
+            for field in f[bp + mp].keys():
+                try:
+                    for axis in f[bp + mp + field].keys():
+                        mesh_fields.append(field.replace("_", "-")
+                                           + "_" + axis)
+                except AttributeError:
+                    # This is a h5.Dataset (i.e. no axes)
+                    mesh_fields.append(field.replace("_", "-"))
+        except KeyError:
+            # There are no mesh fields
+            pass
+        self.field_list = [("openPMD", str(field)) for field in mesh_fields]
+
+        particle_fields = []
+        try:
+            for species in f[bp + pp].keys():
+                for record in f[bp + pp + species].keys():
+                    if is_const_component(f[bp + pp + species + "/" + record]):
+                        # Record itself (e.g. particle_mass) is constant
+                        particle_fields.append(species.replace("_", "-")
+                                               + "_" + record.replace("_", "-"))
+                    elif "particlePatches" not in record:
+                        try:
+                            # Create a field for every axis (x,y,z) of every property (position)
+                            # of every species (electrons)
+                            axes = list(f[bp + pp + species + "/" + record].keys())
+                            if str(record) == "position":
+                                record = "positionCoarse"
+                            for axis in axes:
+                                particle_fields.append(species.replace("_", "-")
+                                                       + "_" + record.replace("_", "-")
+                                                       + "_" + axis)
+                        except AttributeError:
+                            # Record is a dataset, does not have axes (e.g. weighting)
+                            particle_fields.append(species.replace("_", "-")
+                                                   + "_" + record.replace("_", "-"))
+                            pass
+                    else:
+                        pass
+            if len(list(f[bp + pp].keys())) > 1:
+                # There is more than one particle species, use the specific names as field types
+                self.field_list.extend(
+                    [(str(field).split("_")[0],
+                      ("particle_" + "_".join(str(field).split("_")[1:]))) for field in particle_fields])
+            else:
+                # Only one particle species, fall back to "io"
+                self.field_list.extend(
+                    [("io",
+                      ("particle_" + "_".join(str(field).split("_")[1:]))) for field in particle_fields])
+        except KeyError:
+            # There are no particle fields
+            pass
+
+    def _count_grids(self):
+        """Sets ``self.num_grids`` to be the total number of grids in the simulation.
+
+        The number of grids is determined by their respective memory footprint.
+        """
+        f = self.dataset._handle
+        bp = self.dataset.base_path
+        mp = self.dataset.meshes_path
+        pp = self.dataset.particles_path
+
+        self.meshshapes = {}
+        self.numparts = {}
+
+        self.num_grids = 0
+
+        for mesh in f[bp + mp].keys():
+            if type(f[bp + mp + mesh]) is h5.Group:
+                shape = f[bp + mp + mesh + "/" + list(f[bp + mp + mesh].keys())[0]].shape
+            else:
+                shape = f[bp + mp + mesh].shape
+            spacing = tuple(f[bp + mp + mesh].attrs["gridSpacing"])
+            offset = tuple(f[bp + mp + mesh].attrs["gridGlobalOffset"])
+            unit_si = f[bp + mp + mesh].attrs["gridUnitSI"]
+            self.meshshapes[mesh] = (shape, spacing, offset, unit_si)
+        for species in f[bp + pp].keys():
+            if "particlePatches" in f[bp + pp + "/" + species].keys():
+                for (patch, size) in enumerate(f[bp + pp + "/" + species + "/particlePatches/numParticles"]):
+                    self.numparts[species + "#" + str(patch)] = size
+            else:
+                axis = list(f[bp + pp + species + "/position"].keys())[0]
+                if is_const_component(f[bp + pp + species + "/position/" + axis]):
+                    self.numparts[species] = f[bp + pp + species + "/position/" + axis].attrs["shape"]
+                else:
+                    self.numparts[species] = f[bp + pp + species + "/position/" + axis].len()
+
+        # Limit values per grid by resulting memory footprint
+        self.vpg = int(self.dataset.gridsize / 4)  # 4Byte per value (f32)
+
+        # Meshes of the same size do not need separate chunks
+        for (shape, spacing, offset, unit_si) in set(self.meshshapes.values()):
+            self.num_grids += min(shape[0], int(np.ceil(reduce(mul, shape) * self.vpg**-1)))
+
+        # Same goes for particle chunks if they are not inside particlePatches
+        patches = {}
+        no_patches = {}
+        for (k, v) in self.numparts.items():
+            if "#" in k:
+                patches[k] = v
+            else:
+                no_patches[k] = v
+        for size in set(no_patches.values()):
+            self.num_grids += int(np.ceil(size * self.vpg ** -1))
+        for size in patches.values():
+            self.num_grids += int(np.ceil(size * self.vpg ** -1))
+
+    def _parse_index(self):
+        """Fills each grid with appropriate properties (extent, dimensions, ...)
+
+        This calculates the properties of every OpenPMDGrid based on the total number of grids in the simulation.
+        The domain is divided into ``self.num_grids`` (roughly) equally sized chunks along the x-axis.
+        ``grid_levels`` is always equal to 0 since we only have one level of refinement in openPMD.
+
+        Notes
+        -----
+        ``self.grid_dimensions`` is rounded to the nearest integer. Grid edges are calculated from this dimension.
+        Grids with dimensions [0, 0, 0] are particle only. The others do not have any particles affiliated with them.
+        """
+        f = self.dataset._handle
+        bp = self.dataset.base_path
+        pp = self.dataset.particles_path
+
+        self.grid_levels.flat[:] = 0
+        self.grids = np.empty(self.num_grids, dtype="object")
+
+        grid_index_total = 0
+
+        # Mesh grids
+        for mesh in set(self.meshshapes.values()):
+            (shape, spacing, offset, unit_si) = mesh
+            shape = np.asarray(shape)
+            spacing = np.asarray(spacing)
+            offset = np.asarray(offset)
+            # Total dimension of this grid
+            domain_dimension = np.asarray(shape, dtype=np.int32)
+            domain_dimension = np.append(domain_dimension, np.ones(3 - len(domain_dimension)))
+            # Number of grids of this shape
+            num_grids = min(shape[0], int(np.ceil(reduce(mul, shape) * self.vpg ** -1)))
+            gle = offset * unit_si  # self.dataset.domain_left_edge
+            gre = domain_dimension[:spacing.size] * unit_si * spacing + gle  # self.dataset.domain_right_edge
+            gle = np.append(gle, np.zeros(3 - len(gle)))
+            gre = np.append(gre, np.ones(3 - len(gre)))
+            grid_dim_offset = np.linspace(0, domain_dimension[0], num_grids + 1, dtype=np.int32)
+            grid_edge_offset = grid_dim_offset * np.float(domain_dimension[0]) ** -1 * (gre[0] - gle[0]) + gle[0]
+            mesh_names = []
+            for (mname, mdata) in self.meshshapes.items():
+                if mesh == mdata:
+                    mesh_names.append(str(mname))
+            prev = 0
+            for grid in np.arange(num_grids):
+                self.grid_dimensions[grid_index_total] = domain_dimension
+                self.grid_dimensions[grid_index_total][0] = grid_dim_offset[grid + 1] - grid_dim_offset[grid]
+                self.grid_left_edge[grid_index_total] = gle
+                self.grid_left_edge[grid_index_total][0] = grid_edge_offset[grid]
+                self.grid_right_edge[grid_index_total] = gre
+                self.grid_right_edge[grid_index_total][0] = grid_edge_offset[grid + 1]
+                self.grid_particle_count[grid_index_total] = 0
+                self.grids[grid_index_total] = self.grid(grid_index_total, self, 0,
+                                                         fi=prev,
+                                                         fo=self.grid_dimensions[grid_index_total][0],
+                                                         ft=mesh_names)
+                prev += self.grid_dimensions[grid_index_total][0]
+                grid_index_total += 1
+
+        handled_ptypes = []
+
+        # Particle grids
+        for (species, count) in self.numparts.items():
+            if "#" in species:
+                # This is a particlePatch
+                spec = species.split("#")
+                patch = f[bp + pp + "/" + spec[0] + "/particlePatches"]
+                num_grids = int(np.ceil(count * self.vpg ** -1))
+                gle = []
+                for axis in patch["offset"].keys():
+                    gle.append(get_component(patch, "offset/" + axis, int(spec[1]), 1)[0])
+                gle = np.asarray(gle)
+                gle = np.append(gle, np.zeros(3 - len(gle)))
+                gre = []
+                for axis in patch["extent"].keys():
+                    gre.append(get_component(patch, "extent/" + axis, int(spec[1]), 1)[0])
+                gre = np.asarray(gre)
+                gre = np.append(gre, np.ones(3 - len(gre)))
+                np.add(gle, gre, gre)
+                npo = patch["numParticlesOffset"].value.item(int(spec[1]))
+                particle_count = np.linspace(npo, npo + count, num_grids + 1,
+                                             dtype=np.int32)
+                particle_names = [str(spec[0])]
+            elif str(species) not in handled_ptypes:
+                num_grids = int(np.ceil(count * self.vpg ** -1))
+                gle = self.dataset.domain_left_edge
+                gre = self.dataset.domain_right_edge
+                particle_count = np.linspace(0, count, num_grids + 1, dtype=np.int32)
+                particle_names = []
+                for (pname, size) in self.numparts.items():
+                    if size == count:
+                        # Since this is not part of a particlePatch, we can include multiple same-sized ptypes
+                        particle_names.append(str(pname))
+                        handled_ptypes.append(str(pname))
+            else:
+                # A grid with this exact particle count has already been created
+                continue
+            for grid in np.arange(num_grids):
+                self.grid_dimensions[grid_index_total] = [0, 0, 0]  # Counted as mesh-size, thus no dimensional extent
+                self.grid_left_edge[grid_index_total] = gle
+                self.grid_right_edge[grid_index_total] = gre
+                self.grid_particle_count[grid_index_total] = (particle_count[grid + 1] - particle_count[grid]) * len(
+                    particle_names)
+                self.grids[grid_index_total] = self.grid(grid_index_total, self, 0,
+                                                         pi=particle_count[grid],
+                                                         po=particle_count[grid + 1] - particle_count[grid],
+                                                         pt=particle_names)
+                grid_index_total += 1
+
+    def _populate_grid_objects(self):
+        """This initializes all grids.
+
+        Additionally, it should set up Children and Parent lists on each grid object.
+        openPMD is not adaptive and thus there are no Children and Parents for any grid.
+        """
+        for i in np.arange(self.num_grids):
+            self.grids[i]._prepare_grid()
+            self.grids[i]._setup_dx()
+        self.max_level = 0
+
+
+class OpenPMDDataset(Dataset):
+    """Contains all the required information of a single iteration of the simulation.
+
+    Notes
+    -----
+    It is assumed that all meshes cover the same region. Their resolution can be different.
+    It is assumed that all particles reside in this same region exclusively.
+    It is assumed that the particle and mesh positions are *absolute* with respect to the simulation origin.
+    """
+    _index_class = OpenPMDHierarchy
+    _field_info_class = OpenPMDFieldInfo
+
+    def __init__(self,
+                 filename,
+                 dataset_type="openPMD",
+                 storage_filename=None,
+                 units_override=None,
+                 unit_system="mks",
+                 **kwargs):
+        self._handle = HDF5FileHandler(filename)
+        self.gridsize = kwargs.pop("open_pmd_virtual_gridsize", 10**9)
+        self._set_paths(self._handle, path.dirname(filename))
+        Dataset.__init__(self,
+                         filename,
+                         dataset_type,
+                         units_override=units_override,
+                         unit_system=unit_system)
+        self.storage_filename = storage_filename
+        self.fluid_types += ("openPMD",)
+        particles = tuple(str(c) for c in self._handle[self.base_path + self.particles_path].keys())
+        if len(particles) > 1:
+            # Only use on-disk particle names if there is more than one species
+            self.particle_types = particles
+        mylog.debug("open_pmd - self.particle_types: {}".format(self.particle_types))
+        self.particle_types_raw = self.particle_types
+        self.particle_types = tuple(self.particle_types)
+
+    def _set_paths(self, handle, path):
+        """Parses relevant hdf5-paths out of ``handle``.
+
+        Parameters
+        ----------
+        handle : h5py.File
+        path : str
+            (absolute) filepath for current hdf5 container
+        """
+        iterations = []
+        encoding = handle.attrs["iterationEncoding"].decode()
+        if "groupBased" in encoding:
+            iterations = list(handle["/data"].keys())
+            mylog.info("open_pmd - found {} iterations in file".format(len(iterations)))
+        elif "fileBased" in encoding:
+            itformat = handle.attrs["iterationFormat"].decode().split("/")[-1]
+            regex = "^" + itformat.replace("%T", "[0-9]+") + "$"
+            if path is "":
+                mylog.warning("open_pmd - For file based iterations, please use absolute file paths!")
+                pass
+            for filename in listdir(path):
+                if match(regex, filename):
+                    iterations.append(filename)
+            mylog.info("open_pmd - found {} iterations in directory".format(len(iterations)))
+
+        if len(iterations) == 0:
+            mylog.warning("open_pmd - no iterations found!")
+        if "groupBased" in encoding and len(iterations) > 1:
+            mylog.warning("open_pmd - only choose to load one iteration ({})".format(list(handle["/data"].keys())[0]))
+
+        self.base_path = "/data/{}/".format(list(handle["/data"].keys())[0])
+        self.meshes_path = self._handle["/"].attrs["meshesPath"].decode()
+        self.particles_path = self._handle["/"].attrs["particlesPath"].decode()
+
+    def _set_code_unit_attributes(self):
+        """Handle conversion between different physical units and the code units.
+
+        Every dataset in openPMD can have different code <-> physical scaling.
+        The individual factor is obtained by multiplying with "unitSI" reading getting data from disk.
+        """
+        setdefaultattr(self, "length_unit", self.quan(1.0, "m"))
+        setdefaultattr(self, "mass_unit", self.quan(1.0, "kg"))
+        setdefaultattr(self, "time_unit", self.quan(1.0, "s"))
+        setdefaultattr(self, "velocity_unit", self.quan(1.0, "m/s"))
+        setdefaultattr(self, "magnetic_unit", self.quan(1.0, "T"))
+
+    def _parse_parameter_file(self):
+        """Read in metadata describing the overall data on-disk.
+        """
+        f = self._handle
+        bp = self.base_path
+        mp = self.meshes_path
+
+        self.unique_identifier = 0
+        self.parameters = 0
+        self.periodicity = np.zeros(3, dtype=np.bool)
+        self.refine_by = 1
+        self.cosmological_simulation = 0
+
+        try:
+            shapes = {}
+            left_edges = {}
+            right_edges = {}
+            for mesh in f[bp + mp].keys():
+                if type(f[bp + mp + mesh]) is h5.Group:
+                    shape = np.asarray(f[bp + mp + mesh + "/" + list(f[bp + mp + mesh].keys())[0]].shape)
+                else:
+                    shapes[mesh] = np.asarray(f[bp + mp + mesh].shape)
+                spacing = np.asarray(f[bp + mp + mesh].attrs["gridSpacing"])
+                offset = np.asarray(f[bp + mp + mesh].attrs["gridGlobalOffset"])
+                unit_si = np.asarray(f[bp + mp + mesh].attrs["gridUnitSI"])
+                le = offset * unit_si
+                re = le + shape * unit_si * spacing
+                shapes[mesh] = shape
+                left_edges[mesh] = le
+                right_edges[mesh] = re
+            lowest_dim = np.min([len(i) for i in shapes.values()])
+            shapes = np.asarray([i[:lowest_dim] for i in shapes.values()])
+            left_edges = np.asarray([i[:lowest_dim] for i in left_edges.values()])
+            right_edges = np.asarray([i[:lowest_dim] for i in right_edges.values()])
+            fs = []
+            dle = []
+            dre = []
+            for i in np.arange(lowest_dim):
+                fs.append(np.max(shapes.transpose()[i]))
+                dle.append(np.min(left_edges.transpose()[i]))
+                dre.append(np.min(right_edges.transpose()[i]))
+            self.dimensionality = len(fs)
+            self.domain_dimensions = np.append(fs, np.ones(3 - self.dimensionality))
+            self.domain_left_edge = np.append(dle, np.zeros(3 - len(dle)))
+            self.domain_right_edge = np.append(dre, np.ones(3 - len(dre)))
+        except ValueError:
+            mylog.warning("open_pmd - It seems your data does not contain meshes. Assuming domain extent of 1m^3!")
+            self.dimensionality = 3
+            self.domain_dimensions = np.ones(3, dtype=np.float64)
+            self.domain_left_edge = np.zeros(3, dtype=np.float64)
+            self.domain_right_edge = np.ones(3, dtype=np.float64)
+
+        self.current_time = f[bp].attrs["time"] * f[bp].attrs["timeUnitSI"]
+
+    @classmethod
+    def _is_valid(self, *args, **kwargs):
+        """Checks whether the supplied file can be read by this frontend.
+        """
+        try:
+            f = h5.File(args[0], "r")
+        except (IOError, OSError):
+            return False
+
+        requirements = ["openPMD", "basePath", "meshesPath", "particlesPath"]
+        attrs = list(f["/"].attrs.keys())
+        for i in requirements:
+            if i not in attrs:
+                f.close()
+                return False
+
+        known_versions = [StrictVersion("1.0.0"),
+                          StrictVersion("1.0.1")]
+        if StrictVersion(f.attrs["openPMD"].decode()) in known_versions:
+            f.close()
+            return True
+        else:
+            f.close()
+            return False

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/open_pmd/fields.py
--- /dev/null
+++ b/yt/frontends/open_pmd/fields.py
@@ -0,0 +1,217 @@
+"""
+openPMD-specific fields
+
+
+
+"""
+
+# -----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+# Copyright (c) 2015, Daniel Grassinger (HZDR)
+# Copyright (c) 2016, Fabian Koller (HZDR)
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+# -----------------------------------------------------------------------------
+
+import numpy as np
+
+from yt.fields.field_info_container import FieldInfoContainer
+from yt.fields.magnetic_field import setup_magnetic_field_aliases
+from yt.frontends.open_pmd.misc import \
+    parse_unit_dimension, \
+    is_const_component
+from yt.units.yt_array import YTQuantity
+from yt.utilities.logger import ytLogger as mylog
+from yt.utilities.on_demand_imports import _h5py as h5
+from yt.utilities.physical_constants import \
+    speed_of_light, \
+    mu_0
+
+
+def setup_poynting_vector(self):
+    def _get_poyn(axis):
+        def poynting(field, data):
+            u = mu_0**-1
+            if axis in "x":
+                return u * (data["E_y"] * data["magnetic_field_z"] - data["E_z"] * data["magnetic_field_y"])
+            elif axis in "y":
+                return u * (data["E_z"] * data["magnetic_field_x"] - data["E_x"] * data["magnetic_field_z"])
+            elif axis in "z":
+                return u * (data["E_x"] * data["magnetic_field_y"] - data["E_y"] * data["magnetic_field_x"])
+
+        return poynting
+
+    for ax in "xyz":
+        self.add_field(("openPMD", "poynting_vector_%s" % ax),
+                       function=_get_poyn(ax),
+                       units="W/m**2")
+
+
+def setup_kinetic_energy(self, ptype):
+    def _kin_en(field, data):
+        p2 = (data[ptype, "particle_momentum_x"] ** 2 +
+              data[ptype, "particle_momentum_y"] ** 2 +
+              data[ptype, "particle_momentum_z"] ** 2)
+        mass = data[ptype, "particle_mass"] * data[ptype, "particle_weighting"]
+        return speed_of_light * np.sqrt(p2 + mass ** 2 * speed_of_light ** 2) - mass * speed_of_light ** 2
+
+    self.add_field((ptype, "particle_kinetic_energy"),
+                   function=_kin_en,
+                   units="kg*m**2/s**2",
+                   particle_type=True)
+
+
+def setup_velocity(self, ptype):
+    def _get_vel(axis):
+        def velocity(field, data):
+            c = speed_of_light
+            momentum = data[ptype, "particle_momentum_{}".format(axis)]
+            mass = data[ptype, "particle_mass"]
+            weighting = data[ptype, "particle_weighting"]
+            return momentum / np.sqrt(
+                (mass * weighting) ** 2 +
+                (momentum ** 2) / (c ** 2)
+            )
+
+        return velocity
+
+    for ax in "xyz":
+        self.add_field((ptype, "particle_velocity_%s" % ax),
+                       function=_get_vel(ax),
+                       units="m/s",
+                       particle_type=True)
+
+
+def setup_absolute_positions(self, ptype):
+    def _abs_pos(axis):
+        def ap(field, data):
+            return np.add(data[ptype, "particle_positionCoarse_{}".format(axis)],
+                          data[ptype, "particle_positionOffset_{}".format(axis)])
+
+        return ap
+
+    for ax in "xyz":
+        self.add_field((ptype, "particle_position_%s" % ax),
+                       function=_abs_pos(ax),
+                       units="m",
+                       particle_type=True)
+
+
+class OpenPMDFieldInfo(FieldInfoContainer):
+    """Specifies which fields from the dataset yt should know about.
+
+    ``self.known_other_fields`` and ``self.known_particle_fields`` must be populated.
+    Entries for both of these lists must be tuples of the form
+        ("name", ("units", ["fields", "to", "alias"], "display_name"))
+    These fields will be represented and handled in yt in the way you define them here.
+    The fields defined in both ``self.known_other_fields`` and ``self.known_particle_fields`` will only be added
+    to a dataset (with units, aliases, etc), if they match any entry in the ``OpenPMDHierarchy``'s ``self.field_list``.
+
+    Notes
+    -----
+
+    Contrary to many other frontends, we dynamically obtain the known fields from the simulation output.
+    The openPMD markup is extremely flexible - names, dimensions and the number of individual datasets
+    can (and very likely will) vary.
+
+    openPMD states that names of records and their components are only allowed to contain the
+        characters a-Z,
+        the numbers 0-9
+        and the underscore _
+        (equivalently, the regex \w).
+    Since yt widely uses the underscore in field names, openPMD's underscores (_) are replaced by hyphen (-).
+
+    Derived fields will automatically be set up, if names and units of your known on-disk (or manually derived)
+    fields match the ones in [1].
+
+    References
+    ----------
+    .. http://yt-project.org/docs/dev/analyzing/fields.html
+    .. http://yt-project.org/docs/dev/developing/creating_frontend.html#data-meaning-structures
+    .. https://github.com/openPMD/openPMD-standard/blob/latest/STANDARD.md
+    .. [1] http://yt-project.org/docs/dev/reference/field_list.html#universal-fields
+    """
+    _mag_fields = []
+
+    def __init__(self, ds, field_list):
+        f = ds._handle
+        bp = ds.base_path
+        mp = ds.meshes_path
+        pp = ds.particles_path
+        fields = f[bp + mp]
+
+        for fname in fields.keys():
+            field = fields[fname]
+            if type(field) is h5.Dataset or is_const_component(field):
+                # Don't consider axes. This appears to be a vector field of single dimensionality
+                ytname = str("_".join([fname.replace("_", "-")]))
+                parsed = parse_unit_dimension(np.asarray(field.attrs["unitDimension"], dtype=np.int))
+                unit = str(YTQuantity(1, parsed).units)
+                aliases = []
+                # Save a list of magnetic fields for aliasing later on
+                # We can not reasonably infer field type/unit by name in openPMD
+                if unit == "T" or unit == "kg/(A*s**2)":
+                    self._mag_fields.append(ytname)
+                self.known_other_fields += ((ytname, (unit, aliases, None)),)
+            else:
+                for axis in field.keys():
+                    ytname = str("_".join([fname.replace("_", "-"), axis]))
+                    parsed = parse_unit_dimension(np.asarray(field.attrs["unitDimension"], dtype=np.int))
+                    unit = str(YTQuantity(1, parsed).units)
+                    aliases = []
+                    # Save a list of magnetic fields for aliasing later on
+                    # We can not reasonably infer field type by name in openPMD
+                    if unit == "T" or unit == "kg/(A*s**2)":
+                        self._mag_fields.append(ytname)
+                    self.known_other_fields += ((ytname, (unit, aliases, None)),)
+        for i in self.known_other_fields:
+            mylog.debug("open_pmd - known_other_fields - {}".format(i))
+        particles = f[bp + pp]
+        for species in particles.keys():
+            for record in particles[species].keys():
+                try:
+                    pds = particles[species + "/" + record]
+                    parsed = parse_unit_dimension(pds.attrs["unitDimension"])
+                    unit = str(YTQuantity(1, parsed).units)
+                    ytattrib = str(record).replace("_", "-")
+                    if ytattrib == "position":
+                        # Symbolically rename position to preserve yt's interpretation of the pfield
+                        # particle_position is later derived in setup_absolute_positions in the way yt expects it
+                        ytattrib = "positionCoarse"
+                    if type(pds) is h5.Dataset or is_const_component(pds):
+                        name = ["particle", ytattrib]
+                        self.known_particle_fields += ((str("_".join(name)), (unit, [], None)),)
+                    else:
+                        for axis in pds.keys():
+                            aliases = []
+                            name = ["particle", ytattrib, axis]
+                            ytname = str("_".join(name))
+                            self.known_particle_fields += ((ytname, (unit, aliases, None)),)
+                except KeyError:
+                    mylog.info("open_pmd - {}_{} does not seem to have unitDimension".format(species, record))
+        for i in self.known_particle_fields:
+            mylog.debug("open_pmd - known_particle_fields - {}".format(i))
+        super(OpenPMDFieldInfo, self).__init__(ds, field_list)
+
+    def setup_fluid_fields(self):
+        """Defines which derived mesh fields to create.
+
+        If a field can not be calculated, it will simply be skipped.
+        """
+        # Set up aliases first so the setup for poynting can use them
+        if len(self._mag_fields) > 0:
+            setup_magnetic_field_aliases(self, "openPMD", self._mag_fields)
+            setup_poynting_vector(self)
+
+    def setup_particle_fields(self, ptype):
+        """Defines which derived particle fields to create.
+
+        This will be called for every entry in `OpenPMDDataset``'s ``self.particle_types``.
+        If a field can not be calculated, it will simply be skipped.
+        """
+        setup_absolute_positions(self, ptype)
+        setup_kinetic_energy(self, ptype)
+        setup_velocity(self, ptype)
+        super(OpenPMDFieldInfo, self).setup_particle_fields(ptype)

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/open_pmd/io.py
--- /dev/null
+++ b/yt/frontends/open_pmd/io.py
@@ -0,0 +1,213 @@
+"""
+openPMD-specific IO functions
+
+
+
+"""
+
+# -----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+# Copyright (c) 2015, Daniel Grassinger (HZDR)
+# Copyright (c) 2016, Fabian Koller (HZDR)
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+# -----------------------------------------------------------------------------
+
+from collections import defaultdict
+
+import numpy as np
+
+from yt.frontends.open_pmd.misc import \
+    is_const_component, \
+    get_component
+from yt.utilities.io_handler import BaseIOHandler
+
+
+class IOHandlerOpenPMDHDF5(BaseIOHandler):
+    _field_dtype = "float32"
+    _dataset_type = "openPMD"
+
+    def __init__(self, ds, *args, **kwargs):
+        self.ds = ds
+        self._handle = ds._handle
+        self.base_path = ds.base_path
+        self.meshes_path = ds.meshes_path
+        self.particles_path = ds.particles_path
+        self._array_fields = {}
+        self._cached_ptype = ""
+
+    def _fill_cache(self, ptype, index=0, offset=None):
+        """Fills the particle position cache for the ``ptype``.
+
+        Parameters
+        ----------
+        ptype : str
+            The on-disk name of the particle species
+        index : int, optional
+        offset : int, optional
+        """
+        if str((ptype, index, offset)) not in self._cached_ptype:
+            self._cached_ptype = str((ptype, index, offset))
+            pds = self._handle[self.base_path + self.particles_path + "/" + ptype]
+            axes = list(pds["position"].keys())
+            if offset is None:
+                if is_const_component(pds["position/" + axes[0]]):
+                    offset = pds["position/" + axes[0]].attrs["shape"]
+                else:
+                    offset = pds["position/" + axes[0]].len()
+            self.cache = np.empty((3, offset), dtype=np.float64)
+            for i in np.arange(3):
+                ax = "xyz"[i]
+                if ax in axes:
+                    np.add(get_component(pds, "position/" + ax, index, offset),
+                           get_component(pds, "positionOffset/" + ax, index, offset),
+                           self.cache[i])
+                else:
+                    # Pad accordingly with zeros to make 1D/2D datasets compatible
+                    # These have to be the same shape as the existing axes since that equals the number of particles
+                    self.cache[i] = np.zeros(offset)
+
+    def _read_particle_selection(self, chunks, selector, fields):
+        """Reads given particle fields for given particle species masked by a given selection.
+
+        Parameters
+        ----------
+        chunks
+            A list of chunks
+            A chunk is a list of grids
+        selector
+            A region (inside your domain) specifying which parts of the field you want to read
+            See [1] and [2]
+        fields : array_like
+            Tuples (ptype, pfield) representing a field
+
+        Returns
+        -------
+        dict
+            keys are tuples (ptype, pfield) representing a field
+            values are (N,) ndarrays with data from that field
+        """
+        f = self._handle
+        bp = self.base_path
+        pp = self.particles_path
+        ds = f[bp + pp]
+        unions = self.ds.particle_unions
+        chunks = list(chunks)  # chunks is a generator
+
+        rv = {}
+        ind = {}
+        particle_count = {}
+        ptf = defaultdict(list)  # ParticleTypes&Fields
+        rfm = defaultdict(list)  # RequestFieldMapping
+
+        for (ptype, pname) in fields:
+            pfield = (ptype, pname)
+            # Overestimate the size of all pfields so they include all particles, shrink it later
+            particle_count[pfield] = 0
+            if ptype in unions:
+                for pt in unions[ptype]:
+                    particle_count[pfield] += self.ds.particle_type_counts[pt]
+                    ptf[pt].append(pname)
+                    rfm[pt, pname].append(pfield)
+            else:
+                particle_count[pfield] = self.ds.particle_type_counts[ptype]
+                ptf[ptype].append(pname)
+                rfm[pfield].append(pfield)
+            rv[pfield] = np.empty((particle_count[pfield],), dtype=np.float64)
+            ind[pfield] = 0
+
+        for ptype in ptf:
+            for chunk in chunks:
+                for grid in chunk.objs:
+                    if str(ptype) == "io":
+                        species = list(ds.keys())[0]
+                    else:
+                        species = ptype
+                    if species not in grid.ptypes:
+                        continue
+                    # read particle coords into cache
+                    self._fill_cache(species, grid.pindex, grid.poffset)
+                    mask = selector.select_points(self.cache[0], self.cache[1], self.cache[2], 0.0)
+                    if mask is None:
+                        continue
+                    pds = ds[species]
+                    for field in ptf[ptype]:
+                        component = "/".join(field.split("_")[1:])
+                        component = component.replace("positionCoarse", "position")
+                        component = component.replace("-", "_")
+                        data = get_component(pds, component, grid.pindex, grid.poffset)[mask]
+                        for request_field in rfm[(ptype, field)]:
+                            rv[request_field][ind[request_field]:ind[request_field] + data.shape[0]] = data
+                            ind[request_field] += data.shape[0]
+
+        for field in fields:
+            rv[field] = rv[field][:ind[field]]
+
+        return rv
+
+    def _read_fluid_selection(self, chunks, selector, fields, size):
+        """Reads given fields masked by a given selection.
+
+        Parameters
+        ----------
+        chunks
+            A list of chunks
+            A chunk is a list of grids
+        selector
+            A region (inside your domain) specifying which parts of the field you want to read
+            See [1] and [2]
+        fields : array_like
+            Tuples (fname, ftype) representing a field
+        size : int
+            Size of the data to read
+
+        Returns
+        -------
+        dict
+            keys are tuples (ftype, fname) representing a field
+            values are flat (``size``,) ndarrays with data from that field
+        """
+        f = self._handle
+        bp = self.base_path
+        mp = self.meshes_path
+        ds = f[bp + mp]
+        chunks = list(chunks)
+
+        rv = {}
+        ind = {}
+
+        if selector.__class__.__name__ == "GridSelector":
+            if not (len(chunks) == len(chunks[0].objs) == 1):
+                raise RuntimeError
+
+        if size is None:
+            size = sum((g.count(selector) for chunk in chunks
+                        for g in chunk.objs))
+        for field in fields:
+            rv[field] = np.empty(size, dtype=np.float64)
+            ind[field] = 0
+
+        for (ftype, fname) in fields:
+            field = (ftype, fname)
+            for chunk in chunks:
+                for grid in chunk.objs:
+                    component = fname.replace("_", "/").replace("-", "_")
+                    if component.split("/")[0] not in grid.ftypes:
+                        continue
+                    mask = grid._get_selector_mask(selector)
+                    if mask is None:
+                        continue
+                    data = get_component(ds, component, grid.findex, grid.foffset)
+                    # The following is a modified AMRGridPatch.select(...)
+                    data.shape = mask.shape  # Workaround - casts a 2D (x,y) array to 3D (x,y,1)
+                    count = grid.count(selector)
+                    rv[field][ind[field]:ind[field] + count] = data[mask]
+                    ind[field] += count
+
+        for field in fields:
+            rv[field] = rv[field][:ind[field]]
+            rv[field].flatten()
+
+        return rv

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/open_pmd/misc.py
--- /dev/null
+++ b/yt/frontends/open_pmd/misc.py
@@ -0,0 +1,125 @@
+# -----------------------------------------------------------------------------
+# Copyright (c) 2016, Fabian Koller (HZDR)
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+# -----------------------------------------------------------------------------
+
+import numpy as np
+
+from yt.utilities.logger import ytLogger as mylog
+
+
+def parse_unit_dimension(unit_dimension):
+    """Transforms an openPMD unitDimension into a string.
+
+    Parameters
+    ----------
+    unit_dimension : array_like
+        integer array of length 7 with one entry for the dimensional component of every SI unit
+
+        [0] length L,
+        [1] mass M,
+        [2] time T,
+        [3] electric current I,
+        [4] thermodynamic temperature theta,
+        [5] amount of substance N,
+        [6] luminous intensity J
+
+    References
+    ----------
+    .. https://github.com/openPMD/openPMD-standard/blob/latest/STANDARD.md#unit-systems-and-dimensionality
+
+    Returns
+    -------
+    str
+
+    Examples
+    --------
+    >>> velocity = [1., 0., -1., 0., 0., 0., 0.]
+    >>> print parse_unit_dimension(velocity)
+    'm**1*s**-1'
+
+    >>> magnetic_field = [0., 1., -2., -1., 0., 0., 0.]
+    >>> print parse_unit_dimension(magnetic_field)
+    'kg**1*s**-2*A**-1'
+    """
+    if len(unit_dimension) is not 7:
+        mylog.error("open_pmd - SI must have 7 base dimensions!")
+    unit_dimension = np.asarray(unit_dimension, dtype=np.int)
+    dim = []
+    si = ["m",
+          "kg",
+          "s",
+          "A",
+          "C",
+          "mol",
+          "cd"]
+    for i in np.arange(7):
+        if unit_dimension[i] != 0:
+            dim.append("{}**{}".format(si[i], unit_dimension[i]))
+    return "*".join(dim)
+
+
+def is_const_component(record_component):
+    """Determines whether a group or dataset in the HDF5 file is constant.
+
+    Parameters
+    ----------
+    record_component : h5py.Group or h5py.Dataset
+
+    Returns
+    -------
+    bool
+        True if constant, False otherwise
+
+    References
+    ----------
+    .. https://github.com/openPMD/openPMD-standard/blob/latest/STANDARD.md,
+       section 'Constant Record Components'
+    """
+    return "value" in record_component.attrs.keys()
+
+
+def get_component(group, component_name, index=0, offset=None):
+    """Grabs a dataset component from a group as a whole or sliced.
+
+    Parameters
+    ----------
+    group : h5py.Group
+    component_name : str
+        relative path of the component in the group
+    index : int, optional
+        first entry along the first axis to read
+    offset : int, optional
+        number of entries to read
+        if not supplied, every entry after index is returned
+
+    Notes
+    -----
+    This scales every entry of the component with the respective "unitSI".
+
+    Returns
+    -------
+    ndarray
+        (N,) 1D in case of particle data
+        (O,P,Q) 1D/2D/3D in case of mesh data
+    """
+    record_component = group[component_name]
+    unit_si = record_component.attrs["unitSI"]
+    if is_const_component(record_component):
+        shape = np.asarray(record_component.attrs["shape"])
+        if offset is None:
+            shape[0] -= index
+        else:
+            shape[0] = offset
+        # component is constant, craft an array by hand
+        # mylog.debug("open_pmd - get_component: {}/{} [const {}]".format(group.name, component_name, shape))
+        return np.full(shape, record_component.attrs["value"] * unit_si)
+    else:
+        if offset is not None:
+            offset += index
+        # component is a dataset, return it (possibly masked)
+        # mylog.debug("open_pmd - get_component: {}/{}[{}:{}]".format(group.name, component_name, index, offset))
+        return np.multiply(record_component[index:offset], unit_si)

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/open_pmd/tests/test_outputs.py
--- /dev/null
+++ b/yt/frontends/open_pmd/tests/test_outputs.py
@@ -0,0 +1,137 @@
+"""
+openPMD frontend tests
+
+
+
+"""
+
+# -----------------------------------------------------------------------------
+# Copyright (c) 2016, Fabian Koller (HZDR).
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+# -----------------------------------------------------------------------------
+
+from yt.frontends.open_pmd.data_structures import \
+    OpenPMDDataset
+from yt.testing import \
+    assert_almost_equal, \
+    assert_equal, \
+    assert_array_equal, \
+    requires_file
+from yt.utilities.answer_testing.framework import \
+    data_dir_load
+
+import numpy as np
+
+twoD = "example-2d/hdf5/data00000100.h5"
+threeD = "example-3d/hdf5/data00000100.h5"
+
+
+ at requires_file(threeD)
+def test_3d_out():
+    ds = data_dir_load(threeD)
+    field_list = [('all', 'particle_charge'),
+                  ('all', 'particle_mass'),
+                  ('all', 'particle_momentum_x'),
+                  ('all', 'particle_momentum_y'),
+                  ('all', 'particle_momentum_z'),
+                  ('all', 'particle_positionCoarse_x'),
+                  ('all', 'particle_positionCoarse_y'),
+                  ('all', 'particle_positionCoarse_z'),
+                  ('all', 'particle_positionOffset_x'),
+                  ('all', 'particle_positionOffset_y'),
+                  ('all', 'particle_positionOffset_z'),
+                  ('all', 'particle_weighting'),
+                  ('io', 'particle_charge'),
+                  ('io', 'particle_mass'),
+                  ('io', 'particle_momentum_x'),
+                  ('io', 'particle_momentum_y'),
+                  ('io', 'particle_momentum_z'),
+                  ('io', 'particle_positionCoarse_x'),
+                  ('io', 'particle_positionCoarse_y'),
+                  ('io', 'particle_positionCoarse_z'),
+                  ('io', 'particle_positionOffset_x'),
+                  ('io', 'particle_positionOffset_y'),
+                  ('io', 'particle_positionOffset_z'),
+                  ('io', 'particle_weighting'),
+                  ('openPMD', 'E_x'),
+                  ('openPMD', 'E_y'),
+                  ('openPMD', 'E_z'),
+                  ('openPMD', 'rho')]
+    domain_dimensions = [26, 26, 201] * np.ones_like(ds.domain_dimensions)
+    domain_width = [2.08e-05, 2.08e-05, 2.01e-05] * np.ones_like(ds.domain_left_edge)
+
+    assert isinstance(ds, OpenPMDDataset)
+    yield assert_equal, str(ds), "data00000100.h5"
+    yield assert_equal, ds.dimensionality, 3
+    yield assert_equal, ds.particle_types_raw, ('io',)
+    assert "all" in ds.particle_unions
+    yield assert_array_equal, ds.field_list, field_list
+    yield assert_array_equal, ds.domain_dimensions, domain_dimensions
+    yield assert_almost_equal, ds.current_time, 3.28471214521e-14 * np.ones_like(ds.current_time)
+    yield assert_almost_equal, ds.domain_right_edge - ds.domain_left_edge, domain_width
+
+
+ at requires_file(twoD)
+def test_2d_out():
+    ds = data_dir_load(twoD)
+    field_list = [('Hydrogen1+', 'particle_charge'),
+                  ('Hydrogen1+', 'particle_mass'),
+                  ('Hydrogen1+', 'particle_momentum_x'),
+                  ('Hydrogen1+', 'particle_momentum_y'),
+                  ('Hydrogen1+', 'particle_momentum_z'),
+                  ('Hydrogen1+', 'particle_positionCoarse_x'),
+                  ('Hydrogen1+', 'particle_positionCoarse_y'),
+                  ('Hydrogen1+', 'particle_positionCoarse_z'),
+                  ('Hydrogen1+', 'particle_positionOffset_x'),
+                  ('Hydrogen1+', 'particle_positionOffset_y'),
+                  ('Hydrogen1+', 'particle_positionOffset_z'),
+                  ('Hydrogen1+', 'particle_weighting'),
+                  ('all', 'particle_charge'),
+                  ('all', 'particle_mass'),
+                  ('all', 'particle_momentum_x'),
+                  ('all', 'particle_momentum_y'),
+                  ('all', 'particle_momentum_z'),
+                  ('all', 'particle_positionCoarse_x'),
+                  ('all', 'particle_positionCoarse_y'),
+                  ('all', 'particle_positionCoarse_z'),
+                  ('all', 'particle_positionOffset_x'),
+                  ('all', 'particle_positionOffset_y'),
+                  ('all', 'particle_positionOffset_z'),
+                  ('all', 'particle_weighting'),
+                  ('electrons', 'particle_charge'),
+                  ('electrons', 'particle_mass'),
+                  ('electrons', 'particle_momentum_x'),
+                  ('electrons', 'particle_momentum_y'),
+                  ('electrons', 'particle_momentum_z'),
+                  ('electrons', 'particle_positionCoarse_x'),
+                  ('electrons', 'particle_positionCoarse_y'),
+                  ('electrons', 'particle_positionCoarse_z'),
+                  ('electrons', 'particle_positionOffset_x'),
+                  ('electrons', 'particle_positionOffset_y'),
+                  ('electrons', 'particle_positionOffset_z'),
+                  ('electrons', 'particle_weighting'),
+                  ('openPMD', 'B_x'),
+                  ('openPMD', 'B_y'),
+                  ('openPMD', 'B_z'),
+                  ('openPMD', 'E_x'),
+                  ('openPMD', 'E_y'),
+                  ('openPMD', 'E_z'),
+                  ('openPMD', 'J_x'),
+                  ('openPMD', 'J_y'),
+                  ('openPMD', 'J_z'),
+                  ('openPMD', 'rho')]
+    domain_dimensions = [51, 201, 1] * np.ones_like(ds.domain_dimensions)
+    domain_width = [3.06e-05, 2.01e-05, 1e+0] * np.ones_like(ds.domain_left_edge)
+
+    assert isinstance(ds, OpenPMDDataset)
+    yield assert_equal, str(ds), "data00000100.h5"
+    yield assert_equal, ds.dimensionality, 2
+    yield assert_equal, ds.particle_types_raw, ('Hydrogen1+', 'electrons')
+    assert "all" in ds.particle_unions
+    yield assert_array_equal, ds.field_list, field_list
+    yield assert_array_equal, ds.domain_dimensions, domain_dimensions
+    yield assert_almost_equal, ds.current_time, 3.29025596712e-14 * np.ones_like(ds.current_time)
+    yield assert_almost_equal, ds.domain_right_edge - ds.domain_left_edge, domain_width

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/frontends/tipsy/io.py
--- a/yt/frontends/tipsy/io.py
+++ b/yt/frontends/tipsy/io.py
@@ -321,8 +321,12 @@
         tot_parts = np.sum(list(data_file.total_particles.values()))
         endian = data_file.ds.endian
         self._aux_pdtypes = {}
-        self._aux_fields = [f.rsplit('.')[-1]
-                            for f in glob.glob(data_file.filename + '.*')]
+        self._aux_fields = []
+        for f in glob.glob(data_file.filename + '.*'):
+            afield = f.rsplit('.')[-1]
+            filename = data_file.filename + '.' + afield
+            if not os.path.exists(filename): continue
+            self._aux_fields.append(afield)
         for afield in self._aux_fields:
             filename = data_file.filename + '.' + afield
             # We need to do some fairly ugly detection to see what format the

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/geometry/coordinates/cartesian_coordinates.py
--- a/yt/geometry/coordinates/cartesian_coordinates.py
+++ b/yt/geometry/coordinates/cartesian_coordinates.py
@@ -172,4 +172,3 @@
     @property
     def period(self):
         return self.ds.domain_width
-

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/geometry/geometry_handler.py
--- a/yt/geometry/geometry_handler.py
+++ b/yt/geometry/geometry_handler.py
@@ -270,7 +270,7 @@
         else:
             tr = func(self)
         if self._cache:
-        
+
             setattr(self, n, tr)
         return tr
     return property(cached_func)
@@ -397,7 +397,9 @@
 
     @cached_property
     def fcoords_vertex(self):
-        ci = np.empty((self.data_size, 8, 3), dtype='float64')
+        nodes_per_elem = self.dobj.index.meshes[0].connectivity_indices.shape[1]
+        dim = self.dobj.ds.dimensionality
+        ci = np.empty((self.data_size, nodes_per_elem, dim), dtype='float64')
         ci = YTArray(ci, input_units = "code_length",
                      registry = self.dobj.ds.unit_registry)
         if self.data_size == 0: return ci
@@ -426,10 +428,10 @@
 
     def __iter__(self):
         return self
-    
+
     def __next__(self):
         return self.next()
-        
+
     def next(self):
         if len(self.queue) == 0:
             for i in range(self.max_length):
@@ -445,4 +447,3 @@
         g = self.queue.pop(0)
         g._initialize_cache(self.cache.pop(g.id, {}))
         return g
-

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -714,7 +714,7 @@
 
     def compare(self, new_result, old_result):
         compare_image_lists(new_result, old_result, self.decimals)
-        
+
 class PlotWindowAttributeTest(AnswerTestingTest):
     _type_name = "PlotWindowAttribute"
     _attrs = ('plot_type', 'plot_field', 'plot_axis', 'attr_name', 'attr_args',
@@ -758,7 +758,7 @@
     _type_name = "PhasePlotAttribute"
     _attrs = ('plot_type', 'x_field', 'y_field', 'z_field',
               'attr_name', 'attr_args')
-    def __init__(self, ds_fn, x_field, y_field, z_field, 
+    def __init__(self, ds_fn, x_field, y_field, z_field,
                  attr_name, attr_args, decimals, plot_type='PhasePlot'):
         super(PhasePlotAttributeTest, self).__init__(ds_fn)
         self.data_source = self.ds.all_data()
@@ -771,7 +771,7 @@
         self.attr_args = attr_args
         self.decimals = decimals
 
-    def create_plot(self, data_source, x_field, y_field, z_field, 
+    def create_plot(self, data_source, x_field, y_field, z_field,
                     plot_type, plot_kwargs=None):
         # plot_type should be a string
         # plot_kwargs should be a dict
@@ -928,7 +928,7 @@
         return ftrue
     else:
         return ffalse
-    
+
 def requires_ds(ds_fn, big_data = False, file_check = False):
     def ffalse(func):
         return lambda: None

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/utilities/lib/autogenerated_element_samplers.pxd
--- a/yt/utilities/lib/autogenerated_element_samplers.pxd
+++ b/yt/utilities/lib/autogenerated_element_samplers.pxd
@@ -25,6 +25,33 @@
                        double* phys_x) nogil 
 
  
+cdef void Tet2Function3D(double* fx,
+                       double* x,
+                       double* vertices,
+                       double* phys_x) nogil 
+
+ 
+cdef void Tet2Jacobian3D(double* rcol,
+                       double* scol,
+                       double* tcol,
+                       double* x,
+                       double* vertices,
+                       double* phys_x) nogil 
+
+ 
+cdef void T2Function2D(double* fx,
+                       double* x,
+                       double* vertices,
+                       double* phys_x) nogil 
+
+ 
+cdef void T2Jacobian2D(double* rcol,
+                       double* scol,
+                       double* x,
+                       double* vertices,
+                       double* phys_x) nogil 
+
+ 
 cdef void W1Function3D(double* fx,
                        double* x,
                        double* vertices,

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/utilities/lib/autogenerated_element_samplers.pyx
--- a/yt/utilities/lib/autogenerated_element_samplers.pyx
+++ b/yt/utilities/lib/autogenerated_element_samplers.pyx
@@ -5,7 +5,7 @@
 
  
 cimport cython 
- 
+from libc.math cimport pow 
 
  
 @cython.boundscheck(False)
@@ -68,6 +68,63 @@
 @cython.boundscheck(False)
 @cython.wraparound(False)
 @cython.cdivision(True) 
+cdef void Tet2Function3D(double* fx,
+                       double* x,
+                       double* vertices,
+                       double* phys_x) nogil: 
+	fx[0] = (-x[0] + 2*pow(x[0], 2))*vertices[3] + (-x[1] + 2*pow(x[1], 2))*vertices[6] + (-x[2] + 2*pow(x[2], 2))*vertices[9] + (4*x[0] - 4*x[0]*x[1] - 4*x[0]*x[2] - 4*pow(x[0], 2))*vertices[12] + (4*x[1] - 4*x[1]*x[0] - 4*x[1]*x[2] - 4*pow(x[1], 2))*vertices[18] + (4*x[2] - 4*x[2]*x[0] - 4*x[2]*x[1] - 4*pow(x[2], 2))*vertices[21] + (1 - 3*x[0] + 4*x[0]*x[1] + 4*x[0]*x[2] + 2*pow(x[0], 2) - 3*x[1] + 4*x[1]*x[2] + 2*pow(x[1], 2) - 3*x[2] + 2*pow(x[2], 2))*vertices[0] - phys_x[0] + 4*x[0]*x[1]*vertices[15] + 4*x[0]*x[2]*vertices[24] + 4*x[1]*x[2]*vertices[27];
+	fx[1] = (-x[0] + 2*pow(x[0], 2))*vertices[4] + (-x[1] + 2*pow(x[1], 2))*vertices[7] + (-x[2] + 2*pow(x[2], 2))*vertices[10] + (4*x[0] - 4*x[0]*x[1] - 4*x[0]*x[2] - 4*pow(x[0], 2))*vertices[13] + (4*x[1] - 4*x[1]*x[0] - 4*x[1]*x[2] - 4*pow(x[1], 2))*vertices[19] + (4*x[2] - 4*x[2]*x[0] - 4*x[2]*x[1] - 4*pow(x[2], 2))*vertices[22] + (1 - 3*x[0] + 4*x[0]*x[1] + 4*x[0]*x[2] + 2*pow(x[0], 2) - 3*x[1] + 4*x[1]*x[2] + 2*pow(x[1], 2) - 3*x[2] + 2*pow(x[2], 2))*vertices[1] - phys_x[1] + 4*x[0]*x[1]*vertices[16] + 4*x[0]*x[2]*vertices[25] + 4*x[1]*x[2]*vertices[28];
+	fx[2] = (-x[0] + 2*pow(x[0], 2))*vertices[5] + (-x[1] + 2*pow(x[1], 2))*vertices[8] + (-x[2] + 2*pow(x[2], 2))*vertices[11] + (4*x[0] - 4*x[0]*x[1] - 4*x[0]*x[2] - 4*pow(x[0], 2))*vertices[14] + (4*x[1] - 4*x[1]*x[0] - 4*x[1]*x[2] - 4*pow(x[1], 2))*vertices[20] + (4*x[2] - 4*x[2]*x[0] - 4*x[2]*x[1] - 4*pow(x[2], 2))*vertices[23] + (1 - 3*x[0] + 4*x[0]*x[1] + 4*x[0]*x[2] + 2*pow(x[0], 2) - 3*x[1] + 4*x[1]*x[2] + 2*pow(x[1], 2) - 3*x[2] + 2*pow(x[2], 2))*vertices[2] - phys_x[2] + 4*x[0]*x[1]*vertices[17] + 4*x[0]*x[2]*vertices[26] + 4*x[1]*x[2]*vertices[29];
+
+ 
+ at cython.boundscheck(False)
+ at cython.wraparound(False)
+ at cython.cdivision(True) 
+cdef void Tet2Jacobian3D(double* rcol,
+                       double* scol,
+                       double* tcol,
+                       double* x,
+                       double* vertices,
+                       double* phys_x) nogil: 
+	rcol[0] = (-1 + 4*x[0])*vertices[3] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[0] + (4 - 8*x[0] - 4*x[1] - 4*x[2])*vertices[12] + 4*x[1]*vertices[15] - 4*x[1]*vertices[18] - 4*x[2]*vertices[21] + 4*x[2]*vertices[24];
+	scol[0] = (-1 + 4*x[1])*vertices[6] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[0] + (4 - 4*x[0] - 8*x[1] - 4*x[2])*vertices[18] - 4*x[0]*vertices[12] + 4*x[0]*vertices[15] - 4*x[2]*vertices[21] + 4*x[2]*vertices[27];
+	tcol[0] = (-1 + 4*x[2])*vertices[9] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[0] + (4 - 4*x[0] - 4*x[1] - 8*x[2])*vertices[21] - 4*x[0]*vertices[12] + 4*x[0]*vertices[24] - 4*x[1]*vertices[18] + 4*x[1]*vertices[27];
+	rcol[1] = (-1 + 4*x[0])*vertices[4] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[1] + (4 - 8*x[0] - 4*x[1] - 4*x[2])*vertices[13] + 4*x[1]*vertices[16] - 4*x[1]*vertices[19] - 4*x[2]*vertices[22] + 4*x[2]*vertices[25];
+	scol[1] = (-1 + 4*x[1])*vertices[7] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[1] + (4 - 4*x[0] - 8*x[1] - 4*x[2])*vertices[19] - 4*x[0]*vertices[13] + 4*x[0]*vertices[16] - 4*x[2]*vertices[22] + 4*x[2]*vertices[28];
+	tcol[1] = (-1 + 4*x[2])*vertices[10] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[1] + (4 - 4*x[0] - 4*x[1] - 8*x[2])*vertices[22] - 4*x[0]*vertices[13] + 4*x[0]*vertices[25] - 4*x[1]*vertices[19] + 4*x[1]*vertices[28];
+	rcol[2] = (-1 + 4*x[0])*vertices[5] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[2] + (4 - 8*x[0] - 4*x[1] - 4*x[2])*vertices[14] + 4*x[1]*vertices[17] - 4*x[1]*vertices[20] - 4*x[2]*vertices[23] + 4*x[2]*vertices[26];
+	scol[2] = (-1 + 4*x[1])*vertices[8] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[2] + (4 - 4*x[0] - 8*x[1] - 4*x[2])*vertices[20] - 4*x[0]*vertices[14] + 4*x[0]*vertices[17] - 4*x[2]*vertices[23] + 4*x[2]*vertices[29];
+	tcol[2] = (-1 + 4*x[2])*vertices[11] + (-3 + 4*x[0] + 4*x[1] + 4*x[2])*vertices[2] + (4 - 4*x[0] - 4*x[1] - 8*x[2])*vertices[23] - 4*x[0]*vertices[14] + 4*x[0]*vertices[26] - 4*x[1]*vertices[20] + 4*x[1]*vertices[29];
+
+ 
+ at cython.boundscheck(False)
+ at cython.wraparound(False)
+ at cython.cdivision(True) 
+cdef void T2Function2D(double* fx,
+                       double* x,
+                       double* vertices,
+                       double* phys_x) nogil: 
+	fx[0] = (-x[0] + 2*pow(x[0], 2))*vertices[2] + (-x[1] + 2*pow(x[1], 2))*vertices[4] + (-4*x[0]*x[1] + 4*x[1] - 4*pow(x[1], 2))*vertices[10] + (4*x[0] - 4*x[0]*x[1] - 4*pow(x[0], 2))*vertices[6] + (1 - 3*x[0] + 4*x[0]*x[1] + 2*pow(x[0], 2) - 3*x[1] + 2*pow(x[1], 2))*vertices[0] - phys_x[0] + 4*x[0]*x[1]*vertices[8];
+	fx[1] = (-x[0] + 2*pow(x[0], 2))*vertices[3] + (-x[1] + 2*pow(x[1], 2))*vertices[5] + (-4*x[0]*x[1] + 4*x[1] - 4*pow(x[1], 2))*vertices[11] + (4*x[0] - 4*x[0]*x[1] - 4*pow(x[0], 2))*vertices[7] + (1 - 3*x[0] + 4*x[0]*x[1] + 2*pow(x[0], 2) - 3*x[1] + 2*pow(x[1], 2))*vertices[1] - phys_x[1] + 4*x[0]*x[1]*vertices[9];
+
+ 
+ at cython.boundscheck(False)
+ at cython.wraparound(False)
+ at cython.cdivision(True) 
+cdef void T2Jacobian2D(double* rcol,
+                       double* scol,
+                       double* x,
+                       double* vertices,
+                       double* phys_x) nogil: 
+	rcol[0] = (-1 + 4*x[0])*vertices[2] + (-3 + 4*x[0] + 4*x[1])*vertices[0] + (4 - 8*x[0] - 4*x[1])*vertices[6] + 4*x[1]*vertices[8] - 4*x[1]*vertices[10];
+	scol[0] = (-1 + 4*x[1])*vertices[4] + (-3 + 4*x[0] + 4*x[1])*vertices[0] + (4 - 4*x[0] - 8*x[1])*vertices[10] - 4*x[0]*vertices[6] + 4*x[0]*vertices[8];
+	rcol[1] = (-1 + 4*x[0])*vertices[3] + (-3 + 4*x[0] + 4*x[1])*vertices[1] + (4 - 8*x[0] - 4*x[1])*vertices[7] + 4*x[1]*vertices[9] - 4*x[1]*vertices[11];
+	scol[1] = (-1 + 4*x[1])*vertices[5] + (-3 + 4*x[0] + 4*x[1])*vertices[1] + (4 - 4*x[0] - 8*x[1])*vertices[11] - 4*x[0]*vertices[7] + 4*x[0]*vertices[9];
+
+ 
+ at cython.boundscheck(False)
+ at cython.wraparound(False)
+ at cython.cdivision(True) 
 cdef void W1Function3D(double* fx,
                        double* x,
                        double* vertices,

diff -r d8dcc8339b23bd970b7d52027b0df39a84d0e71b -r 9725f3030c06347b30c1dcda9088b1ab3b614bda yt/utilities/lib/element_mappings.pxd
--- a/yt/utilities/lib/element_mappings.pxd
+++ b/yt/utilities/lib/element_mappings.pxd
@@ -13,7 +13,7 @@
     cdef int num_mapped_coords
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
 
@@ -21,7 +21,7 @@
     cdef double sample_at_unit_point(self,
                                      double* coord,
                                      double* vals) nogil
-    
+
 
     cdef double sample_at_real_point(self,
                                      double* vertices,
@@ -36,7 +36,7 @@
 cdef class P1Sampler2D(ElementSampler):
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
 
@@ -51,7 +51,7 @@
 cdef class P1Sampler3D(ElementSampler):
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
 
@@ -67,7 +67,7 @@
 
 # This typedef defines a function pointer that defines the system
 # of equations that will be solved by the NonlinearSolveSamplers.
-# 
+#
 # inputs:
 #     x        - pointer to the mapped coordinate
 #     vertices - pointer to the element vertices
@@ -78,15 +78,15 @@
 #     fx - the result of solving the system, should be close to 0
 #          once it is converged.
 #
-ctypedef void (*func_type)(double* fx, 
-                           double* x, 
-                           double* vertices, 
+ctypedef void (*func_type)(double* fx,
+                           double* x,
+                           double* vertices,
                            double* phys_x) nogil
 
 # This typedef defines a function pointer that defines the Jacobian
-# matrix used by the NonlinearSolveSampler3D. Subclasses needed to 
+# matrix used by the NonlinearSolveSampler3D. Subclasses needed to
 # define a Jacobian function in this form.
-# 
+#
 # inputs:
 #     x        - pointer to the mapped coordinate
 #     vertices - pointer to the element vertices
@@ -98,18 +98,18 @@
 #     scol     - the second column of the jacobian
 #     tcol     - the third column of the jaocobian
 #
-ctypedef void (*jac_type3D)(double* rcol, 
-                            double* scol, 
-                            double* tcol, 
-                            double* x, 
-                            double* vertices, 
+ctypedef void (*jac_type3D)(double* rcol,
+                            double* scol,
+                            double* tcol,
+                            double* x,
+                            double* vertices,
                             double* phys_x) nogil
 
 
 # This typedef defines a function pointer that defines the Jacobian
-# matrix used by the NonlinearSolveSampler2D. Subclasses needed to 
+# matrix used by the NonlinearSolveSampler2D. Subclasses needed to
 # define a Jacobian function in this form.
-# 
+#
 # inputs:
 #     x        - pointer to the mapped coordinate
 #     vertices - pointer to the element vertices
@@ -132,19 +132,19 @@
     cdef int dim
     cdef int max_iter
     cdef np.float64_t tolerance
-    cdef func_type func 
+    cdef func_type func
     cdef jac_type3D jac
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
-    
+
 
 cdef class Q1Sampler3D(NonlinearSolveSampler3D):
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
 
@@ -161,7 +161,7 @@
 cdef class W1Sampler3D(NonlinearSolveSampler3D):
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
 
@@ -179,7 +179,7 @@
 cdef class S2Sampler3D(NonlinearSolveSampler3D):
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
 
@@ -199,19 +199,19 @@
     cdef int dim
     cdef int max_iter
     cdef np.float64_t tolerance
-    cdef func_type func 
+    cdef func_type func
     cdef jac_type2D jac
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
-    
+
 
 cdef class Q1Sampler2D(NonlinearSolveSampler2D):
 
     cdef void map_real_to_unit(self,
-                               double* mapped_x, 
+                               double* mapped_x,
                                double* vertices,
                                double* physical_x) nogil
 
@@ -221,3 +221,31 @@
                                      double* vals) nogil
 
     cdef int check_inside(self, double* mapped_coord) nogil
+
+cdef class T2Sampler2D(NonlinearSolveSampler2D):
+
+    cdef void map_real_to_unit(self,
+                               double* mapped_x,
+                               double* vertices,
+                               double* physical_x) nogil
+
+
+    cdef double sample_at_unit_point(self,
+                                     double* coord,
+                                     double* vals) nogil
+
+    cdef int check_inside(self, double* mapped_coord) nogil
+
+cdef class Tet2Sampler3D(NonlinearSolveSampler3D):
+
+    cdef void map_real_to_unit(self,
+                               double* mapped_x,
+                               double* vertices,
+                               double* physical_x) nogil
+
+
+    cdef double sample_at_unit_point(self,
+                                     double* coord,
+                                     double* vals) nogil
+
+    cdef int check_inside(self, double* mapped_coord) nogil

This diff is so big that we needed to truncate the remainder.

https://bitbucket.org/yt_analysis/yt/commits/f34076bd102c/
Changeset:   f34076bd102c
Branch:      yt
User:        al007
Date:        2016-09-23 22:36:11+00:00
Summary:     Update add_field calls for particle fields.
Affected #:  2 files

diff -r 9725f3030c06347b30c1dcda9088b1ab3b614bda -r f34076bd102c315e230fbdfa86c472f2ff5da400 yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -86,9 +86,9 @@
             return velocity
 
         for ax in 'xyz':
-            self.add_field((ptype, "particle_velocity_%s" % ax), 
+            self.add_field((ptype, "particle_velocity_%s" % ax),
+                           "particle",
                            function=_get_vel(ax),
-                           sampling_type = "particle",
                            units="code_length/code_time")
 
         super(Orion2FieldInfo, self).setup_particle_fields(ptype)
@@ -130,7 +130,7 @@
             return data['kinetic_energy']/data['density']
 
         def _temperature(field, data):
-            c_v = data.ds.quan(data.ds.parameters['radiation.const_cv'], 
+            c_v = data.ds.quan(data.ds.parameters['radiation.const_cv'],
                                'erg/g/K')
             return (data["thermal_energy"]/c_v)
 
@@ -199,8 +199,8 @@
                 output_units = units
             if (ptype, f) not in self.field_list:
                 continue
-            self.add_output_field((ptype, f),
-                units = units, sampling_type = "particle",
+            self.add_output_field((ptype, f), "particle",
+                units = units,
                 display_name = dn, output_units = output_units, take_log=False)
             for alias in aliases:
                 self.alias((ptype, alias), (ptype, f), units = output_units)
@@ -219,9 +219,8 @@
                 raise RuntimeError
             if field[0] not in self.ds.particle_types:
                 continue
-            self.add_output_field(field, 
-                                  units = self.ds.field_units.get(field, ""),
-                                  sampling_type = "particle")
+            self.add_output_field(field, "particle",
+                                  units = self.ds.field_units.get(field, ""))
         self.setup_smoothed_fields(ptype,
                                    num_neighbors=num_neighbors,
                                    ftype=ftype)
@@ -261,16 +260,16 @@
         super(ChomboPICFieldInfo2D, self).__init__(ds, field_list)
 
         for ftype in fluid_field_types:
-            self.add_field((ftype, 'gravitational_field_z'), function = _dummy_field, 
+            self.add_field((ftype, 'gravitational_field_z'), function = _dummy_field,
                             units = "code_length / code_time**2")
 
-        for ptype in particle_field_types:                
-            self.add_field((ptype, "particle_position_z"), function = _dummy_position,
-                           sampling_type = "particle",
+        for ptype in particle_field_types:
+            self.add_field((ptype, "particle_position_z"), "particle",
+                           function = _dummy_position,
                            units = "code_length")
 
-            self.add_field((ptype, "particle_velocity_z"), function = _dummy_velocity,
-                           sampling_type = "particle",
+            self.add_field((ptype, "particle_velocity_z"), "particle",
+                           function = _dummy_velocity,
                            units = "code_length / code_time")
 
 
@@ -290,24 +289,24 @@
         super(ChomboPICFieldInfo1D, self).__init__(ds, field_list)
 
         for ftype in fluid_field_types:
-            self.add_field((ftype, 'gravitational_field_y'), function = _dummy_field, 
+            self.add_field((ftype, 'gravitational_field_y'), function = _dummy_field,
                             units = "code_length / code_time**2")
 
-            self.add_field((ftype, 'gravitational_field_z'), function = _dummy_field, 
+            self.add_field((ftype, 'gravitational_field_z'), function = _dummy_field,
                     units = "code_length / code_time**2")
 
         for ptype in particle_field_types:
-            self.add_field((ptype, "particle_position_y"), function = _dummy_position,
-                           sampling_type = "particle",
+            self.add_field((ptype, "particle_position_y"), "particle",
+                           function = _dummy_position,
                            units = "code_length")
-            self.add_field((ptype, "particle_position_z"), function = _dummy_position,
-                           sampling_type = "particle",
+            self.add_field((ptype, "particle_position_z"), "particle",
+                           function = _dummy_position,
                            units = "code_length")
-            self.add_field((ptype, "particle_velocity_y"), function = _dummy_velocity,
-                           sampling_type = "particle",
+            self.add_field((ptype, "particle_velocity_y"), "particle",
+                           function = _dummy_velocity,
                            units = "code_length / code_time")
-            self.add_field((ptype, "particle_velocity_z"), function = _dummy_velocity,
-                           sampling_type = "particle",
+            self.add_field((ptype, "particle_velocity_z"), "particle",
+                           function = _dummy_velocity,
                            units = "code_length / code_time")
 
 
@@ -329,4 +328,3 @@
         from yt.fields.magnetic_field import \
             setup_magnetic_field_aliases
         setup_magnetic_field_aliases(self, "chombo", ["bx%s" % ax for ax in [1,2,3]])
-

diff -r 9725f3030c06347b30c1dcda9088b1ab3b614bda -r f34076bd102c315e230fbdfa86c472f2ff5da400 yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -241,8 +241,7 @@
 
         def _age(field, data):
             return data.ds.current_time - data["creation_time"]
-        self.add_field((ptype, "age"), function = _age,
-                           sampling_type = "particle",
+        self.add_field((ptype, "age"), "particle", function = _age,
                            units = "yr")
 
         super(EnzoFieldInfo, self).setup_particle_fields(ptype)


https://bitbucket.org/yt_analysis/yt/commits/beb1eed79e2f/
Changeset:   beb1eed79e2f
Branch:      yt
User:        al007
Date:        2016-09-23 23:19:05+00:00
Summary:     Add "cell" sampler_type option to all add_field places in frontends other than chombo and enzo.
Affected #:  10 files

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -65,7 +65,7 @@
             tr *= (data.ds.parameters['gamma'] - 1.)
             tr /= data.ds.parameters['aexpn']**2
             return tr * data['art', 'GasEnergy'] / data['art', 'Density']
-        self.add_field(('gas', 'temperature'),
+        self.add_field(('gas', 'temperature'), "cell", 
                        function=_temperature, 
                        units=unit_system["temperature"])
 
@@ -75,7 +75,7 @@
                         data[('gas','density')])
             return velocity
         for ax in 'xyz':
-            self.add_field(('gas','velocity_%s' % ax),
+            self.add_field(('gas','velocity_%s' % ax), "cell", 
                            function = _get_vel(ax),
                            units=unit_system["velocity"])
 
@@ -85,7 +85,7 @@
                   data['gas','momentum_z']**2)**0.5
             tr *= data['index','cell_volume'].in_units('cm**3')
             return tr
-        self.add_field(('gas', 'momentum_magnitude'),
+        self.add_field(('gas', 'momentum_magnitude'), "cell", 
                        function=_momentum_magnitude,
                        units=unit_system["momentum"])
 
@@ -93,7 +93,7 @@
             tr = data['gas','momentum_magnitude']
             tr /= data['gas','cell_mass']
             return tr
-        self.add_field(('gas', 'velocity_magnitude'),
+        self.add_field(('gas', 'velocity_magnitude'), "cell", 
                        function=_velocity_magnitude,
                        units=unit_system["velocity"])
 
@@ -101,7 +101,7 @@
             tr = data['gas','metal_ia_density']
             tr += data['gas','metal_ii_density']
             return tr
-        self.add_field(('gas','metal_density'),
+        self.add_field(('gas','metal_density'), "cell", 
                        function=_metal_density,
                        units=unit_system["density"])
 
@@ -109,7 +109,7 @@
             tr = data['gas','metal_density']
             tr /= data['gas','density']
             return tr
-        self.add_field(('gas', 'metal_mass_fraction'),
+        self.add_field(('gas', 'metal_mass_fraction'), "cell", 
                        function=_metal_mass_fraction,
                        units='')
 
@@ -117,7 +117,7 @@
             tr = (1. - data.ds.parameters['Y_p'] - 
                   data['gas', 'metal_mass_fraction'])
             return tr
-        self.add_field(('gas', 'H_mass_fraction'),
+        self.add_field(('gas', 'H_mass_fraction'), "cell", 
                        function=_H_mass_fraction,
                        units='')
 
@@ -125,6 +125,6 @@
             tr = data['gas','metal_mass_fraction']
             tr /= data['gas','H_mass_fraction']
             return tr
-        self.add_field(('gas', 'metallicity'),
+        self.add_field(('gas', 'metallicity'), "cell", 
                        function=_metallicity,
                        units='')

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/artio/fields.py
--- a/yt/frontends/artio/fields.py
+++ b/yt/frontends/artio/fields.py
@@ -73,7 +73,7 @@
                 return data["momentum_%s" % axis]/data["density"]
             return velocity
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax),
+            self.add_field(("gas", "velocity_%s" % ax), "cell", 
                            function = _get_vel(ax),
                            units = unit_system["velocity"])
 
@@ -97,7 +97,7 @@
         # TODO: The conversion factor here needs to be addressed, as previously
         # it was set as:
         # unit_T = unit_v**2.0*mb / constants.k
-        self.add_field(("gas", "temperature"), function = _temperature,
+        self.add_field(("gas", "temperature"), "cell",  function = _temperature,
                        units = unit_system["temperature"])
 
         # Create a metal_density field as sum of existing metal fields. 
@@ -117,7 +117,7 @@
                 def _metal_density(field, data):
                     tr = data["metal_ii_density"]
                     return tr
-            self.add_field(("gas","metal_density"),
+            self.add_field(("gas","metal_density"), "cell", 
                            function=_metal_density,
                            units=unit_system["density"],
                            take_log=True)
@@ -137,9 +137,9 @@
                     return data["STAR","creation_time"]
                 return data.ds.current_time - data["STAR","creation_time"]
 
-            self.add_field((ptype, "creation_time"), function=_creation_time, units="yr",
+            self.add_field((ptype, "creation_time"), "cell",  function=_creation_time, units="yr",
                         particle_type=True)
-            self.add_field((ptype, "age"), function=_age, units="yr",
+            self.add_field((ptype, "age"), "cell",  function=_age, units="yr",
                         particle_type=True)
 
             if self.ds.cosmological_simulation:
@@ -151,7 +151,7 @@
                         return data["STAR","BIRTH_TIME"]
                     return 1.0/data.ds._handle.auni_from_tcode_array(data["STAR","BIRTH_TIME"]) - 1.0
 
-                self.add_field((ptype, "creation_redshift"), function=_creation_redshift,
+                self.add_field((ptype, "creation_redshift"), "cell",  function=_creation_redshift,
                         particle_type=True)
 
         super(ARTIOFieldInfo, self).setup_particle_fields(ptype)

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/athena/fields.py
--- a/yt/frontends/athena/fields.py
+++ b/yt/frontends/athena/fields.py
@@ -57,7 +57,7 @@
             elif mom_field in self.field_list:
                 self.add_output_field(mom_field,
                                       units="code_mass/code_time/code_length**2")
-                self.add_field(("gas","velocity_%s" % comp),
+                self.add_field(("gas","velocity_%s" % comp), "cell", 
                                function=velocity_field(comp), units = unit_system["velocity"])
         # Add pressure, energy, and temperature fields
         def ekin1(data):
@@ -92,12 +92,12 @@
             def _thermal_energy(field, data):
                 return data["athena","pressure"] / \
                        (data.ds.gamma-1.)/data["athena","density"]
-            self.add_field(("gas","thermal_energy"),
+            self.add_field(("gas","thermal_energy"), "cell", 
                            function=_thermal_energy,
                            units=unit_system["specific_energy"])
             def _total_energy(field, data):
                 return etot_from_pres(data)/data["athena","density"]
-            self.add_field(("gas","total_energy"),
+            self.add_field(("gas","total_energy"), "cell", 
                            function=_total_energy,
                            units=unit_system["specific_energy"])
         elif ("athena","total_energy") in self.field_list:
@@ -105,16 +105,16 @@
                                   units=pres_units)
             def _pressure(field, data):
                 return eint_from_etot(data)*(data.ds.gamma-1.0)
-            self.add_field(("gas","pressure"), function=_pressure,
+            self.add_field(("gas","pressure"), "cell",  function=_pressure,
                            units=unit_system["pressure"])
             def _thermal_energy(field, data):
                 return eint_from_etot(data)/data["athena","density"]
-            self.add_field(("gas","thermal_energy"),
+            self.add_field(("gas","thermal_energy"), "cell", 
                            function=_thermal_energy,
                            units=unit_system["specific_energy"])
             def _total_energy(field, data):
                 return data["athena","total_energy"]/data["athena","density"]
-            self.add_field(("gas","total_energy"),
+            self.add_field(("gas","total_energy"), "cell", 
                            function=_total_energy,
                            units=unit_system["specific_energy"])
 
@@ -124,7 +124,7 @@
             else:
                 mu = 0.6
             return mu*mh*data["gas","pressure"]/data["gas","density"]/kboltz
-        self.add_field(("gas","temperature"), function=_temperature,
+        self.add_field(("gas","temperature"), "cell",  function=_temperature,
                        units=unit_system["temperature"])
 
         setup_magnetic_field_aliases(self, "athena", ["cell_centered_B_%s" % ax for ax in "xyz"])

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -98,7 +98,7 @@
             return velocity
 
         for ax in 'xyz':
-            self.add_field((ptype, "particle_velocity_%s" % ax), 
+            self.add_field((ptype, "particle_velocity_%s" % ax), "cell",  
                            function=_get_vel(ax),
                            particle_type=True,
                            units="code_length/code_time")
@@ -112,14 +112,14 @@
             self.setup_momentum_to_velocity()
         elif any(f[1] == "xvel" for f in self.field_list):
             self.setup_velocity_to_momentum()
-        self.add_field(("gas", "thermal_energy"),
+        self.add_field(("gas", "thermal_energy"), "cell", 
                        function=_thermal_energy,
                        units=unit_system["specific_energy"])
-        self.add_field(("gas", "thermal_energy_density"),
+        self.add_field(("gas", "thermal_energy_density"), "cell", 
                        function=_thermal_energy_density,
                        units=unit_system["pressure"])
         if ("gas", "temperature") not in self.field_aliases:
-            self.add_field(("gas", "temperature"),
+            self.add_field(("gas", "temperature"), "cell", 
                            function=_temperature,
                            units=unit_system["temperature"])
 
@@ -129,7 +129,7 @@
                 return data["%smom" % axis]/data["density"]
             return velocity
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax),
+            self.add_field(("gas", "velocity_%s" % ax), "cell", 
                            function=_get_vel(ax),
                            units=self.ds.unit_system["velocity"])
 
@@ -139,7 +139,7 @@
                 return data["%svel" % axis]*data["density"]
             return momentum
         for ax in 'xyz':
-            self.add_field(("gas", "momentum_%s" % ax),
+            self.add_field(("gas", "momentum_%s" % ax), "cell", 
                            function=_get_mom(ax),
                            units=mom_units)
 

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/fits/fields.py
--- a/yt/frontends/fits/fields.py
+++ b/yt/frontends/fits/fields.py
@@ -37,14 +37,14 @@
             unit = str(self.ds.wcs_2d.wcs.cunit[i])
             if unit.lower() == "deg": unit = "degree"
             if unit.lower() == "rad": unit = "radian"
-            self.add_field(("fits",name), function=world_f(axis, unit), units=unit)
+            self.add_field(("fits",name), "cell",  function=world_f(axis, unit), units=unit)
 
         if self.ds.dimensionality == 3:
             def _spec(field, data):
                 axis = "xyz"[data.ds.spec_axis]
                 sp = (data[axis].ndarray_view()-self.ds._p0)*self.ds._dz + self.ds._z0
                 return data.ds.arr(sp, data.ds.spec_unit)
-            self.add_field(("fits","spectral"), function=_spec,
+            self.add_field(("fits","spectral"), "cell",  function=_spec,
                            units=self.ds.spec_unit, display_name=self.ds.spec_name)
 
     def setup_fluid_fields(self):
@@ -52,6 +52,6 @@
         if self.ds.spec_cube:
             def _pixel(field, data):
                 return data.ds.arr(data["ones"], "pixel")
-            self.add_field(("fits","pixel"), function=_pixel, units="pixel")
+            self.add_field(("fits","pixel"), "cell",  function=_pixel, units="pixel")
             self._setup_spec_cube_fields()
             return

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/fits/misc.py
--- a/yt/frontends/fits/misc.py
+++ b/yt/frontends/fits/misc.py
@@ -68,7 +68,7 @@
         cfunc = _make_counts(emin, emax)
         fname = "counts_%s-%s" % (emin, emax)
         mylog.info("Creating counts field %s." % fname)
-        ds.add_field((ftype,fname), function=cfunc,
+        ds.add_field((ftype,fname), "cell",  function=cfunc,
                      units="counts/pixel",
                      validators = [ValidateSpatial()],
                      display_name="Counts (%s-%s keV)" % (emin, emax))
@@ -178,7 +178,7 @@
         ret = data["zeros"].copy()
         ret[new_mask] = 1.
         return ret
-    ds.add_field(("gas",reg_name), function=_reg_field)
+    ds.add_field(("gas",reg_name), "cell",  function=_reg_field)
     if obj is None:
         obj = ds.all_data()
     if field_parameters is not None:

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -124,7 +124,7 @@
                 except:
                     pass
                 return ener
-            self.add_field(("gas","total_energy"), function=_ener,
+            self.add_field(("gas","total_energy"), "cell",  function=_ener,
                            units=unit_system["specific_energy"])
         if ("flash","eint") in self.field_list:
             self.add_output_field(("flash","eint"),
@@ -139,29 +139,29 @@
                 except:
                     pass
                 return eint
-            self.add_field(("gas","thermal_energy"), function=_eint,
+            self.add_field(("gas","thermal_energy"), "cell",  function=_eint,
                            units=unit_system["specific_energy"])
         ## Derived FLASH Fields
         def _nele(field, data):
             Na_code = data.ds.quan(Na, '1/code_mass')
             return data["flash","dens"]*data["flash","ye"]*Na_code
-        self.add_field(('flash','nele'), function=_nele, units="code_length**-3")
-        self.add_field(('flash','edens'), function=_nele, units="code_length**-3")
+        self.add_field(('flash','nele'), "cell",  function=_nele, units="code_length**-3")
+        self.add_field(('flash','edens'), "cell",  function=_nele, units="code_length**-3")
         def _nion(field, data):
             Na_code = data.ds.quan(Na, '1/code_mass')
             return data["flash","dens"]*data["flash","sumy"]*Na_code
-        self.add_field(('flash','nion'), function=_nion, units="code_length**-3")
+        self.add_field(('flash','nion'), "cell",  function=_nion, units="code_length**-3")
         
         if ("flash", "abar") in self.field_list:
             self.add_output_field(("flash", "abar"), units="1")
         else:
             def _abar(field, data):
                 return 1.0 / data["flash","sumy"]
-            self.add_field(("flash","abar"), function=_abar, units="1")
+            self.add_field(("flash","abar"), "cell",  function=_abar, units="1")
 
         def _number_density(fields,data):
             return (data["nele"]+data["nion"])
-        self.add_field(("gas","number_density"), function=_number_density,
+        self.add_field(("gas","number_density"), "cell",  function=_number_density,
                        units=unit_system["number_density"])
 
         setup_magnetic_field_aliases(self, "flash", ["mag%s" % ax for ax in "xyz"])

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/open_pmd/fields.py
--- a/yt/frontends/open_pmd/fields.py
+++ b/yt/frontends/open_pmd/fields.py
@@ -44,7 +44,7 @@
         return poynting
 
     for ax in "xyz":
-        self.add_field(("openPMD", "poynting_vector_%s" % ax),
+        self.add_field(("openPMD", "poynting_vector_%s" % ax), "cell", 
                        function=_get_poyn(ax),
                        units="W/m**2")
 
@@ -57,7 +57,7 @@
         mass = data[ptype, "particle_mass"] * data[ptype, "particle_weighting"]
         return speed_of_light * np.sqrt(p2 + mass ** 2 * speed_of_light ** 2) - mass * speed_of_light ** 2
 
-    self.add_field((ptype, "particle_kinetic_energy"),
+    self.add_field((ptype, "particle_kinetic_energy"), "cell", 
                    function=_kin_en,
                    units="kg*m**2/s**2",
                    particle_type=True)
@@ -78,7 +78,7 @@
         return velocity
 
     for ax in "xyz":
-        self.add_field((ptype, "particle_velocity_%s" % ax),
+        self.add_field((ptype, "particle_velocity_%s" % ax), "cell", 
                        function=_get_vel(ax),
                        units="m/s",
                        particle_type=True)
@@ -93,7 +93,7 @@
         return ap
 
     for ax in "xyz":
-        self.add_field((ptype, "particle_position_%s" % ax),
+        self.add_field((ptype, "particle_position_%s" % ax), "cell", 
                        function=_abs_pos(ax),
                        units="m",
                        particle_type=True)

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -89,7 +89,7 @@
             rv = data["gas", "pressure"]/data["gas", "density"]
             rv *= mass_hydrogen_cgs/boltzmann_constant_cgs
             return rv
-        self.add_field(("gas", "temperature"), function=_temperature,
+        self.add_field(("gas", "temperature"), "cell",  function=_temperature,
                         units=self.ds.unit_system["temperature"])
         self.create_cooling_fields()
 

diff -r f34076bd102c315e230fbdfa86c472f2ff5da400 -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f yt/frontends/ytdata/fields.py
--- a/yt/frontends/ytdata/fields.py
+++ b/yt/frontends/ytdata/fields.py
@@ -48,7 +48,7 @@
                 return data["grid", "dx"] * \
                   data["grid", "dy"] * \
                   data["grid", "dz"]
-            self.add_field(("grid", "cell_volume"), function=_cell_volume,
+            self.add_field(("grid", "cell_volume"), "cell",  function=_cell_volume,
                            units="cm**3", particle_type=True)
 
 class YTGridFieldInfo(FieldInfoContainer):


https://bitbucket.org/yt_analysis/yt/commits/10c2a5ac1d99/
Changeset:   10c2a5ac1d99
Branch:      yt
User:        al007
Date:        2016-09-25 22:34:44+00:00
Summary:     "Finish" adding sampler_type argument to frontends.
Affected #:  12 files

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/athena/fields.py
--- a/yt/frontends/athena/fields.py
+++ b/yt/frontends/athena/fields.py
@@ -51,13 +51,13 @@
             vel_field = ("athena", "velocity_%s" % comp)
             mom_field = ("athena", "momentum_%s" % comp)
             if vel_field in self.field_list:
-                self.add_output_field(vel_field, units="code_length/code_time")
+                self.add_output_field(vel_field, "cell",  units="code_length/code_time")
                 self.alias(("gas","velocity_%s" % comp), vel_field,
                            units=unit_system["velocity"])
             elif mom_field in self.field_list:
-                self.add_output_field(mom_field,
+                self.add_output_field(mom_field, "cell",
                                       units="code_mass/code_time/code_length**2")
-                self.add_field(("gas","velocity_%s" % comp), "cell", 
+                self.add_field(("gas","velocity_%s" % comp), "cell",
                                function=velocity_field(comp), units = unit_system["velocity"])
         # Add pressure, energy, and temperature fields
         def ekin1(data):
@@ -85,23 +85,23 @@
                 etot += emag(data)
             return etot
         if ("athena","pressure") in self.field_list:
-            self.add_output_field(("athena","pressure"),
+            self.add_output_field(("athena","pressure"), "cell",
                                   units=pres_units)
             self.alias(("gas","pressure"),("athena","pressure"),
                        units=unit_system["pressure"])
             def _thermal_energy(field, data):
                 return data["athena","pressure"] / \
                        (data.ds.gamma-1.)/data["athena","density"]
-            self.add_field(("gas","thermal_energy"), "cell", 
+            self.add_field(("gas","thermal_energy"), "cell",
                            function=_thermal_energy,
                            units=unit_system["specific_energy"])
             def _total_energy(field, data):
                 return etot_from_pres(data)/data["athena","density"]
-            self.add_field(("gas","total_energy"), "cell", 
+            self.add_field(("gas","total_energy"), "cell",
                            function=_total_energy,
                            units=unit_system["specific_energy"])
         elif ("athena","total_energy") in self.field_list:
-            self.add_output_field(("athena","total_energy"),
+            self.add_output_field(("athena","total_energy"), "cell",
                                   units=pres_units)
             def _pressure(field, data):
                 return eint_from_etot(data)*(data.ds.gamma-1.0)
@@ -109,12 +109,12 @@
                            units=unit_system["pressure"])
             def _thermal_energy(field, data):
                 return eint_from_etot(data)/data["athena","density"]
-            self.add_field(("gas","thermal_energy"), "cell", 
+            self.add_field(("gas","thermal_energy"), "cell",
                            function=_thermal_energy,
                            units=unit_system["specific_energy"])
             def _total_energy(field, data):
                 return data["athena","total_energy"]/data["athena","density"]
-            self.add_field(("gas","total_energy"), "cell", 
+            self.add_field(("gas","total_energy"), "cell",
                            function=_total_energy,
                            units=unit_system["specific_energy"])
 
@@ -128,5 +128,3 @@
                        units=unit_system["temperature"])
 
         setup_magnetic_field_aliases(self, "athena", ["cell_centered_B_%s" % ax for ax in "xyz"])
-
-

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -98,7 +98,7 @@
             return velocity
 
         for ax in 'xyz':
-            self.add_field((ptype, "particle_velocity_%s" % ax), "cell",  
+            self.add_field((ptype, "particle_velocity_%s" % ax), "cell",
                            function=_get_vel(ax),
                            particle_type=True,
                            units="code_length/code_time")
@@ -112,14 +112,14 @@
             self.setup_momentum_to_velocity()
         elif any(f[1] == "xvel" for f in self.field_list):
             self.setup_velocity_to_momentum()
-        self.add_field(("gas", "thermal_energy"), "cell", 
+        self.add_field(("gas", "thermal_energy"), "cell",
                        function=_thermal_energy,
                        units=unit_system["specific_energy"])
-        self.add_field(("gas", "thermal_energy_density"), "cell", 
+        self.add_field(("gas", "thermal_energy_density"), "cell",
                        function=_thermal_energy_density,
                        units=unit_system["pressure"])
         if ("gas", "temperature") not in self.field_aliases:
-            self.add_field(("gas", "temperature"), "cell", 
+            self.add_field(("gas", "temperature"), "cell",
                            function=_temperature,
                            units=unit_system["temperature"])
 
@@ -129,7 +129,7 @@
                 return data["%smom" % axis]/data["density"]
             return velocity
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax), "cell", 
+            self.add_field(("gas", "velocity_%s" % ax), "cell",
                            function=_get_vel(ax),
                            units=self.ds.unit_system["velocity"])
 
@@ -139,7 +139,7 @@
                 return data["%svel" % axis]*data["density"]
             return momentum
         for ax in 'xyz':
-            self.add_field(("gas", "momentum_%s" % ax), "cell", 
+            self.add_field(("gas", "momentum_%s" % ax), "cell",
                            function=_get_mom(ax),
                            units=mom_units)
 
@@ -203,6 +203,7 @@
                            units="")
                 func = _create_density_func(("gas", "%s_fraction" % nice_name))
                 self.add_field(name=("gas", "%s_density" % nice_name),
+                               "cell",
                                function = func,
                                units = self.ds.unit_system["density"])
                 # We know this will either have one letter, or two.
@@ -287,7 +288,7 @@
                 # We have a mass fraction
                 nice_name, tex_label = _nice_species_name(field)
                 # Overwrite field to use nicer tex_label display_name
-                self.add_output_field(("boxlib", field),
+                self.add_output_field(("boxlib", field), "cell",
                                       units="",
                                       display_name=tex_label)
                 self.alias(("gas", "%s_fraction" % nice_name),
@@ -295,6 +296,7 @@
                            units="")
                 func = _create_density_func(("gas", "%s_fraction" % nice_name))
                 self.add_field(name=("gas", "%s_density" % nice_name),
+                               "cell",
                                function=func,
                                units=unit_system["density"],
                                display_name=r'\rho %s' % tex_label)
@@ -317,7 +319,7 @@
                 nice_name, tex_label = _nice_species_name(field)
                 display_name = r'\dot{\omega}\left[%s\right]' % tex_label
                 # Overwrite field to use nicer tex_label'ed display_name
-                self.add_output_field(("boxlib", field), units=unit_system["frequency"],
+                self.add_output_field(("boxlib", field), "cell",  units=unit_system["frequency"],
                                       display_name=display_name)
                 self.alias(("gas", "%s_creation_rate" % nice_name),
                            ("boxlib", field), units=unit_system["frequency"])

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -140,27 +140,28 @@
             return velocity
 
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax), function = _get_vel(ax),
+            self.add_field(("gas", "velocity_%s" % ax), "cell",
+                           function = _get_vel(ax),
                            units = unit_system["velocity"])
-        self.add_field(("gas", "thermal_energy"),
+        self.add_field(("gas", "thermal_energy"), "cell",
                        function = _thermal_energy,
                        units = unit_system["specific_energy"])
-        self.add_field(("gas", "thermal_energy_density"),
+        self.add_field(("gas", "thermal_energy_density"), "cell",
                        function = _thermal_energy_density,
                        units = unit_system["pressure"])
-        self.add_field(("gas", "kinetic_energy"),
+        self.add_field(("gas", "kinetic_energy"), "cell",
                        function = _kinetic_energy,
                        units = unit_system["pressure"])
-        self.add_field(("gas", "specific_kinetic_energy"),
+        self.add_field(("gas", "specific_kinetic_energy"), "cell",
                        function = _specific_kinetic_energy,
                        units = unit_system["specific_energy"])
-        self.add_field(("gas", "magnetic_energy"),
+        self.add_field(("gas", "magnetic_energy"), "cell",
                        function = _magnetic_energy,
                        units = unit_system["pressure"])
-        self.add_field(("gas", "specific_magnetic_energy"),
+        self.add_field(("gas", "specific_magnetic_energy"), "cell",
                        function = _specific_magnetic_energy,
                        units = unit_system["specific_energy"])
-        self.add_field(("gas", "temperature"), function=_temperature,
+        self.add_field(("gas", "temperature"), "cell",  function=_temperature,
                        units=unit_system["temperature"])
 
         setup_magnetic_field_aliases(self, "chombo", ["%s-magnfield" % ax for ax in "XYZ"])
@@ -260,7 +261,8 @@
         super(ChomboPICFieldInfo2D, self).__init__(ds, field_list)
 
         for ftype in fluid_field_types:
-            self.add_field((ftype, 'gravitational_field_z'), function = _dummy_field,
+            self.add_field((ftype, 'gravitational_field_z'), "cell",
+                            function = _dummy_field,
                             units = "code_length / code_time**2")
 
         for ptype in particle_field_types:
@@ -289,11 +291,13 @@
         super(ChomboPICFieldInfo1D, self).__init__(ds, field_list)
 
         for ftype in fluid_field_types:
-            self.add_field((ftype, 'gravitational_field_y'), function = _dummy_field,
+            self.add_field((ftype, 'gravitational_field_y'), "cell",
+                            function = _dummy_field,
                             units = "code_length / code_time**2")
 
-            self.add_field((ftype, 'gravitational_field_z'), function = _dummy_field,
-                    units = "code_length / code_time**2")
+            self.add_field((ftype, 'gravitational_field_z'), "cell",
+                            function = _dummy_field,
+                            units = "code_length / code_time**2")
 
         for ptype in particle_field_types:
             self.add_field((ptype, "particle_position_y"), "particle",

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -276,7 +276,7 @@
             version = float(params["Internal"]["Provenance"]["VersionNumber"])
         if version >= 3.0:
             active_particles = True
-            nap = dict((ap_type, []) for ap_type in 
+            nap = dict((ap_type, []) for ap_type in
                 params["Physics"]["ActiveParticles"]["ActiveParticlesEnabled"])
         else:
             if "AppendActiveParticleType" in self.parameters:
@@ -425,7 +425,7 @@
             for apt in aps:
                 dd = field._copy_def()
                 dd.pop("name")
-                self.ds.field_info.add_field((apt, fname), **dd)
+                self.ds.field_info.add_field((apt, fname), "cell", **dd)
 
     def _detect_output_fields(self):
         self.field_list = []
@@ -761,7 +761,7 @@
         """
         # Let's read the file
         with open(self.parameter_filename, "r") as f:
-            line = f.readline().strip() 
+            line = f.readline().strip()
             f.seek(0)
             if line == "Internal:":
                 self._parse_enzo3_parameter_file(f)
@@ -1099,4 +1099,3 @@
             for line in lines:
                 yield line
     yield buf  # First line.
-

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -122,7 +122,7 @@
         # off, we add the species field itself.  Then we'll add a few more
         # items...
         #
-        self.add_output_field(("enzo", "%s_Density" % species),
+        self.add_output_field(("enzo", "%s_Density" % species), "cell",
                            take_log=True,
                            units="code_mass/code_length**3")
         yt_name = known_species_names[species]
@@ -138,7 +138,7 @@
                          if sp in known_species_names]
         def _electron_density(field, data):
             return data["Electron_Density"] * (me/mp)
-        self.add_field(("gas", "El_density"),
+        self.add_field(("gas", "El_density"), "cell",
                        function = _electron_density,
                        units = self.ds.unit_system["density"])
         for sp in species_names:
@@ -185,13 +185,13 @@
             te_name = "TotalEnergy"
 
         if hydro_method == 2:
-            self.add_output_field(("enzo", te_name),
+            self.add_output_field(("enzo", te_name), "cell",
                 units="code_velocity**2")
             self.alias(("gas", "thermal_energy"), ("enzo", te_name))
 
         elif dual_energy == 1:
             self.add_output_field(
-                ("enzo", ge_name),
+                ("enzo", ge_name), "cell",
                 units="code_velocity**2")
             self.alias(
                 ("gas", "thermal_energy"),
@@ -199,7 +199,7 @@
                 units = unit_system["specific_energy"])
         elif hydro_method in (4, 6):
             self.add_output_field(
-                ("enzo", te_name),
+                ("enzo", te_name), "cell",
                 units="code_velocity**2")
             # Subtract off B-field energy
             def _sub_b(field, data):
@@ -211,11 +211,11 @@
                 ret -= data["magnetic_energy"]/data["density"]
                 return ret
             self.add_field(
-                ("gas", "thermal_energy"),
+                ("gas", "thermal_energy"), "cell",
                 function=_sub_b, units = unit_system["specific_energy"])
         else: # Otherwise, we assume TotalEnergy is kinetic+thermal
             self.add_output_field(
-                ("enzo", te_name),
+                ("enzo", te_name), "cell",
                 units = "code_velocity**2")
             self.alias(("gas", "total_energy"), ("enzo", te_name))
             def _tot_minus_kin(field, data):
@@ -226,14 +226,14 @@
                     ret -= 0.5*data["velocity_z"]**2.0
                 return ret
             self.add_field(
-                ("gas", "thermal_energy"),
+                ("gas", "thermal_energy"), "cell",
                 function = _tot_minus_kin,
                 units = unit_system["specific_energy"])
         if multi_species == 0 and 'Mu' in params:
             def _number_density(field, data):
                 return data['gas', 'density']/(mp*params['Mu'])
             self.add_field(
-                ("gas", "number_density"),
+                ("gas", "number_density"), "cell",
                 function = _number_density,
                 units=unit_system["number_density"])
 

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -100,7 +100,7 @@
             setup_magnetic_field_aliases
         unit_system = self.ds.unit_system
         for i in range(1, 1000):
-            self.add_output_field(("flash", "r{0:03}".format(i)), 
+            self.add_output_field(("flash", "r{0:03}".format(i)), "cell",
                 units = "",
                 display_name="Energy Group {0}".format(i))
         # Add energy fields
@@ -112,7 +112,7 @@
                 ek += data["flash","velz"]**2
             return 0.5*ek
         if ("flash","ener") in self.field_list:
-            self.add_output_field(("flash","ener"),
+            self.add_output_field(("flash","ener"), "cell",
                                   units="code_length**2/code_time**2")
             self.alias(("gas","total_energy"),("flash","ener"),
                        units=unit_system["specific_energy"])
@@ -127,7 +127,7 @@
             self.add_field(("gas","total_energy"), "cell",  function=_ener,
                            units=unit_system["specific_energy"])
         if ("flash","eint") in self.field_list:
-            self.add_output_field(("flash","eint"),
+            self.add_output_field(("flash","eint"), "cell",
                                   units="code_length**2/code_time**2")
             self.alias(("gas","thermal_energy"),("flash","eint"),
                        units=unit_system["specific_energy"])
@@ -151,9 +151,9 @@
             Na_code = data.ds.quan(Na, '1/code_mass')
             return data["flash","dens"]*data["flash","sumy"]*Na_code
         self.add_field(('flash','nion'), "cell",  function=_nion, units="code_length**-3")
-        
+
         if ("flash", "abar") in self.field_list:
-            self.add_output_field(("flash", "abar"), units="1")
+            self.add_output_field(("flash", "abar"), "cell",  units="1")
         else:
             def _abar(field, data):
                 return 1.0 / data["flash","sumy"]
@@ -165,5 +165,3 @@
                        units=unit_system["number_density"])
 
         setup_magnetic_field_aliases(self, "flash", ["mag%s" % ax for ax in "xyz"])
-
-

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/gadget/fields.py
--- a/yt/frontends/gadget/fields.py
+++ b/yt/frontends/gadget/fields.py
@@ -35,8 +35,8 @@
 
     def _setup_four_metal_fractions(self, ptype):
         """
-        This function breaks the FourMetalFractions field (if present) 
-        into its four component metal fraction fields and adds 
+        This function breaks the FourMetalFractions field (if present)
+        into its four component metal fraction fields and adds
         corresponding metal density fields which will later get smoothed
 
         This gets used with the Gadget group0000 format
@@ -52,8 +52,8 @@
                 return _Fraction
 
             self.add_field( (ptype, metal_name+"_fraction"),
-                            function=_Fraction_wrap(i), 
-                            particle_type=True,
+                            "particle",
+                            function=_Fraction_wrap(i),
                             units="")
 
             # add the metal density fields
@@ -64,8 +64,8 @@
                 return _Metal_density
 
             self.add_field( (ptype, metal_name+"_density"),
-                            function=_Density_wrap(i), 
-                            particle_type=True,
+                            "particle",
+                            function=_Density_wrap(i),
                             units=self.ds.unit_system["density"])
 
     def setup_gas_particle_fields(self, ptype):
@@ -90,8 +90,8 @@
 
         self.add_field(
             (ptype, "Temperature"),
+            "particle",
             function=_temperature,
-            particle_type=True,
             units=self.ds.unit_system["temperature"])
 
         # For now, we hardcode num_neighbors.  We should make this configurable

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/gamer/fields.py
--- a/yt/frontends/gamer/fields.py
+++ b/yt/frontends/gamer/fields.py
@@ -69,7 +69,8 @@
                 return data["gas", "momentum_%s"%v] / data["gas","density"]
             return _velocity
         for v in "xyz":
-            self.add_field( ("gas","velocity_%s"%v), function = velocity_xyz(v),
+            self.add_field( ("gas","velocity_%s"%v), "cell",
+                            function = velocity_xyz(v),
                             units = unit_system["velocity"] )
 
         # ============================================================================
@@ -94,26 +95,30 @@
         # thermal energy per mass (i.e., specific)
         def _thermal_energy(field, data):
             return et(data) / data["gamer","Dens"]
-        self.add_field( ("gas","thermal_energy"), function = _thermal_energy,
+        self.add_field( ("gas","thermal_energy"), "cell",
+                        function = _thermal_energy,
                         units = unit_system["specific_energy"] )
 
         # total energy per mass
         def _total_energy(field, data):
             return data["gamer","Engy"] / data["gamer","Dens"]
-        self.add_field( ("gas","total_energy"), function = _total_energy,
+        self.add_field( ("gas","total_energy"), "cell",
+                        function = _total_energy,
                         units = unit_system["specific_energy"] )
 
         # pressure
         def _pressure(field, data):
             return et(data)*(data.ds.gamma-1.0)
-        self.add_field( ("gas","pressure"), function = _pressure,
+        self.add_field( ("gas","pressure"), "cell",
+                        function = _pressure,
                         units = unit_system["pressure"] )
 
         # temperature
         def _temperature(field, data):
             return data.ds.mu*mh*data["gas","pressure"] / \
                    (data["gas","density"]*boltzmann_constant_cgs)
-        self.add_field( ("gas","temperature"), function = _temperature,
+        self.add_field( ("gas","temperature"), "cell",
+                        function = _temperature,
                         units = unit_system["temperature"] )
 
     def setup_particle_fields(self, ptype):

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/gizmo/fields.py
--- a/yt/frontends/gizmo/fields.py
+++ b/yt/frontends/gizmo/fields.py
@@ -73,8 +73,8 @@
 
         self.add_field(
             (ptype, "H_density"),
+            "particle",
             function=_h_density,
-            particle_type=True,
             units=self.ds.unit_system["density"])
         add_species_field_by_density(self, ptype, "H", particle_type=True)
         for suffix in ["density", "fraction", "mass", "number_density"]:
@@ -88,8 +88,8 @@
 
         self.add_field(
             (ptype, "H_p1_density"),
+            "particle",
             function=_h_p1_density,
-            particle_type=True,
             units=self.ds.unit_system["density"])
         add_species_field_by_density(self, ptype, "H_p1", particle_type=True)
 
@@ -111,8 +111,8 @@
         for species in self.nuclei_names:
             self.add_field(
                 (ptype, "%s_nuclei_mass_density" % species),
+                "particle",
                 function=_nuclei_mass_density_field,
-                particle_type=True,
                 units=self.ds.unit_system["density"])
 
             for suf in ["_nuclei_mass_density", "_metallicity"]:

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/owls/fields.py
--- a/yt/frontends/owls/fields.py
+++ b/yt/frontends/owls/fields.py
@@ -35,8 +35,8 @@
 class OWLSFieldInfo(SPHFieldInfo):
 
     _ions = ("c1", "c2", "c3", "c4", "c5", "c6",
-             "fe2", "fe17", "h1", "he1", "he2", "mg1", "mg2", "n2", 
-             "n3", "n4", "n5", "n6", "n7", "ne8", "ne9", "ne10", "o1", 
+             "fe2", "fe17", "h1", "he1", "he2", "mg1", "mg2", "n2",
+             "n3", "n4", "n5", "n6", "n7", "ne8", "ne9", "ne10", "o1",
              "o6", "o7", "o8", "si2", "si3", "si4", "si13")
 
     _elements = ("H", "He", "C", "N", "O", "Ne", "Mg", "Si", "Fe")
@@ -49,7 +49,7 @@
 
 
     def __init__(self, *args, **kwargs):
-        
+
         new_particle_fields = (
             ("Hydrogen", ("", ["H_fraction"], None)),
             ("Helium", ("", ["He_fraction"], None)),
@@ -72,7 +72,7 @@
     def setup_particle_fields(self, ptype):
         """ additional particle fields derived from those in snapshot.
         we also need to add the smoothed fields here b/c setup_fluid_fields
-        is called before setup_particle_fields. """ 
+        is called before setup_particle_fields. """
 
         smoothed_suffixes = ("_number_density", "_density", "_mass")
 
@@ -90,9 +90,9 @@
                 add_species_field_by_fraction(self, ptype, s,
                                               particle_type=True)
 
-        # this needs to be called after the call to 
+        # this needs to be called after the call to
         # add_species_field_by_fraction for some reason ...
-        # not sure why yet. 
+        # not sure why yet.
         #-------------------------------------------------------
         if ptype == 'PartType0':
             ftype='gas'
@@ -108,7 +108,7 @@
             ftype='BH'
         elif ptype == 'all':
             ftype='all'
-        
+
         super(OWLSFieldInfo,self).setup_particle_fields(
             ptype, num_neighbors=self._num_neighbors, ftype=ftype)
 
@@ -117,11 +117,11 @@
         #-----------------------------------------------------
         if ptype == 'PartType0':
 
-            # we only add ion fields for gas.  this takes some 
+            # we only add ion fields for gas.  this takes some
             # time as the ion abundances have to be interpolated
             # from cloudy tables (optically thin)
             #-----------------------------------------------------
-    
+
 
             # this defines the ion density on particles
             # X_density for all items in self._ions
@@ -176,7 +176,7 @@
                 loaded = []
                 for sfx in smoothed_suffixes:
                     fname = yt_ion + sfx
-                    fn = add_volume_weighted_smoothed_field( 
+                    fn = add_volume_weighted_smoothed_field(
                         ptype, "particle_position", "particle_mass",
                         "smoothing_length", "density", fname, self,
                         self._num_neighbors)
@@ -190,7 +190,7 @@
 
 
     def setup_gas_ion_density_particle_fields( self, ptype ):
-        """ Sets up particle fields for gas ion densities. """ 
+        """ Sets up particle fields for gas ion densities. """
 
         # loop over all ions and make fields
         #----------------------------------------------
@@ -217,22 +217,22 @@
             fname = yt_ion + '_density'
             dens_func = self._create_ion_density_func( ftype, ion )
             self.add_field( (ftype, fname),
-                            function = dens_func, 
-                            units=self.ds.unit_system["density"],
-                            particle_type=True )            
+                            "particle",
+                            function = dens_func,
+                            units=self.ds.unit_system["density"])
             self._show_field_errors.append( (ftype,fname) )
 
 
 
-        
+
     def _create_ion_density_func( self, ftype, ion ):
-        """ returns a function that calculates the ion density of a particle. 
-        """ 
+        """ returns a function that calculates the ion density of a particle.
+        """
 
         def get_owls_ion_density_field(ion, ftype, itab):
             def _func(field, data):
 
-                # get element symbol from ion string. ion string will 
+                # get element symbol from ion string. ion string will
                 # be a member of the tuple _ions (i.e. si13)
                 #--------------------------------------------------------
                 if ion[0:2].isalpha():
@@ -256,9 +256,9 @@
                 # find ion balance using log nH and log T
                 #--------------------------------------------------------
                 i_frac = itab.interp( log_nH, log_T )
-                return data[ftype,"Density"] * m_frac * i_frac 
+                return data[ftype,"Density"] * m_frac * i_frac
             return _func
-            
+
         ion_path = self._get_owls_ion_data_dir()
         fname = os.path.join( ion_path, ion+".hdf5" )
         itab = oit.IonTableOWLS( fname )
@@ -295,7 +295,7 @@
         if tdir == "/does/not/exist":
             data_dir = "./"
         else:
-            data_dir = tdir            
+            data_dir = tdir
 
 
         # check for owls_ion_data directory in data_dir

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -107,7 +107,7 @@
                      'logT' : np.log10(data["temperature"]).ravel()}
                 rv = 10**interp_object(d).reshape(shape)
                 return rv
-            self.add_field(name = name, function=_func,
+            self.add_field(name = name, "cell", function=_func,
                                  units = "code_length**-3")
         avals = {}
         tvals = {}
@@ -124,7 +124,7 @@
                     var = var.reshape((n1, n2, var.size / (n1*n2)), order='F')
                     for i in range(var.shape[-1]):
                         tvals[_cool_species[i]] = var[:,:,i]
-        
+
         for n in tvals:
             interp = BilinearFieldInterpolator(tvals[n],
                         (avals["lognH"], avals["logT"]),

diff -r beb1eed79e2f8d980c7f0e25a4078bff93c5044f -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb yt/frontends/tipsy/fields.py
--- a/yt/frontends/tipsy/fields.py
+++ b/yt/frontends/tipsy/fields.py
@@ -73,6 +73,6 @@
 
         self.add_field(
             (ptype, "smoothing_length"),
+            "particle",
             function=_func(),
-            particle_type=True,
             units="code_length")


https://bitbucket.org/yt_analysis/yt/commits/36031ac9eec9/
Changeset:   36031ac9eec9
Branch:      yt
User:        al007
Date:        2016-09-26 14:29:25+00:00
Summary:     Address args before kwargs.
Affected #:  1 file

diff -r 10c2a5ac1d999007406b18eaa6b6bbb907d17feb -r 36031ac9eec94fc7f3567a275cdc6607b71e48b6 yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -203,7 +203,7 @@
                            units="")
                 func = _create_density_func(("gas", "%s_fraction" % nice_name))
                 self.add_field(name=("gas", "%s_density" % nice_name),
-                               "cell",
+                               sampling_type="cell",
                                function = func,
                                units = self.ds.unit_system["density"])
                 # We know this will either have one letter, or two.
@@ -296,7 +296,7 @@
                            units="")
                 func = _create_density_func(("gas", "%s_fraction" % nice_name))
                 self.add_field(name=("gas", "%s_density" % nice_name),
-                               "cell",
+                               sampling_type="cell",
                                function=func,
                                units=unit_system["density"],
                                display_name=r'\rho %s' % tex_label)


https://bitbucket.org/yt_analysis/yt/commits/c6b70d5872f7/
Changeset:   c6b70d5872f7
Branch:      yt
User:        al007
Date:        2016-09-26 14:37:29+00:00
Summary:     Ramses kwarg before arg.
Affected #:  1 file

diff -r 36031ac9eec94fc7f3567a275cdc6607b71e48b6 -r c6b70d5872f7a07d54e3285cee72ce846a2f1e86 yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -107,7 +107,7 @@
                      'logT' : np.log10(data["temperature"]).ravel()}
                 rv = 10**interp_object(d).reshape(shape)
                 return rv
-            self.add_field(name = name, "cell", function=_func,
+            self.add_field(name = name, sampling_type = "cell", function=_func,
                                  units = "code_length**-3")
         avals = {}
         tvals = {}


https://bitbucket.org/yt_analysis/yt/commits/46687bf22046/
Changeset:   46687bf22046
Branch:      yt
User:        al007
Date:        2016-09-26 16:00:03+00:00
Summary:     Fix local_fields and off_axis_projection.
Affected #:  2 files

diff -r c6b70d5872f7a07d54e3285cee72ce846a2f1e86 -r 46687bf220460040d83d5992a9c98f1842022d76 yt/fields/local_fields.py
--- a/yt/fields/local_fields.py
+++ b/yt/fields/local_fields.py
@@ -24,9 +24,11 @@
 
 class LocalFieldInfoContainer(FieldInfoContainer):
     def add_field(self, name, function=None, **kwargs):
+        sampling_type = "cell"
         if not isinstance(name, tuple):
             if kwargs.setdefault('particle_type', False):
                 name = ('all', name)
+                sampling_type = "particle"
             else:
                 name = ('gas', name)
         override = kwargs.get("force_override", False)
@@ -35,7 +37,7 @@
             mylog.warning("Field %s already exists. To override use " +
                           "force_override=True.", name)
         return super(LocalFieldInfoContainer,
-                     self).add_field(name, function, **kwargs)
+                     self).add_field(name, sampling_type, function, **kwargs)
 
 # Empty FieldInfoContainer
 local_fields = LocalFieldInfoContainer(None, [], None)

diff -r c6b70d5872f7a07d54e3285cee72ce846a2f1e86 -r 46687bf220460040d83d5992a9c98f1842022d76 yt/visualization/volume_rendering/off_axis_projection.py
--- a/yt/visualization/volume_rendering/off_axis_projection.py
+++ b/yt/visualization/volume_rendering/off_axis_projection.py
@@ -138,7 +138,7 @@
                 return b.apply_units(tr, a.units)
                 return tr
             return temp_weightfield
-        data_source.ds.field_info.add_field(weightfield,
+        data_source.ds.field_info.add_field(weightfield, "cell",
             function=_make_wf(item, weight))
         # Now we have to tell the dataset to add it and to calculate
         # its dependencies..


https://bitbucket.org/yt_analysis/yt/commits/f0d6094eed9b/
Changeset:   f0d6094eed9b
Branch:      yt
User:        al007
Date:        2016-09-26 19:29:10+00:00
Summary:     Make yt.add_field calls backwards compatible.
Affected #:  1 file

diff -r 46687bf220460040d83d5992a9c98f1842022d76 -r f0d6094eed9b18191f892e7ddeec8ee31e3a3a53 yt/fields/local_fields.py
--- a/yt/fields/local_fields.py
+++ b/yt/fields/local_fields.py
@@ -12,6 +12,7 @@
 #
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
+import warnings
 
 from yt.utilities.logger import \
     ytLogger as mylog
@@ -23,12 +24,10 @@
     FieldInfoContainer
 
 class LocalFieldInfoContainer(FieldInfoContainer):
-    def add_field(self, name, function=None, **kwargs):
-        sampling_type = "cell"
+    def add_field(self, name, function=None, sampling_type=None, **kwargs):
         if not isinstance(name, tuple):
             if kwargs.setdefault('particle_type', False):
                 name = ('all', name)
-                sampling_type = "particle"
             else:
                 name = ('gas', name)
         override = kwargs.get("force_override", False)
@@ -36,6 +35,17 @@
         if not override and name in self:
             mylog.warning("Field %s already exists. To override use " +
                           "force_override=True.", name)
+        if ((sampling_type is not None and sampling_type != "particle") \
+            and particle_type):
+            raise RuntimeError("Clashing definition of 'sampling_type' and "
+                               "'particle_type'. Note that 'particle_type' is "
+                               "deprecated. Please just use 'sampling_type'.")
+        if sampling_type is None:
+            warnings.warn("Because 'sampling_type' not specified, yt will "
+                          "assume a cell 'sampling_type'")
+            sampling_type = "cell"
+        if kwargs.setdefault('particle_type', False):
+            sampling_type = "particle"
         return super(LocalFieldInfoContainer,
                      self).add_field(name, sampling_type, function, **kwargs)
 


https://bitbucket.org/yt_analysis/yt/commits/c0fdd6161e51/
Changeset:   c0fdd6161e51
Branch:      yt
User:        al007
Date:        2016-09-26 20:37:41+00:00
Summary:     Fix argument order in static_output.py and undefined particle_type in local_fields.py.
Affected #:  2 files

diff -r f0d6094eed9b18191f892e7ddeec8ee31e3a3a53 -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -214,7 +214,7 @@
             obj = _cached_datasets[apath]
         return obj
 
-    def __init__(self, filename, dataset_type=None, file_style=None, 
+    def __init__(self, filename, dataset_type=None, file_style=None,
                  units_override=None, unit_system="cgs"):
         """
         Base class for generating new output types.  Principally consists of
@@ -338,7 +338,7 @@
         in that directory, and a list of subdirectories.  It should return a
         list of filenames (defined relative to the supplied directory) and a
         boolean as to whether or not further directories should be recursed.
-        
+
         This function doesn't need to catch all possibilities, nor does it need
         to filter possibilities.
         """
@@ -938,7 +938,7 @@
             "dangerous option that may yield inconsistent results, and must be "
             "used very carefully, and only if you know what you want from it.")
         for unit, cgs in [("length", "cm"), ("time", "s"), ("mass", "g"),
-                          ("velocity","cm/s"), ("magnetic","gauss"), 
+                          ("velocity","cm/s"), ("magnetic","gauss"),
                           ("temperature","K")]:
             val = self.units_override.get("%s_unit" % unit, None)
             if val is not None:
@@ -1043,7 +1043,7 @@
         self._quan = functools.partial(YTQuantity, registry=self.unit_registry)
         return self._quan
 
-    def add_field(self, name, sampling_type="cell", function=None, **kwargs):
+    def add_field(self, name, function=None, sampling_type=None, **kwargs):
         """
         Dataset-specific call to add_field
 
@@ -1081,6 +1081,17 @@
         if not override and name in self.field_info:
             mylog.warning("Field %s already exists. To override use " +
                           "force_override=True.", name)
+        if kwargs.setdefault('particle_type', False):
+            if sampling_type is not None and sampling_type != "particle":
+                raise RuntimeError("Clashing definition of 'sampling_type' and "
+                               "'particle_type'. Note that 'particle_type' is "
+                               "deprecated. Please just use 'sampling_type'.")
+            else:
+                sampling_type = "particle"
+        if sampling_type is None:
+            warnings.warn("Because 'sampling_type' not specified, yt will "
+                          "assume a cell 'sampling_type'")
+            sampling_type = "cell"
         self.field_info.add_field(name, sampling_type, function=function, **kwargs)
         self.field_info._show_field_errors.append(name)
         deps, _ = self.field_info.check_derived_fields([name])

diff -r f0d6094eed9b18191f892e7ddeec8ee31e3a3a53 -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 yt/fields/local_fields.py
--- a/yt/fields/local_fields.py
+++ b/yt/fields/local_fields.py
@@ -35,17 +35,17 @@
         if not override and name in self:
             mylog.warning("Field %s already exists. To override use " +
                           "force_override=True.", name)
-        if ((sampling_type is not None and sampling_type != "particle") \
-            and particle_type):
-            raise RuntimeError("Clashing definition of 'sampling_type' and "
+        if kwargs.setdefault('particle_type', False):
+            if sampling_type is not None and sampling_type != "particle":
+                raise RuntimeError("Clashing definition of 'sampling_type' and "
                                "'particle_type'. Note that 'particle_type' is "
                                "deprecated. Please just use 'sampling_type'.")
+            else:
+                sampling_type = "particle"
         if sampling_type is None:
             warnings.warn("Because 'sampling_type' not specified, yt will "
                           "assume a cell 'sampling_type'")
             sampling_type = "cell"
-        if kwargs.setdefault('particle_type', False):
-            sampling_type = "particle"
         return super(LocalFieldInfoContainer,
                      self).add_field(name, sampling_type, function, **kwargs)
 


https://bitbucket.org/yt_analysis/yt/commits/6323cd441f74/
Changeset:   6323cd441f74
Branch:      yt
User:        al007
Date:        2016-09-26 20:40:10+00:00
Summary:     Find and replace with 'sampling_type=cell'.
Affected #:  11 files

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/angular_momentum.py
--- a/yt/fields/angular_momentum.py
+++ b/yt/fields/angular_momentum.py
@@ -59,15 +59,15 @@
         rv = data.ds.arr(rv, input_units = data["index", "x"].units)
         return xv * rv[...,1] - yv * rv[...,0]
 
-    registry.add_field((ftype, "specific_angular_momentum_x"), "cell", 
+    registry.add_field((ftype, "specific_angular_momentum_x"), sampling_type="cell", 
                         function=_specific_angular_momentum_x,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
-    registry.add_field((ftype, "specific_angular_momentum_y"), "cell", 
+    registry.add_field((ftype, "specific_angular_momentum_y"), sampling_type="cell", 
                         function=_specific_angular_momentum_y,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
-    registry.add_field((ftype, "specific_angular_momentum_z"), "cell", 
+    registry.add_field((ftype, "specific_angular_momentum_z"), sampling_type="cell", 
                         function=_specific_angular_momentum_z,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
@@ -78,7 +78,7 @@
     def _angular_momentum_x(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_x"]
-    registry.add_field((ftype, "angular_momentum_x"), "cell", 
+    registry.add_field((ftype, "angular_momentum_x"), sampling_type="cell", 
                        function=_angular_momentum_x,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])
@@ -86,7 +86,7 @@
     def _angular_momentum_y(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_y"]
-    registry.add_field((ftype, "angular_momentum_y"), "cell", 
+    registry.add_field((ftype, "angular_momentum_y"), sampling_type="cell", 
                        function=_angular_momentum_y,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])
@@ -94,7 +94,7 @@
     def _angular_momentum_z(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_z"]
-    registry.add_field((ftype, "angular_momentum_z"), "cell", 
+    registry.add_field((ftype, "angular_momentum_z"), sampling_type="cell", 
                        function=_angular_momentum_z,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/astro_fields.py
--- a/yt/fields/astro_fields.py
+++ b/yt/fields/astro_fields.py
@@ -52,7 +52,7 @@
         """
         return np.sqrt(3.0 * np.pi / (16.0 * G * data[ftype, "density"]))
 
-    registry.add_field((ftype, "dynamical_time"), "cell", 
+    registry.add_field((ftype, "dynamical_time"), sampling_type="cell", 
                        function=_dynamical_time,
                        units=unit_system["time"])
 
@@ -65,7 +65,7 @@
              (data[ftype, "density"]**(-0.5)))
         return u
 
-    registry.add_field((ftype, "jeans_mass"), "cell", 
+    registry.add_field((ftype, "jeans_mass"), sampling_type="cell", 
                        function=_jeans_mass,
                        units=unit_system["mass"])
 
@@ -88,7 +88,7 @@
                                     - 1.6667 * logT0**1  - 0.2193 * logT0)),
                            "") # add correct units here
 
-    registry.add_field((ftype, "chandra_emissivity"), "cell", 
+    registry.add_field((ftype, "chandra_emissivity"), sampling_type="cell", 
                        function=_chandra_emissivity,
                        units="") # add correct units here
 
@@ -102,7 +102,7 @@
         nenh *= 0.5*(1.+X_H)*X_H*data["cell_volume"]
         return nenh
     
-    registry.add_field((ftype, "emission_measure"), "cell", 
+    registry.add_field((ftype, "emission_measure"), sampling_type="cell", 
                        function=_emission_measure,
                        units=unit_system["number_density"])
 
@@ -112,7 +112,7 @@
                            * data[ftype, "temperature"].to_ndarray()**0.5,
                            "") # add correct units here
 
-    registry.add_field((ftype, "xray_emissivity"), "cell", 
+    registry.add_field((ftype, "xray_emissivity"), sampling_type="cell", 
                        function=_xray_emissivity,
                        units="") # add correct units here
 
@@ -121,7 +121,7 @@
         # Only useful as a weight_field for temperature, metallicity, velocity
         return data["density"]*data["density"]*data["kT"]**-0.25/mh/mh
 
-    registry.add_field((ftype,"mazzotta_weighting"), "cell", 
+    registry.add_field((ftype,"mazzotta_weighting"), sampling_type="cell", 
                        function=_mazzotta_weighting,
                        units="keV**-0.25*cm**-6")
 
@@ -135,7 +135,7 @@
         # See issue #1225
         return -scale * vel * data[ftype, "density"]
 
-    registry.add_field((ftype, "sz_kinetic"), "cell", 
+    registry.add_field((ftype, "sz_kinetic"), sampling_type="cell", 
                        function=_sz_kinetic,
                        units=unit_system["length"]**-1,
                        validators=[
@@ -145,6 +145,6 @@
         scale = 0.88 / mh * kboltz / (me * clight*clight) * sigma_thompson
         return scale * data[ftype, "density"] * data[ftype, "temperature"]
 
-    registry.add_field((ftype, "szy"), "cell", 
+    registry.add_field((ftype, "szy"), sampling_type="cell", 
                        function=_szy,
                        units=unit_system["length"]**-1)

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/cosmology_fields.py
--- a/yt/fields/cosmology_fields.py
+++ b/yt/fields/cosmology_fields.py
@@ -45,14 +45,14 @@
         return data[ftype, "density"] + \
           data[ftype, "dark_matter_density"]
 
-    registry.add_field((ftype, "matter_density"), "cell", 
+    registry.add_field((ftype, "matter_density"), sampling_type="cell", 
                        function=_matter_density,
                        units=unit_system["density"])
 
     def _matter_mass(field, data):
         return data[ftype, "matter_density"] * data["index", "cell_volume"]
 
-    registry.add_field((ftype, "matter_mass"), "cell", 
+    registry.add_field((ftype, "matter_mass"), sampling_type="cell", 
                        function=_matter_mass,
                        units=unit_system["mass"])
 
@@ -65,7 +65,7 @@
         return data[ftype, "matter_density"] / \
           co.critical_density(data.ds.current_redshift)
 
-    registry.add_field((ftype, "overdensity"), "cell", 
+    registry.add_field((ftype, "overdensity"), sampling_type="cell", 
                        function=_overdensity,
                        units="")
 
@@ -83,7 +83,7 @@
         return data[ftype, "density"] / omega_baryon / co.critical_density(0.0) / \
           (1.0 + data.ds.current_redshift)**3
 
-    registry.add_field((ftype, "baryon_overdensity"), "cell", 
+    registry.add_field((ftype, "baryon_overdensity"), sampling_type="cell", 
                        function=_baryon_overdensity,
                        units="",
                        validators=[ValidateParameter("omega_baryon")])
@@ -100,7 +100,7 @@
           co.critical_density(0.0) / \
           (1.0 + data.ds.current_redshift)**3
 
-    registry.add_field((ftype, "matter_overdensity"), "cell", 
+    registry.add_field((ftype, "matter_overdensity"), sampling_type="cell", 
                        function=_matter_overdensity,
                        units="")
 
@@ -109,7 +109,7 @@
         virial_radius = data.get_field_parameter("virial_radius")
         return data["radius"] / virial_radius
 
-    registry.add_field(("index", "virial_radius_fraction"), "cell", 
+    registry.add_field(("index", "virial_radius_fraction"), sampling_type="cell", 
                        function=_virial_radius_fraction,
                        validators=[ValidateParameter("virial_radius")],
                        units="")
@@ -137,7 +137,7 @@
         return (1.5 * (co.hubble_constant / speed_of_light_cgs)**2 * (dl * dls / ds) * \
           data[ftype, "matter_overdensity"]).in_units("1/cm")
 
-    registry.add_field((ftype, "weak_lensing_convergence"), "cell", 
+    registry.add_field((ftype, "weak_lensing_convergence"), sampling_type="cell", 
                        function=_weak_lensing_convergence,
                        units=unit_system["length"]**-1,
         validators=[ValidateParameter("observer_redshift"),

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/field_info_container.py
--- a/yt/fields/field_info_container.py
+++ b/yt/fields/field_info_container.py
@@ -195,7 +195,7 @@
                 units = ""
             elif units == 1.0:
                 units = ""
-            self.add_output_field(field, "cell", units = units,
+            self.add_output_field(field, sampling_type="cell", units = units,
                                   display_name = display_name)
             for alias in aliases:
                 self.alias(("gas", alias), field)

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/fluid_fields.py
--- a/yt/fields/fluid_fields.py
+++ b/yt/fields/fluid_fields.py
@@ -59,14 +59,14 @@
     def _cell_mass(field, data):
         return data[ftype, "density"] * data[ftype, "cell_volume"]
 
-    registry.add_field((ftype, "cell_mass"), "cell", 
+    registry.add_field((ftype, "cell_mass"), sampling_type="cell", 
         function=_cell_mass,
         units=unit_system["mass"])
 
     def _sound_speed(field, data):
         tr = data.ds.gamma * data[ftype, "pressure"] / data[ftype, "density"]
         return np.sqrt(tr)
-    registry.add_field((ftype, "sound_speed"), "cell", 
+    registry.add_field((ftype, "sound_speed"), sampling_type="cell", 
              function=_sound_speed,
              units=unit_system["velocity"])
 
@@ -74,7 +74,7 @@
         """ Radial component of M{|v|/c_sound} """
         tr = data[ftype, "radial_velocity"] / data[ftype, "sound_speed"]
         return np.abs(tr)
-    registry.add_field((ftype, "radial_mach_number"), "cell", 
+    registry.add_field((ftype, "radial_mach_number"), sampling_type="cell", 
              function=_radial_mach_number,
              units = "")
 
@@ -82,14 +82,14 @@
         return 0.5*data[ftype, "density"] * ( data[ftype, "velocity_x"]**2.0
                                               + data[ftype, "velocity_y"]**2.0
                                               + data[ftype, "velocity_z"]**2.0 )
-    registry.add_field((ftype, "kinetic_energy"), "cell", 
+    registry.add_field((ftype, "kinetic_energy"), sampling_type="cell", 
                        function = _kin_energy,
                        units = unit_system["pressure"])
 
     def _mach_number(field, data):
         """ M{|v|/c_sound} """
         return data[ftype, "velocity_magnitude"] / data[ftype, "sound_speed"]
-    registry.add_field((ftype, "mach_number"), "cell", 
+    registry.add_field((ftype, "mach_number"), sampling_type="cell", 
             function=_mach_number,
             units = "")
 
@@ -103,7 +103,7 @@
         tr = np.minimum(np.minimum(t1, t2), t3)
         return tr
 
-    registry.add_field((ftype, "courant_time_step"), "cell", 
+    registry.add_field((ftype, "courant_time_step"), sampling_type="cell", 
              function=_courant_time_step,
              units=unit_system["time"])
 
@@ -113,13 +113,13 @@
            * (data[ftype, "density"] * data[ftype, "thermal_energy"])
         return tr
 
-    registry.add_field((ftype, "pressure"), "cell", 
+    registry.add_field((ftype, "pressure"), sampling_type="cell", 
              function=_pressure,
              units=unit_system["pressure"])
 
     def _kT(field, data):
         return (kboltz*data[ftype, "temperature"]).in_units("keV")
-    registry.add_field((ftype, "kT"), "cell", 
+    registry.add_field((ftype, "kT"), sampling_type="cell", 
                        function=_kT,
                        units="keV",
                        display_name="Temperature")
@@ -132,7 +132,7 @@
         gammam1 = 2./3.
         tr = data[ftype,"kT"] / ((data[ftype, "density"]/mw)**gammam1)
         return data.apply_units(tr, field.units)
-    registry.add_field((ftype, "entropy"), "cell", 
+    registry.add_field((ftype, "entropy"), sampling_type="cell", 
              units="keV*cm**2",
              function=_entropy)
 
@@ -140,13 +140,13 @@
         tr = data[ftype, "metal_density"] / data[ftype, "density"]
         tr /= metallicity_sun
         return data.apply_units(tr, "Zsun")
-    registry.add_field((ftype, "metallicity"), "cell", 
+    registry.add_field((ftype, "metallicity"), sampling_type="cell", 
              function=_metallicity,
              units="Zsun")
 
     def _metal_mass(field, data):
         return data[ftype, "metal_density"] * data[ftype, "cell_volume"]
-    registry.add_field((ftype, "metal_mass"), "cell", 
+    registry.add_field((ftype, "metal_mass"), sampling_type="cell", 
                        function=_metal_mass,
                        units=unit_system["mass"])
 
@@ -156,13 +156,13 @@
         for species in data.ds.field_info.species_names:
             field_data += data["gas", "%s_number_density" % species]
         return field_data
-    registry.add_field((ftype, "number_density"), "cell", 
+    registry.add_field((ftype, "number_density"), sampling_type="cell", 
                        function = _number_density,
                        units=unit_system["number_density"])
     
     def _mean_molecular_weight(field, data):
         return (data[ftype, "density"] / (mh * data[ftype, "number_density"]))
-    registry.add_field((ftype, "mean_molecular_weight"), "cell", 
+    registry.add_field((ftype, "mean_molecular_weight"), sampling_type="cell", 
               function=_mean_molecular_weight,
               units="")
 
@@ -207,7 +207,7 @@
 
     for axi, ax in enumerate('xyz'):
         f = grad_func(axi, ax)
-        registry.add_field((ftype, "%s_gradient_%s" % (fname, ax)), "cell", 
+        registry.add_field((ftype, "%s_gradient_%s" % (fname, ax)), sampling_type="cell", 
                            function = f,
                            validators = [ValidateSpatial(1, [grad_field])],
                            units = grad_units)

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/fluid_vector_fields.py
--- a/yt/fields/fluid_vector_fields.py
+++ b/yt/fields/fluid_vector_fields.py
@@ -67,7 +67,7 @@
     bv_validators = [ValidateSpatial(1, [(ftype, "density"), (ftype, "pressure")])]
     for ax in 'xyz':
         n = "baroclinic_vorticity_%s" % ax
-        registry.add_field((ftype, n), "cell",  function=eval("_%s" % n),
+        registry.add_field((ftype, n), sampling_type="cell",  function=eval("_%s" % n),
                            validators=bv_validators,
                            units=unit_system["frequency"]**2)
 
@@ -119,7 +119,7 @@
                              (ftype, "velocity_z")])]
     for ax in 'xyz':
         n = "vorticity_%s" % ax
-        registry.add_field((ftype, n), "cell", 
+        registry.add_field((ftype, n), sampling_type="cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"],
                            validators=vort_validators)
@@ -138,7 +138,7 @@
         return data[ftype, "velocity_divergence"] * data[ftype, "vorticity_z"]
     for ax in 'xyz':
         n = "vorticity_stretching_%s" % ax
-        registry.add_field((ftype, n), "cell",  
+        registry.add_field((ftype, n), sampling_type="cell",  
                            function=eval("_%s" % n),
                            units = unit_system["frequency"]**2,
                            validators=vort_validators)
@@ -159,7 +159,7 @@
           data[ftype, "baroclinic_vorticity_z"]
     for ax in 'xyz':
         n = "vorticity_growth_%s" % ax
-        registry.add_field((ftype, n), "cell", 
+        registry.add_field((ftype, n), sampling_type="cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vort_validators)
@@ -175,7 +175,7 @@
         result = np.sign(dot) * result
         return result
     
-    registry.add_field((ftype, "vorticity_growth_magnitude"), "cell", 
+    registry.add_field((ftype, "vorticity_growth_magnitude"), sampling_type="cell", 
               function=_vorticity_growth_magnitude,
               units=unit_system["frequency"]**2,
               validators=vort_validators,
@@ -186,7 +186,7 @@
                        data[ftype, "vorticity_growth_y"]**2 +
                        data[ftype, "vorticity_growth_z"]**2)
     
-    registry.add_field((ftype, "vorticity_growth_magnitude_absolute"), "cell", 
+    registry.add_field((ftype, "vorticity_growth_magnitude_absolute"), sampling_type="cell", 
                        function=_vorticity_growth_magnitude_absolute,
                        units=unit_system["frequency"]**2,
                        validators=vort_validators)
@@ -197,7 +197,7 @@
         domegaz_dt = data[ftype, "vorticity_z"] / data[ftype, "vorticity_growth_z"]
         return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
     
-    registry.add_field((ftype, "vorticity_growth_timescale"), "cell", 
+    registry.add_field((ftype, "vorticity_growth_timescale"), sampling_type="cell", 
                        function=_vorticity_growth_timescale,
                        units=unit_system["time"],
                        validators=vort_validators)
@@ -232,7 +232,7 @@
                              (ftype, "radiation_acceleration_z")])]
     for ax in 'xyz':
         n = "vorticity_radiation_pressure_%s" % ax
-        registry.add_field((ftype, n), "cell", 
+        registry.add_field((ftype, n), sampling_type="cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vrp_validators)
@@ -257,7 +257,7 @@
                
     for ax in 'xyz':
         n = "vorticity_radiation_pressure_growth_%s" % ax
-        registry.add_field((ftype, n), "cell", 
+        registry.add_field((ftype, n), sampling_type="cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vrp_validators)
@@ -273,7 +273,7 @@
         result = np.sign(dot) * result
         return result
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude"), "cell", 
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude"), sampling_type="cell", 
                        function=_vorticity_radiation_pressure_growth_magnitude,
                        units=unit_system["frequency"]**2,
                        validators=vrp_validators,
@@ -284,7 +284,7 @@
                        data[ftype, "vorticity_radiation_pressure_growth_y"]**2 +
                        data[ftype, "vorticity_radiation_pressure_growth_z"]**2)
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude_absolute"), "cell", 
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude_absolute"), sampling_type="cell", 
                        function=_vorticity_radiation_pressure_growth_magnitude_absolute,
                        units="s**(-2)",
                        validators=vrp_validators)
@@ -298,7 +298,7 @@
           data[ftype, "vorticity_radiation_pressure_growth_z"]
         return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_timescale"), "cell", 
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_timescale"), sampling_type="cell", 
                        function=_vorticity_radiation_pressure_growth_timescale,
                        units=unit_system["time"],
                        validators=vrp_validators)
@@ -344,7 +344,7 @@
         new_field[sl_center, sl_center, sl_center] = f
         return new_field
     
-    registry.add_field((ftype, "shear"), "cell", 
+    registry.add_field((ftype, "shear"), sampling_type="cell", 
                        function=_shear,
                        validators=[ValidateSpatial(1,
                         [(ftype, "velocity_x"),
@@ -361,7 +361,7 @@
         
         return data[ftype, "shear"] / data[ftype, "sound_speed"]
 
-    registry.add_field((ftype, "shear_criterion"), "cell", 
+    registry.add_field((ftype, "shear_criterion"), sampling_type="cell", 
                        function=_shear_criterion,
                        units=unit_system["length"]**-1,
                        validators=[ValidateSpatial(1,
@@ -417,7 +417,7 @@
         new_field[sl_center, sl_center, sl_center] = f
         return new_field
     
-    registry.add_field((ftype, "shear_mach"), "cell", 
+    registry.add_field((ftype, "shear_mach"), sampling_type="cell", 
                        function=_shear_mach,
                        units="",
                        validators=[ValidateSpatial(1,

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/geometric_fields.py
--- a/yt/fields/geometric_fields.py
+++ b/yt/fields/geometric_fields.py
@@ -46,7 +46,7 @@
         """
         return get_radius(data, "")
 
-    registry.add_field(("index", "radius"), "cell", 
+    registry.add_field(("index", "radius"), sampling_type="cell", 
                        function=_radius,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -59,7 +59,7 @@
             return data._reshape_vals(arr)
         return arr
 
-    registry.add_field(("index", "grid_level"), "cell", 
+    registry.add_field(("index", "grid_level"), sampling_type="cell", 
                        function=_grid_level,
                        units="",
                        validators=[ValidateSpatial(0)])
@@ -76,7 +76,7 @@
             return data._reshape_vals(arr)
         return arr
 
-    registry.add_field(("index", "grid_indices"), "cell", 
+    registry.add_field(("index", "grid_indices"), sampling_type="cell", 
                        function=_grid_indices,
                        units="",
                        validators=[ValidateSpatial(0)],
@@ -87,7 +87,7 @@
         return np.ones(data["index", "ones"].shape,
                        dtype="float64")/data["index", "dx"]
 
-    registry.add_field(("index", "ones_over_dx"), "cell", 
+    registry.add_field(("index", "ones_over_dx"), sampling_type="cell", 
                        function=_ones_over_dx,
                        units=unit_system["length"]**-1,
                        display_field=False)
@@ -97,7 +97,7 @@
         arr = np.zeros(data["index", "ones"].shape, dtype='float64')
         return data.apply_units(arr, field.units)
 
-    registry.add_field(("index", "zeros"), "cell", 
+    registry.add_field(("index", "zeros"), sampling_type="cell", 
                        function=_zeros,
                        units="",
                        display_field=False)
@@ -109,7 +109,7 @@
             return data._reshape_vals(arr)
         return data.apply_units(arr, field.units)
 
-    registry.add_field(("index", "ones"), "cell", 
+    registry.add_field(("index", "ones"), sampling_type="cell", 
                        function=_ones,
                        units="",
                        display_field=False)
@@ -132,7 +132,7 @@
                                 data["index", "z"].ravel(), LE, RE)
         morton.shape = data["index", "x"].shape
         return morton.view("f8")
-    registry.add_field(("index", "morton_index"), "cell",  function=_morton_index,
+    registry.add_field(("index", "morton_index"), sampling_type="cell",  function=_morton_index,
                        units = "")
         
     def _spherical_radius(field, data):
@@ -144,7 +144,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_sph_r(coords), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "spherical_radius"), "cell", 
+    registry.add_field(("index", "spherical_radius"), sampling_type="cell", 
                        function=_spherical_radius,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -153,7 +153,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data['index', 'spherical_radius']
 
-    registry.add_field(("index", "spherical_r"), "cell", 
+    registry.add_field(("index", "spherical_r"), sampling_type="cell", 
                        function=_spherical_r,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -171,7 +171,7 @@
         coords = get_periodic_rvec(data)
         return get_sph_theta(coords, normal)
 
-    registry.add_field(("index", "spherical_theta"), "cell", 
+    registry.add_field(("index", "spherical_theta"), sampling_type="cell", 
                        function=_spherical_theta,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -190,7 +190,7 @@
         coords = get_periodic_rvec(data)
         return get_sph_phi(coords, normal)
 
-    registry.add_field(("index", "spherical_phi"), "cell", 
+    registry.add_field(("index", "spherical_phi"), sampling_type="cell", 
                        function=_spherical_phi,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -206,7 +206,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_cyl_r(coords, normal), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "cylindrical_radius"), "cell", 
+    registry.add_field(("index", "cylindrical_radius"), sampling_type="cell", 
                        function=_cylindrical_radius,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -216,7 +216,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data['index', 'cylindrical_radius']
 
-    registry.add_field(("index", "cylindrical_r"), "cell", 
+    registry.add_field(("index", "cylindrical_r"), sampling_type="cell", 
                        function=_cylindrical_r,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -231,7 +231,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_cyl_z(coords, normal), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "cylindrical_z"), "cell", 
+    registry.add_field(("index", "cylindrical_z"), sampling_type="cell", 
                        function=_cylindrical_z,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -250,7 +250,7 @@
         coords = get_periodic_rvec(data)
         return get_cyl_theta(coords, normal)
 
-    registry.add_field(("index", "cylindrical_theta"), "cell", 
+    registry.add_field(("index", "cylindrical_theta"), sampling_type="cell", 
                        function=_cylindrical_theta,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -260,7 +260,7 @@
         """This field is dprecated and will be removed in a future release"""
         return data["index", "spherical_theta"]
 
-    registry.add_field(("index", "disk_angle"), "cell", 
+    registry.add_field(("index", "disk_angle"), sampling_type="cell", 
                        function=_disk_angle,
                        take_log=False,
                        display_field=False,
@@ -272,7 +272,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data["index", "cylindrical_z"]
 
-    registry.add_field(("index", "height"), "cell", 
+    registry.add_field(("index", "height"), sampling_type="cell", 
                        function=_height,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/magnetic_field.py
--- a/yt/fields/magnetic_field.py
+++ b/yt/fields/magnetic_field.py
@@ -46,26 +46,26 @@
               data[ftype,"magnetic_field_y"]**2 +
               data[ftype,"magnetic_field_z"]**2)
         return np.sqrt(B2)
-    registry.add_field((ftype,"magnetic_field_strength"), "cell", 
+    registry.add_field((ftype,"magnetic_field_strength"), sampling_type="cell", 
                        function=_magnetic_field_strength,
                        units=u)
 
     def _magnetic_energy(field, data):
         B = data[ftype,"magnetic_field_strength"]
         return 0.5*B*B/mag_factors[B.units.dimensions]
-    registry.add_field((ftype, "magnetic_energy"), "cell", 
+    registry.add_field((ftype, "magnetic_energy"), sampling_type="cell", 
              function=_magnetic_energy,
              units=unit_system["pressure"])
 
     def _plasma_beta(field,data):
         return data[ftype,'pressure']/data[ftype,'magnetic_energy']
-    registry.add_field((ftype, "plasma_beta"), "cell", 
+    registry.add_field((ftype, "plasma_beta"), sampling_type="cell", 
              function=_plasma_beta,
              units="")
 
     def _magnetic_pressure(field,data):
         return data[ftype,'magnetic_energy']
-    registry.add_field((ftype, "magnetic_pressure"), "cell", 
+    registry.add_field((ftype, "magnetic_pressure"), sampling_type="cell", 
              function=_magnetic_pressure,
              units=unit_system["pressure"])
 
@@ -83,7 +83,7 @@
 
         return get_sph_theta_component(Bfields, theta, phi, normal)
 
-    registry.add_field((ftype, "magnetic_field_poloidal"), "cell", 
+    registry.add_field((ftype, "magnetic_field_poloidal"), sampling_type="cell", 
              function=_magnetic_field_poloidal,
              units=u, validators=[ValidateParameter("normal")])
 
@@ -99,19 +99,19 @@
         phi = data["index", 'spherical_phi']
         return get_sph_phi_component(Bfields, phi, normal)
 
-    registry.add_field((ftype, "magnetic_field_toroidal"), "cell", 
+    registry.add_field((ftype, "magnetic_field_toroidal"), sampling_type="cell", 
              function=_magnetic_field_toroidal,
              units=u, validators=[ValidateParameter("normal")])
 
     def _alfven_speed(field,data):
         B = data[ftype,'magnetic_field_strength']
         return B/np.sqrt(mag_factors[B.units.dimensions]*data[ftype,'density'])
-    registry.add_field((ftype, "alfven_speed"), "cell",  function=_alfven_speed,
+    registry.add_field((ftype, "alfven_speed"), sampling_type="cell",  function=_alfven_speed,
                        units=unit_system["velocity"])
 
     def _mach_alfven(field,data):
         return data[ftype,'velocity_magnitude']/data[ftype,'alfven_speed']
-    registry.add_field((ftype, "mach_alfven"), "cell",  function=_mach_alfven,
+    registry.add_field((ftype, "mach_alfven"), sampling_type="cell",  function=_mach_alfven,
                        units="dimensionless")
 
 def setup_magnetic_field_aliases(registry, ds_ftype, ds_fields, ftype="gas"):
@@ -161,6 +161,6 @@
             return convert(data[fd])
         return _mag_field
     for ax, fd in zip("xyz", ds_fields):
-        registry.add_field((ftype,"magnetic_field_%s" % ax), "cell", 
+        registry.add_field((ftype,"magnetic_field_%s" % ax), sampling_type="cell", 
                            function=mag_field(fd),
                            units=unit_system[to_units.dimensions])

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -103,7 +103,7 @@
         return data.apply_units(d, field.units)
 
     registry.add_field(("deposit", "%s_count" % ptype),
-             "cell",          
+             sampling_type="cell",          
              function = particle_count,
              validators = [ValidateSpatial()],
              units = '',
@@ -117,7 +117,7 @@
         return data.apply_units(d, field.units)
 
     registry.add_field(("deposit", "%s_mass" % ptype),
-             "cell",          
+             sampling_type="cell",          
              function = particle_mass,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s Mass}" % ptype_dn,
@@ -132,7 +132,7 @@
         return d
 
     registry.add_field(("deposit", "%s_density" % ptype),
-             "cell",          
+             sampling_type="cell",          
              function = particle_density,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s Density}" % ptype_dn,
@@ -146,7 +146,7 @@
         return d
 
     registry.add_field(("deposit", "%s_cic" % ptype),
-             "cell",          
+             sampling_type="cell",          
              function = particle_cic,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s CIC Density}" % ptype_dn,
@@ -175,7 +175,7 @@
             function = _get_density_weighted_deposit_field(
                 "particle_velocity_%s" % ax, "cm/s", method)
             registry.add_field(
-                ("deposit", ("%s_"+name+"_velocity_%s") % (ptype, ax)), "cell",
+                ("deposit", ("%s_"+name+"_velocity_%s") % (ptype, ax)), sampling_type="cell",
                 function=function, units=unit_system["velocity"], take_log=False,
                 validators=[ValidateSpatial(0)])
 
@@ -183,7 +183,7 @@
         function = _get_density_weighted_deposit_field(
             "age", "s", method)
         registry.add_field(
-            ("deposit", ("%s_"+name+"_age") % (ptype)), "cell",
+            ("deposit", ("%s_"+name+"_age") % (ptype)), sampling_type="cell",
             function=function, units=unit_system["time"], take_log=False,
             validators=[ValidateSpatial(0)])
 
@@ -781,7 +781,7 @@
         v[np.isnan(v)] = 0.0
         return v
     fn = ("deposit", "%s_avg_%s" % (ptype, field_name))
-    registry.add_field(fn, "cell", function=_pfunc_avg,
+    registry.add_field(fn, sampling_type="cell", function=_pfunc_avg,
                        validators = [ValidateSpatial(0)],
                        units = field_units)
     return fn
@@ -827,7 +827,7 @@
         rv /= hsml.uq**3 / hsml.uq.in_base(unit_system.name).uq**3
         rv = data.apply_units(rv, field_units)
         return rv
-    registry.add_field(field_name, "cell", function = _vol_weight,
+    registry.add_field(field_name, sampling_type="cell", function = _vol_weight,
                        validators = [ValidateSpatial(0)],
                        units = field_units)
     registry.find_dependencies((field_name,))

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -75,17 +75,17 @@
     """
     unit_system = registry.ds.unit_system
 
-    registry.add_field((ftype, "%s_fraction" % species), "cell",  
+    registry.add_field((ftype, "%s_fraction" % species), sampling_type="cell",  
                        function = _create_fraction_func(ftype, species),
                        particle_type = particle_type,
                        units = "")
 
-    registry.add_field((ftype, "%s_mass" % species), "cell", 
+    registry.add_field((ftype, "%s_mass" % species), sampling_type="cell", 
                        function = _create_mass_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["mass"])
 
-    registry.add_field((ftype, "%s_number_density" % species), "cell", 
+    registry.add_field((ftype, "%s_number_density" % species), sampling_type="cell", 
                        function = _create_number_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["number_density"])
@@ -103,17 +103,17 @@
     """
     unit_system = registry.ds.unit_system
 
-    registry.add_field((ftype, "%s_density" % species), "cell",  
+    registry.add_field((ftype, "%s_density" % species), sampling_type="cell",  
                        function = _create_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["density"])
 
-    registry.add_field((ftype, "%s_mass" % species), "cell", 
+    registry.add_field((ftype, "%s_mass" % species), sampling_type="cell", 
                        function = _create_mass_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["mass"])
 
-    registry.add_field((ftype, "%s_number_density" % species), "cell", 
+    registry.add_field((ftype, "%s_number_density" % species), sampling_type="cell", 
                        function = _create_number_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["number_density"])
@@ -145,13 +145,13 @@
     unit_system = registry.ds.unit_system
     elements = _get_all_elements(registry.species_names)
     for element in elements:
-        registry.add_field((ftype, "%s_nuclei_density" % element), "cell", 
+        registry.add_field((ftype, "%s_nuclei_density" % element), sampling_type="cell", 
                            function = _nuclei_density,
                            particle_type = particle_type,
                            units = unit_system["number_density"])
     if len(elements) == 0:
         for element in ["H", "He"]:
-            registry.add_field((ftype, "%s_nuclei_density" % element), "cell", 
+            registry.add_field((ftype, "%s_nuclei_density" % element), sampling_type="cell", 
                                function = _default_nuclei_density,
                                particle_type = particle_type,
                                units = unit_system["number_density"])

diff -r c0fdd6161e51ae732469e08a0ed5fcd60005b5e1 -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 yt/fields/vector_operations.py
--- a/yt/fields/vector_operations.py
+++ b/yt/fields/vector_operations.py
@@ -44,7 +44,7 @@
             mag += data[fn] * data[fn]
         return np.sqrt(mag)
 
-    registry.add_field((ftype, "%s_magnitude" % basename), "cell", 
+    registry.add_field((ftype, "%s_magnitude" % basename), sampling_type="cell", 
                        function=_magnitude, units=field_units,
                        validators=validators, particle_type=particle_type)
 
@@ -62,7 +62,7 @@
             squared += data[fn] * data[fn]
         return squared
 
-    registry.add_field((ftype, "%s_squared" % basename), "cell", 
+    registry.add_field((ftype, "%s_squared" % basename), sampling_type="cell", 
                        function=_squared, units=field_units,
                        validators=validators, particle_type=particle_type)
 
@@ -110,7 +110,7 @@
         rv[np.isnan(theta)] = 0.0
         return rv
 
-    registry.add_field((ftype, "%s_spherical_radius" % basename), "cell", 
+    registry.add_field((ftype, "%s_spherical_radius" % basename), sampling_type="cell", 
                        function=_spherical_radius_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -127,17 +127,17 @@
         return np.sqrt(data[ftype, "%s_magnitude" % basename]**2.0 -
                        data[ftype, "%s_spherical_radius" % basename]**2.0)
 
-    registry.add_field((ftype, "radial_%s" % basename), "cell", 
+    registry.add_field((ftype, "radial_%s" % basename), sampling_type="cell", 
                        function=_radial,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
                                    ValidateParameter("center")])
 
-    registry.add_field((ftype, "radial_%s_absolute" % basename), "cell", 
+    registry.add_field((ftype, "radial_%s_absolute" % basename), sampling_type="cell", 
                        function=_radial_absolute,
                        units=field_units)
 
-    registry.add_field((ftype, "tangential_%s" % basename), "cell", 
+    registry.add_field((ftype, "tangential_%s" % basename), sampling_type="cell", 
                        function=_tangential,
                        units=field_units)
 
@@ -154,7 +154,7 @@
         phi = resize_vector(data["index", "spherical_phi"], vectors)
         return get_sph_theta_component(vectors, theta, phi, normal)
 
-    registry.add_field((ftype, "%s_spherical_theta" % basename), "cell", 
+    registry.add_field((ftype, "%s_spherical_theta" % basename), sampling_type="cell", 
                        function=_spherical_theta_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -173,7 +173,7 @@
         phi = resize_vector(data["index", "spherical_phi"], vectors)
         return get_sph_phi_component(vectors, phi, normal)
 
-    registry.add_field((ftype, "%s_spherical_phi" % basename), "cell", 
+    registry.add_field((ftype, "%s_spherical_phi" % basename), sampling_type="cell", 
                        function=_spherical_phi_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -192,13 +192,13 @@
             return tr
         return _cp_val
 
-    registry.add_field((ftype, "cutting_plane_%s_x" % basename), "cell", 
+    registry.add_field((ftype, "cutting_plane_%s_x" % basename), sampling_type="cell", 
                        function=_cp_vectors('x'),
                        units=field_units)
-    registry.add_field((ftype, "cutting_plane_%s_y" % basename), "cell", 
+    registry.add_field((ftype, "cutting_plane_%s_y" % basename), sampling_type="cell", 
                        function=_cp_vectors('y'),
                        units=field_units)
-    registry.add_field((ftype, "cutting_plane_%s_z" % basename), "cell", 
+    registry.add_field((ftype, "cutting_plane_%s_z" % basename), sampling_type="cell", 
                        function=_cp_vectors('z'),
                        units=field_units)
 
@@ -223,12 +223,12 @@
     field_units = Unit(field_units, registry=registry.ds.unit_registry)
     div_units = field_units / registry.ds.unit_system["length"]
 
-    registry.add_field((ftype, "%s_divergence" % basename), "cell", 
+    registry.add_field((ftype, "%s_divergence" % basename), sampling_type="cell", 
                        function=_divergence,
                        units=div_units,
                        validators=[ValidateSpatial(1)])
     
-    registry.add_field((ftype, "%s_divergence_absolute" % basename), "cell", 
+    registry.add_field((ftype, "%s_divergence_absolute" % basename), sampling_type="cell", 
                        function=_divergence_abs,
                        units=div_units)
 
@@ -236,7 +236,7 @@
         tr = data[ftype, "tangential_%s" % basename] / \
              data[ftype, "%s_magnitude" % basename]
         return np.abs(tr)
-    registry.add_field((ftype, "tangential_over_%s_magnitude" % basename), "cell", 
+    registry.add_field((ftype, "tangential_over_%s_magnitude" % basename), sampling_type="cell", 
              function=_tangential_over_magnitude,
              take_log=False)
 
@@ -252,7 +252,7 @@
         theta = resize_vector(data["index", 'cylindrical_theta'], vectors)
         return get_cyl_r_component(vectors, theta, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_radius" % basename), "cell", 
+    registry.add_field((ftype, "%s_cylindrical_radius" % basename), sampling_type="cell", 
                        function=_cylindrical_radius_component,
                        units=field_units,
                        validators=[ValidateParameter("normal")])
@@ -261,7 +261,7 @@
         """This field is deprecated and will be removed in a future version"""
         return data[ftype, '%s_cylindrical_radius' % basename]
 
-    registry.add_field((ftype, "cylindrical_radial_%s" % basename), "cell", 
+    registry.add_field((ftype, "cylindrical_radial_%s" % basename), sampling_type="cell", 
                        function=_cylindrical_radial,
                        units=field_units)
 
@@ -269,7 +269,7 @@
         """This field is deprecated and will be removed in a future version"""
         return np.abs(data[ftype, '%s_cylindrical_radius' % basename])
 
-    registry.add_field((ftype, "cylindrical_radial_%s_absolute" % basename), "cell", 
+    registry.add_field((ftype, "cylindrical_radial_%s_absolute" % basename), sampling_type="cell", 
                        function=_cylindrical_radial_absolute,
                        units=field_units,
                        validators=[ValidateParameter("normal")])
@@ -287,7 +287,7 @@
         theta = np.tile(theta, (3,) + (1,)*len(theta.shape))
         return get_cyl_theta_component(vectors, theta, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_theta" % basename), "cell", 
+    registry.add_field((ftype, "%s_cylindrical_theta" % basename), sampling_type="cell", 
                        function=_cylindrical_theta_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -302,11 +302,11 @@
         """This field is deprecated and will be removed in a future release"""
         return np.abs(data['cylindrical_tangential_%s' % basename])
 
-    registry.add_field((ftype, "cylindrical_tangential_%s" % basename), "cell", 
+    registry.add_field((ftype, "cylindrical_tangential_%s" % basename), sampling_type="cell", 
                        function=_cylindrical_tangential,
                        units=field_units)
 
-    registry.add_field((ftype, "cylindrical_tangential_%s_absolute" % basename), "cell", 
+    registry.add_field((ftype, "cylindrical_tangential_%s_absolute" % basename), sampling_type="cell", 
                        function=_cylindrical_tangential_absolute,
                        units=field_units)
 
@@ -320,7 +320,7 @@
         vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
         return get_cyl_z_component(vectors, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_z" % basename), "cell", 
+    registry.add_field((ftype, "%s_cylindrical_z" % basename), sampling_type="cell", 
                        function=_cylindrical_z_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -356,7 +356,7 @@
         new_field2[1:-1, 1:-1, 1:-1] = new_field / weight_field
         return new_field2
 
-    registry.add_field((ftype, "averaged_%s" % basename), "cell", 
+    registry.add_field((ftype, "averaged_%s" % basename), sampling_type="cell", 
                        function=_averaged_field,
                        units=field_units,
                        validators=validators)


https://bitbucket.org/yt_analysis/yt/commits/2efc57ec3f0c/
Changeset:   2efc57ec3f0c
Branch:      yt
User:        al007
Date:        2016-09-26 20:41:46+00:00
Summary:     Find and replace with 'sampling_type=particle'.
Affected #:  2 files

diff -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 yt/fields/field_info_container.py
--- a/yt/fields/field_info_container.py
+++ b/yt/fields/field_info_container.py
@@ -97,7 +97,7 @@
                 output_units = units
             if (ptype, f) not in self.field_list:
                 continue
-            self.add_output_field((ptype, f), "particle",
+            self.add_output_field((ptype, f), sampling_type="particle",
                 units = units, display_name = dn, 
                 output_units = output_units)
             for alias in aliases:
@@ -134,7 +134,7 @@
                 raise RuntimeError
             if field[0] not in self.ds.particle_types:
                 continue
-            self.add_output_field(field, "particle",
+            self.add_output_field(field, sampling_type="particle",
                                   units = self.ds.field_units.get(field, ""))
         self.setup_smoothed_fields(ptype, 
                                    num_neighbors=num_neighbors,

diff -r 6323cd441f7455c352dcdd5f7a19d2965552ada1 -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -194,7 +194,7 @@
         return data.apply_units(v, field.units)
 
     registry.add_field((ptype, "particle_ones"),
-                       "particle",
+                       sampling_type="particle",
                        function = particle_ones,
                        units = "",
                        display_name = r"Particle Count")
@@ -208,7 +208,7 @@
         data.deposit(pos, [ids], method = "mesh_id")
         return data.apply_units(ids, "")
     registry.add_field((ptype, "mesh_id"),
-            "particle",           
+            sampling_type="particle",           
             function = particle_mesh_ids,
             validators = [ValidateSpatial()],
             units = '')
@@ -232,9 +232,9 @@
     for axi, ax in enumerate("xyz"):
         v, p = _get_coord_funcs(axi, ptype)
         registry.add_field((ptype, "particle_velocity_%s" % ax),
-            "particle", function = v, units = "code_velocity")
+            sampling_type="particle", function = v, units = "code_velocity")
         registry.add_field((ptype, "particle_position_%s" % ax),
-            "particle", function = p, units = "code_length")
+            sampling_type="particle", function = p, units = "code_length")
 
 def particle_vector_functions(ptype, coord_names, vel_names, registry):
 
@@ -250,11 +250,11 @@
             return data.apply_units(c, field.units)
         return particle_vectors
     registry.add_field((ptype, "particle_position"),
-                       "particle",
+                       sampling_type="particle",
                        function=_get_vec_func(ptype, coord_names),
                        units = "code_length")
     registry.add_field((ptype, "particle_velocity"),
-                       "particle",
+                       sampling_type="particle",
                        function=_get_vec_func(ptype, vel_names),
                        units = unit_system["velocity"])
 
@@ -284,7 +284,7 @@
                      + (data[ptype, svel % 'z'] - bulk_velocity[2])**2 )
 
     registry.add_field((ptype, "particle_velocity_magnitude"),
-                  "particle",
+                  sampling_type="particle",
                   function=_particle_velocity_magnitude,
                   take_log=False,
                   units=unit_system["velocity"])
@@ -303,7 +303,7 @@
 
 
     registry.add_field((ptype, "particle_specific_angular_momentum"),
-              "particle",
+              sampling_type="particle",
               function=_particle_specific_angular_momentum,
               units=unit_system["specific_angular_momentum"],
               validators=[ValidateParameter("center")])
@@ -320,11 +320,11 @@
         f, v = _get_spec_ang_mom_comp(axi, ax, ptype)
         registry.add_field(
             (ptype, "particle_specific_angular_momentum_%s" % ax),
-            sampling_type = "particle", function=f, units=unit_system["specific_angular_momentum"],
+            sampling_type = sampling_type="particle", function=f, units=unit_system["specific_angular_momentum"],
             validators=[ValidateParameter("center")]
         )
         registry.add_field((ptype, "particle_angular_momentum_%s" % ax),
-            "particle", function=v, units=unit_system["angular_momentum"],
+            sampling_type="particle", function=v, units=unit_system["angular_momentum"],
             validators=[ValidateParameter('center')])
 
     def _particle_angular_momentum(field, data):
@@ -332,7 +332,7 @@
         return am.T
 
     registry.add_field((ptype, "particle_angular_momentum"),
-              "particle",
+              sampling_type="particle",
               function=_particle_angular_momentum,
               units=unit_system["angular_momentum"],
               validators=[ValidateParameter("center")])
@@ -351,7 +351,7 @@
 
     registry.add_field(
         (ptype, "particle_radius"),
-        "particle",
+        sampling_type="particle",
         function=_particle_radius,
         units=unit_system["length"],
         validators=[ValidateParameter("center")])
@@ -372,7 +372,7 @@
 
     registry.add_field(
         (ptype, "particle_position_relative"),
-        "particle",
+        sampling_type="particle",
         function=_particle_position_relative,
         units=unit_system["length"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -393,7 +393,7 @@
         return vel
 
     registry.add_field((ptype, "particle_velocity_relative"),
-              "particle",
+              sampling_type="particle",
               function=_particle_velocity_relative,
               units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
@@ -409,15 +409,15 @@
     for axi, ax in enumerate("xyz"):
         v, p = _get_coord_funcs_relative(axi, ptype)
         registry.add_field((ptype, "particle_velocity_relative_%s" % ax),
-            "particle", function = v, units = "code_velocity")
+            sampling_type="particle", function = v, units = "code_velocity")
         registry.add_field((ptype, "particle_position_relative_%s" % ax),
-            "particle", function = p, units = "code_length")
+            sampling_type="particle", function = p, units = "code_length")
 
 
     # this is just particle radius but we add it with an alias for the sake of
     # consistent naming
     registry.add_field((ptype, "particle_position_spherical_radius"),
-              "particle",
+              sampling_type="particle",
               function=_particle_radius,
               units=unit_system["length"],
               validators=[ValidateParameter("normal"),
@@ -428,7 +428,7 @@
         return data[ptype, 'particle_position_spherical_radius']
 
     registry.add_field((ptype, "particle_spherical_position_radius"),
-              "particle",  
+              sampling_type="particle",  
               function=_particle_spherical_position_radius,
               units=unit_system["length"],
               validators=[ValidateParameter("normal"),
@@ -448,7 +448,7 @@
 
     registry.add_field(
         (ptype, "particle_position_spherical_theta"),
-        "particle",
+        sampling_type="particle",
         function=_particle_position_spherical_theta,
         units="",
         validators=[ValidateParameter("center"), ValidateParameter("normal")])
@@ -458,7 +458,7 @@
         return data[ptype, 'particle_position_spherical_theta']
 
     registry.add_field((ptype, "particle_spherical_position_theta"),
-              "particle",
+              sampling_type="particle",
               function=_particle_spherical_position_theta,
               units="",
               validators=[ValidateParameter("normal"),
@@ -478,7 +478,7 @@
 
     registry.add_field(
         (ptype, "particle_position_spherical_phi"),
-        "particle",
+        sampling_type="particle",
         function=_particle_position_spherical_phi,
         units="",
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -488,7 +488,7 @@
         return data[ptype, 'particle_position_spherical_phi']
 
     registry.add_field((ptype, "particle_spherical_position_phi"),
-             "particle",
+             sampling_type="particle",
              function=_particle_spherical_position_phi,
              units="",
              validators=[ValidateParameter("center"),
@@ -514,7 +514,7 @@
         return sphr
 
     registry.add_field((ptype, "particle_velocity_spherical_radius"),
-              "particle",
+              sampling_type="particle",
               function=_particle_velocity_spherical_radius,
               units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
@@ -525,7 +525,7 @@
         return data[ptype, 'particle_velocity_spherical_radius']
 
     registry.add_field((ptype, "particle_spherical_velocity_radius"),
-              "particle",
+              sampling_type="particle",
               function=_particle_spherical_velocity_radius,
               units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
@@ -534,7 +534,7 @@
     # particel_velocity_spherical_radius is simply aliased to
     # "particle_radial_velocity" for convenience
     registry.add_field((ptype, "particle_radial_velocity"),
-              "particle",
+              sampling_type="particle",
               function=_particle_spherical_velocity_radius,
               units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
@@ -561,7 +561,7 @@
 
     registry.add_field(
         (ptype, "particle_velocity_spherical_theta"),
-        "particle",
+        sampling_type="particle",
         function=_particle_velocity_spherical_theta,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -571,7 +571,7 @@
         return data[ptype, 'particle_velocity_spherical_theta']
 
     registry.add_field((ptype, "particle_spherical_velocity_theta"),
-              "particle",
+              sampling_type="particle",
               function=_particle_spherical_velocity_theta,
               units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
@@ -596,7 +596,7 @@
 
     registry.add_field(
         (ptype, "particle_velocity_spherical_phi"),
-        "particle",
+        sampling_type="particle",
         function=_particle_velocity_spherical_phi,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -606,7 +606,7 @@
         return data[ptype, 'particle_spherical_velocity_theta']
 
     registry.add_field((ptype, "particle_spherical_velocity_phi"),
-              "particle",
+              sampling_type="particle",
               function=_particle_spherical_velocity_phi,
               units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
@@ -627,7 +627,7 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_radius"),
-        "particle",
+        sampling_type="particle",
         function=_particle_position_cylindrical_radius,
         units=unit_system["length"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -646,7 +646,7 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_theta"),
-        "particle",
+        sampling_type="particle",
         function=_particle_position_cylindrical_theta,
         units="",
         validators=[ValidateParameter("center"), ValidateParameter("normal")])
@@ -666,7 +666,7 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_z"),
-        "particle",
+        sampling_type="particle",
         function=_particle_position_cylindrical_z,
         units=unit_system["length"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -690,7 +690,7 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_radius"),
-        "particle",
+        sampling_type="particle",
         function=_particle_velocity_cylindrical_radius,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -714,7 +714,7 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_theta"),
-        "particle",
+        sampling_type="particle",
         function=_particle_velocity_cylindrical_theta,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -724,7 +724,7 @@
         return data[ptype, 'particle_velocity_cylindrical_theta']
 
     registry.add_field((ptype, "particle_cylindrical_velocity_theta"),
-              "particle",
+              sampling_type="particle",
               function=_particle_cylindrical_velocity_theta,
               units="cm/s",
               validators=[ValidateParameter("normal"),
@@ -748,7 +748,7 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_z"),
-        "particle",
+        sampling_type="particle",
         function=_particle_velocity_cylindrical_z,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
@@ -758,7 +758,7 @@
         return data[ptype, "particle_velocity_cylindrical_z"]
 
     registry.add_field((ptype, "particle_cylindrical_velocity_z"),
-              "particle",
+              sampling_type="particle",
               function=_particle_cylindrical_velocity_z,
               units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
@@ -844,7 +844,7 @@
                          nneighbors = nneighbors)
         # Now some quick unit conversions.
         return distances
-    registry.add_field(field_name, "particle", function = _nth_neighbor,
+    registry.add_field(field_name, sampling_type="particle", function = _nth_neighbor,
                        validators = [ValidateSpatial(0)],
                        units = "code_length")
     return [field_name]
@@ -860,6 +860,6 @@
                              for dep_type in data.ds.particle_types_raw])
 
     registry.add_field((ptype, field_name),
-                       "particle",
+                       sampling_type="particle",
                        function=_cat_field,
                        units=units)


https://bitbucket.org/yt_analysis/yt/commits/2daa80b00e04/
Changeset:   2daa80b00e04
Branch:      yt
User:        al007
Date:        2016-09-26 20:45:26+00:00
Summary:     Do find and replace in frontends as well.
Affected #:  19 files

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -65,7 +65,7 @@
             tr *= (data.ds.parameters['gamma'] - 1.)
             tr /= data.ds.parameters['aexpn']**2
             return tr * data['art', 'GasEnergy'] / data['art', 'Density']
-        self.add_field(('gas', 'temperature'), "cell", 
+        self.add_field(('gas', 'temperature'), sampling_type="cell", 
                        function=_temperature, 
                        units=unit_system["temperature"])
 
@@ -75,7 +75,7 @@
                         data[('gas','density')])
             return velocity
         for ax in 'xyz':
-            self.add_field(('gas','velocity_%s' % ax), "cell", 
+            self.add_field(('gas','velocity_%s' % ax), sampling_type="cell", 
                            function = _get_vel(ax),
                            units=unit_system["velocity"])
 
@@ -85,7 +85,7 @@
                   data['gas','momentum_z']**2)**0.5
             tr *= data['index','cell_volume'].in_units('cm**3')
             return tr
-        self.add_field(('gas', 'momentum_magnitude'), "cell", 
+        self.add_field(('gas', 'momentum_magnitude'), sampling_type="cell", 
                        function=_momentum_magnitude,
                        units=unit_system["momentum"])
 
@@ -93,7 +93,7 @@
             tr = data['gas','momentum_magnitude']
             tr /= data['gas','cell_mass']
             return tr
-        self.add_field(('gas', 'velocity_magnitude'), "cell", 
+        self.add_field(('gas', 'velocity_magnitude'), sampling_type="cell", 
                        function=_velocity_magnitude,
                        units=unit_system["velocity"])
 
@@ -101,7 +101,7 @@
             tr = data['gas','metal_ia_density']
             tr += data['gas','metal_ii_density']
             return tr
-        self.add_field(('gas','metal_density'), "cell", 
+        self.add_field(('gas','metal_density'), sampling_type="cell", 
                        function=_metal_density,
                        units=unit_system["density"])
 
@@ -109,7 +109,7 @@
             tr = data['gas','metal_density']
             tr /= data['gas','density']
             return tr
-        self.add_field(('gas', 'metal_mass_fraction'), "cell", 
+        self.add_field(('gas', 'metal_mass_fraction'), sampling_type="cell", 
                        function=_metal_mass_fraction,
                        units='')
 
@@ -117,7 +117,7 @@
             tr = (1. - data.ds.parameters['Y_p'] - 
                   data['gas', 'metal_mass_fraction'])
             return tr
-        self.add_field(('gas', 'H_mass_fraction'), "cell", 
+        self.add_field(('gas', 'H_mass_fraction'), sampling_type="cell", 
                        function=_H_mass_fraction,
                        units='')
 
@@ -125,6 +125,6 @@
             tr = data['gas','metal_mass_fraction']
             tr /= data['gas','H_mass_fraction']
             return tr
-        self.add_field(('gas', 'metallicity'), "cell", 
+        self.add_field(('gas', 'metallicity'), sampling_type="cell", 
                        function=_metallicity,
                        units='')

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/artio/fields.py
--- a/yt/frontends/artio/fields.py
+++ b/yt/frontends/artio/fields.py
@@ -73,7 +73,7 @@
                 return data["momentum_%s" % axis]/data["density"]
             return velocity
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax), "cell", 
+            self.add_field(("gas", "velocity_%s" % ax), sampling_type="cell", 
                            function = _get_vel(ax),
                            units = unit_system["velocity"])
 
@@ -97,7 +97,7 @@
         # TODO: The conversion factor here needs to be addressed, as previously
         # it was set as:
         # unit_T = unit_v**2.0*mb / constants.k
-        self.add_field(("gas", "temperature"), "cell",  function = _temperature,
+        self.add_field(("gas", "temperature"), sampling_type="cell",  function = _temperature,
                        units = unit_system["temperature"])
 
         # Create a metal_density field as sum of existing metal fields. 
@@ -117,7 +117,7 @@
                 def _metal_density(field, data):
                     tr = data["metal_ii_density"]
                     return tr
-            self.add_field(("gas","metal_density"), "cell", 
+            self.add_field(("gas","metal_density"), sampling_type="cell", 
                            function=_metal_density,
                            units=unit_system["density"],
                            take_log=True)
@@ -137,9 +137,9 @@
                     return data["STAR","creation_time"]
                 return data.ds.current_time - data["STAR","creation_time"]
 
-            self.add_field((ptype, "creation_time"), "cell",  function=_creation_time, units="yr",
+            self.add_field((ptype, "creation_time"), sampling_type="cell",  function=_creation_time, units="yr",
                         particle_type=True)
-            self.add_field((ptype, "age"), "cell",  function=_age, units="yr",
+            self.add_field((ptype, "age"), sampling_type="cell",  function=_age, units="yr",
                         particle_type=True)
 
             if self.ds.cosmological_simulation:
@@ -151,7 +151,7 @@
                         return data["STAR","BIRTH_TIME"]
                     return 1.0/data.ds._handle.auni_from_tcode_array(data["STAR","BIRTH_TIME"]) - 1.0
 
-                self.add_field((ptype, "creation_redshift"), "cell",  function=_creation_redshift,
+                self.add_field((ptype, "creation_redshift"), sampling_type="cell",  function=_creation_redshift,
                         particle_type=True)
 
         super(ARTIOFieldInfo, self).setup_particle_fields(ptype)

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/athena/fields.py
--- a/yt/frontends/athena/fields.py
+++ b/yt/frontends/athena/fields.py
@@ -51,13 +51,13 @@
             vel_field = ("athena", "velocity_%s" % comp)
             mom_field = ("athena", "momentum_%s" % comp)
             if vel_field in self.field_list:
-                self.add_output_field(vel_field, "cell",  units="code_length/code_time")
+                self.add_output_field(vel_field, sampling_type="cell",  units="code_length/code_time")
                 self.alias(("gas","velocity_%s" % comp), vel_field,
                            units=unit_system["velocity"])
             elif mom_field in self.field_list:
-                self.add_output_field(mom_field, "cell",
+                self.add_output_field(mom_field, sampling_type="cell",
                                       units="code_mass/code_time/code_length**2")
-                self.add_field(("gas","velocity_%s" % comp), "cell",
+                self.add_field(("gas","velocity_%s" % comp), sampling_type="cell",
                                function=velocity_field(comp), units = unit_system["velocity"])
         # Add pressure, energy, and temperature fields
         def ekin1(data):
@@ -85,36 +85,36 @@
                 etot += emag(data)
             return etot
         if ("athena","pressure") in self.field_list:
-            self.add_output_field(("athena","pressure"), "cell",
+            self.add_output_field(("athena","pressure"), sampling_type="cell",
                                   units=pres_units)
             self.alias(("gas","pressure"),("athena","pressure"),
                        units=unit_system["pressure"])
             def _thermal_energy(field, data):
                 return data["athena","pressure"] / \
                        (data.ds.gamma-1.)/data["athena","density"]
-            self.add_field(("gas","thermal_energy"), "cell",
+            self.add_field(("gas","thermal_energy"), sampling_type="cell",
                            function=_thermal_energy,
                            units=unit_system["specific_energy"])
             def _total_energy(field, data):
                 return etot_from_pres(data)/data["athena","density"]
-            self.add_field(("gas","total_energy"), "cell",
+            self.add_field(("gas","total_energy"), sampling_type="cell",
                            function=_total_energy,
                            units=unit_system["specific_energy"])
         elif ("athena","total_energy") in self.field_list:
-            self.add_output_field(("athena","total_energy"), "cell",
+            self.add_output_field(("athena","total_energy"), sampling_type="cell",
                                   units=pres_units)
             def _pressure(field, data):
                 return eint_from_etot(data)*(data.ds.gamma-1.0)
-            self.add_field(("gas","pressure"), "cell",  function=_pressure,
+            self.add_field(("gas","pressure"), sampling_type="cell",  function=_pressure,
                            units=unit_system["pressure"])
             def _thermal_energy(field, data):
                 return eint_from_etot(data)/data["athena","density"]
-            self.add_field(("gas","thermal_energy"), "cell",
+            self.add_field(("gas","thermal_energy"), sampling_type="cell",
                            function=_thermal_energy,
                            units=unit_system["specific_energy"])
             def _total_energy(field, data):
                 return data["athena","total_energy"]/data["athena","density"]
-            self.add_field(("gas","total_energy"), "cell",
+            self.add_field(("gas","total_energy"), sampling_type="cell",
                            function=_total_energy,
                            units=unit_system["specific_energy"])
 
@@ -124,7 +124,7 @@
             else:
                 mu = 0.6
             return mu*mh*data["gas","pressure"]/data["gas","density"]/kboltz
-        self.add_field(("gas","temperature"), "cell",  function=_temperature,
+        self.add_field(("gas","temperature"), sampling_type="cell",  function=_temperature,
                        units=unit_system["temperature"])
 
         setup_magnetic_field_aliases(self, "athena", ["cell_centered_B_%s" % ax for ax in "xyz"])

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -98,7 +98,7 @@
             return velocity
 
         for ax in 'xyz':
-            self.add_field((ptype, "particle_velocity_%s" % ax), "cell",
+            self.add_field((ptype, "particle_velocity_%s" % ax), sampling_type="cell",
                            function=_get_vel(ax),
                            particle_type=True,
                            units="code_length/code_time")
@@ -112,14 +112,14 @@
             self.setup_momentum_to_velocity()
         elif any(f[1] == "xvel" for f in self.field_list):
             self.setup_velocity_to_momentum()
-        self.add_field(("gas", "thermal_energy"), "cell",
+        self.add_field(("gas", "thermal_energy"), sampling_type="cell",
                        function=_thermal_energy,
                        units=unit_system["specific_energy"])
-        self.add_field(("gas", "thermal_energy_density"), "cell",
+        self.add_field(("gas", "thermal_energy_density"), sampling_type="cell",
                        function=_thermal_energy_density,
                        units=unit_system["pressure"])
         if ("gas", "temperature") not in self.field_aliases:
-            self.add_field(("gas", "temperature"), "cell",
+            self.add_field(("gas", "temperature"), sampling_type="cell",
                            function=_temperature,
                            units=unit_system["temperature"])
 
@@ -129,7 +129,7 @@
                 return data["%smom" % axis]/data["density"]
             return velocity
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax), "cell",
+            self.add_field(("gas", "velocity_%s" % ax), sampling_type="cell",
                            function=_get_vel(ax),
                            units=self.ds.unit_system["velocity"])
 
@@ -139,7 +139,7 @@
                 return data["%svel" % axis]*data["density"]
             return momentum
         for ax in 'xyz':
-            self.add_field(("gas", "momentum_%s" % ax), "cell",
+            self.add_field(("gas", "momentum_%s" % ax), sampling_type="cell",
                            function=_get_mom(ax),
                            units=mom_units)
 
@@ -288,7 +288,7 @@
                 # We have a mass fraction
                 nice_name, tex_label = _nice_species_name(field)
                 # Overwrite field to use nicer tex_label display_name
-                self.add_output_field(("boxlib", field), "cell",
+                self.add_output_field(("boxlib", field), sampling_type="cell",
                                       units="",
                                       display_name=tex_label)
                 self.alias(("gas", "%s_fraction" % nice_name),
@@ -319,7 +319,7 @@
                 nice_name, tex_label = _nice_species_name(field)
                 display_name = r'\dot{\omega}\left[%s\right]' % tex_label
                 # Overwrite field to use nicer tex_label'ed display_name
-                self.add_output_field(("boxlib", field), "cell",  units=unit_system["frequency"],
+                self.add_output_field(("boxlib", field), sampling_type="cell",  units=unit_system["frequency"],
                                       display_name=display_name)
                 self.alias(("gas", "%s_creation_rate" % nice_name),
                            ("boxlib", field), units=unit_system["frequency"])

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -87,7 +87,7 @@
 
         for ax in 'xyz':
             self.add_field((ptype, "particle_velocity_%s" % ax),
-                           "particle",
+                           sampling_type="particle",
                            function=_get_vel(ax),
                            units="code_length/code_time")
 
@@ -140,28 +140,28 @@
             return velocity
 
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax), "cell",
+            self.add_field(("gas", "velocity_%s" % ax), sampling_type="cell",
                            function = _get_vel(ax),
                            units = unit_system["velocity"])
-        self.add_field(("gas", "thermal_energy"), "cell",
+        self.add_field(("gas", "thermal_energy"), sampling_type="cell",
                        function = _thermal_energy,
                        units = unit_system["specific_energy"])
-        self.add_field(("gas", "thermal_energy_density"), "cell",
+        self.add_field(("gas", "thermal_energy_density"), sampling_type="cell",
                        function = _thermal_energy_density,
                        units = unit_system["pressure"])
-        self.add_field(("gas", "kinetic_energy"), "cell",
+        self.add_field(("gas", "kinetic_energy"), sampling_type="cell",
                        function = _kinetic_energy,
                        units = unit_system["pressure"])
-        self.add_field(("gas", "specific_kinetic_energy"), "cell",
+        self.add_field(("gas", "specific_kinetic_energy"), sampling_type="cell",
                        function = _specific_kinetic_energy,
                        units = unit_system["specific_energy"])
-        self.add_field(("gas", "magnetic_energy"), "cell",
+        self.add_field(("gas", "magnetic_energy"), sampling_type="cell",
                        function = _magnetic_energy,
                        units = unit_system["pressure"])
-        self.add_field(("gas", "specific_magnetic_energy"), "cell",
+        self.add_field(("gas", "specific_magnetic_energy"), sampling_type="cell",
                        function = _specific_magnetic_energy,
                        units = unit_system["specific_energy"])
-        self.add_field(("gas", "temperature"), "cell",  function=_temperature,
+        self.add_field(("gas", "temperature"), sampling_type="cell",  function=_temperature,
                        units=unit_system["temperature"])
 
         setup_magnetic_field_aliases(self, "chombo", ["%s-magnfield" % ax for ax in "XYZ"])
@@ -200,7 +200,7 @@
                 output_units = units
             if (ptype, f) not in self.field_list:
                 continue
-            self.add_output_field((ptype, f), "particle",
+            self.add_output_field((ptype, f), sampling_type="particle",
                 units = units,
                 display_name = dn, output_units = output_units, take_log=False)
             for alias in aliases:
@@ -220,7 +220,7 @@
                 raise RuntimeError
             if field[0] not in self.ds.particle_types:
                 continue
-            self.add_output_field(field, "particle",
+            self.add_output_field(field, sampling_type="particle",
                                   units = self.ds.field_units.get(field, ""))
         self.setup_smoothed_fields(ptype,
                                    num_neighbors=num_neighbors,
@@ -261,16 +261,16 @@
         super(ChomboPICFieldInfo2D, self).__init__(ds, field_list)
 
         for ftype in fluid_field_types:
-            self.add_field((ftype, 'gravitational_field_z'), "cell",
+            self.add_field((ftype, 'gravitational_field_z'), sampling_type="cell",
                             function = _dummy_field,
                             units = "code_length / code_time**2")
 
         for ptype in particle_field_types:
-            self.add_field((ptype, "particle_position_z"), "particle",
+            self.add_field((ptype, "particle_position_z"), sampling_type="particle",
                            function = _dummy_position,
                            units = "code_length")
 
-            self.add_field((ptype, "particle_velocity_z"), "particle",
+            self.add_field((ptype, "particle_velocity_z"), sampling_type="particle",
                            function = _dummy_velocity,
                            units = "code_length / code_time")
 
@@ -291,25 +291,25 @@
         super(ChomboPICFieldInfo1D, self).__init__(ds, field_list)
 
         for ftype in fluid_field_types:
-            self.add_field((ftype, 'gravitational_field_y'), "cell",
+            self.add_field((ftype, 'gravitational_field_y'), sampling_type="cell",
                             function = _dummy_field,
                             units = "code_length / code_time**2")
 
-            self.add_field((ftype, 'gravitational_field_z'), "cell",
+            self.add_field((ftype, 'gravitational_field_z'), sampling_type="cell",
                             function = _dummy_field,
                             units = "code_length / code_time**2")
 
         for ptype in particle_field_types:
-            self.add_field((ptype, "particle_position_y"), "particle",
+            self.add_field((ptype, "particle_position_y"), sampling_type="particle",
                            function = _dummy_position,
                            units = "code_length")
-            self.add_field((ptype, "particle_position_z"), "particle",
+            self.add_field((ptype, "particle_position_z"), sampling_type="particle",
                            function = _dummy_position,
                            units = "code_length")
-            self.add_field((ptype, "particle_velocity_y"), "particle",
+            self.add_field((ptype, "particle_velocity_y"), sampling_type="particle",
                            function = _dummy_velocity,
                            units = "code_length / code_time")
-            self.add_field((ptype, "particle_velocity_z"), "particle",
+            self.add_field((ptype, "particle_velocity_z"), sampling_type="particle",
                            function = _dummy_velocity,
                            units = "code_length / code_time")
 

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -425,7 +425,7 @@
             for apt in aps:
                 dd = field._copy_def()
                 dd.pop("name")
-                self.ds.field_info.add_field((apt, fname), "cell", **dd)
+                self.ds.field_info.add_field((apt, fname), sampling_type="cell", **dd)
 
     def _detect_output_fields(self):
         self.field_list = []

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -122,7 +122,7 @@
         # off, we add the species field itself.  Then we'll add a few more
         # items...
         #
-        self.add_output_field(("enzo", "%s_Density" % species), "cell",
+        self.add_output_field(("enzo", "%s_Density" % species), sampling_type="cell",
                            take_log=True,
                            units="code_mass/code_length**3")
         yt_name = known_species_names[species]
@@ -138,7 +138,7 @@
                          if sp in known_species_names]
         def _electron_density(field, data):
             return data["Electron_Density"] * (me/mp)
-        self.add_field(("gas", "El_density"), "cell",
+        self.add_field(("gas", "El_density"), sampling_type="cell",
                        function = _electron_density,
                        units = self.ds.unit_system["density"])
         for sp in species_names:
@@ -185,13 +185,13 @@
             te_name = "TotalEnergy"
 
         if hydro_method == 2:
-            self.add_output_field(("enzo", te_name), "cell",
+            self.add_output_field(("enzo", te_name), sampling_type="cell",
                 units="code_velocity**2")
             self.alias(("gas", "thermal_energy"), ("enzo", te_name))
 
         elif dual_energy == 1:
             self.add_output_field(
-                ("enzo", ge_name), "cell",
+                ("enzo", ge_name), sampling_type="cell",
                 units="code_velocity**2")
             self.alias(
                 ("gas", "thermal_energy"),
@@ -199,7 +199,7 @@
                 units = unit_system["specific_energy"])
         elif hydro_method in (4, 6):
             self.add_output_field(
-                ("enzo", te_name), "cell",
+                ("enzo", te_name), sampling_type="cell",
                 units="code_velocity**2")
             # Subtract off B-field energy
             def _sub_b(field, data):
@@ -211,11 +211,11 @@
                 ret -= data["magnetic_energy"]/data["density"]
                 return ret
             self.add_field(
-                ("gas", "thermal_energy"), "cell",
+                ("gas", "thermal_energy"), sampling_type="cell",
                 function=_sub_b, units = unit_system["specific_energy"])
         else: # Otherwise, we assume TotalEnergy is kinetic+thermal
             self.add_output_field(
-                ("enzo", te_name), "cell",
+                ("enzo", te_name), sampling_type="cell",
                 units = "code_velocity**2")
             self.alias(("gas", "total_energy"), ("enzo", te_name))
             def _tot_minus_kin(field, data):
@@ -226,14 +226,14 @@
                     ret -= 0.5*data["velocity_z"]**2.0
                 return ret
             self.add_field(
-                ("gas", "thermal_energy"), "cell",
+                ("gas", "thermal_energy"), sampling_type="cell",
                 function = _tot_minus_kin,
                 units = unit_system["specific_energy"])
         if multi_species == 0 and 'Mu' in params:
             def _number_density(field, data):
                 return data['gas', 'density']/(mp*params['Mu'])
             self.add_field(
-                ("gas", "number_density"), "cell",
+                ("gas", "number_density"), sampling_type="cell",
                 function = _number_density,
                 units=unit_system["number_density"])
 
@@ -241,7 +241,7 @@
 
         def _age(field, data):
             return data.ds.current_time - data["creation_time"]
-        self.add_field((ptype, "age"), "particle", function = _age,
+        self.add_field((ptype, "age"), sampling_type="particle", function = _age,
                            units = "yr")
 
         super(EnzoFieldInfo, self).setup_particle_fields(ptype)

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/fits/fields.py
--- a/yt/frontends/fits/fields.py
+++ b/yt/frontends/fits/fields.py
@@ -37,14 +37,14 @@
             unit = str(self.ds.wcs_2d.wcs.cunit[i])
             if unit.lower() == "deg": unit = "degree"
             if unit.lower() == "rad": unit = "radian"
-            self.add_field(("fits",name), "cell",  function=world_f(axis, unit), units=unit)
+            self.add_field(("fits",name), sampling_type="cell",  function=world_f(axis, unit), units=unit)
 
         if self.ds.dimensionality == 3:
             def _spec(field, data):
                 axis = "xyz"[data.ds.spec_axis]
                 sp = (data[axis].ndarray_view()-self.ds._p0)*self.ds._dz + self.ds._z0
                 return data.ds.arr(sp, data.ds.spec_unit)
-            self.add_field(("fits","spectral"), "cell",  function=_spec,
+            self.add_field(("fits","spectral"), sampling_type="cell",  function=_spec,
                            units=self.ds.spec_unit, display_name=self.ds.spec_name)
 
     def setup_fluid_fields(self):
@@ -52,6 +52,6 @@
         if self.ds.spec_cube:
             def _pixel(field, data):
                 return data.ds.arr(data["ones"], "pixel")
-            self.add_field(("fits","pixel"), "cell",  function=_pixel, units="pixel")
+            self.add_field(("fits","pixel"), sampling_type="cell",  function=_pixel, units="pixel")
             self._setup_spec_cube_fields()
             return

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/fits/misc.py
--- a/yt/frontends/fits/misc.py
+++ b/yt/frontends/fits/misc.py
@@ -68,7 +68,7 @@
         cfunc = _make_counts(emin, emax)
         fname = "counts_%s-%s" % (emin, emax)
         mylog.info("Creating counts field %s." % fname)
-        ds.add_field((ftype,fname), "cell",  function=cfunc,
+        ds.add_field((ftype,fname), sampling_type="cell",  function=cfunc,
                      units="counts/pixel",
                      validators = [ValidateSpatial()],
                      display_name="Counts (%s-%s keV)" % (emin, emax))
@@ -178,7 +178,7 @@
         ret = data["zeros"].copy()
         ret[new_mask] = 1.
         return ret
-    ds.add_field(("gas",reg_name), "cell",  function=_reg_field)
+    ds.add_field(("gas",reg_name), sampling_type="cell",  function=_reg_field)
     if obj is None:
         obj = ds.all_data()
     if field_parameters is not None:

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -100,7 +100,7 @@
             setup_magnetic_field_aliases
         unit_system = self.ds.unit_system
         for i in range(1, 1000):
-            self.add_output_field(("flash", "r{0:03}".format(i)), "cell",
+            self.add_output_field(("flash", "r{0:03}".format(i)), sampling_type="cell",
                 units = "",
                 display_name="Energy Group {0}".format(i))
         # Add energy fields
@@ -112,7 +112,7 @@
                 ek += data["flash","velz"]**2
             return 0.5*ek
         if ("flash","ener") in self.field_list:
-            self.add_output_field(("flash","ener"), "cell",
+            self.add_output_field(("flash","ener"), sampling_type="cell",
                                   units="code_length**2/code_time**2")
             self.alias(("gas","total_energy"),("flash","ener"),
                        units=unit_system["specific_energy"])
@@ -124,10 +124,10 @@
                 except:
                     pass
                 return ener
-            self.add_field(("gas","total_energy"), "cell",  function=_ener,
+            self.add_field(("gas","total_energy"), sampling_type="cell",  function=_ener,
                            units=unit_system["specific_energy"])
         if ("flash","eint") in self.field_list:
-            self.add_output_field(("flash","eint"), "cell",
+            self.add_output_field(("flash","eint"), sampling_type="cell",
                                   units="code_length**2/code_time**2")
             self.alias(("gas","thermal_energy"),("flash","eint"),
                        units=unit_system["specific_energy"])
@@ -139,29 +139,29 @@
                 except:
                     pass
                 return eint
-            self.add_field(("gas","thermal_energy"), "cell",  function=_eint,
+            self.add_field(("gas","thermal_energy"), sampling_type="cell",  function=_eint,
                            units=unit_system["specific_energy"])
         ## Derived FLASH Fields
         def _nele(field, data):
             Na_code = data.ds.quan(Na, '1/code_mass')
             return data["flash","dens"]*data["flash","ye"]*Na_code
-        self.add_field(('flash','nele'), "cell",  function=_nele, units="code_length**-3")
-        self.add_field(('flash','edens'), "cell",  function=_nele, units="code_length**-3")
+        self.add_field(('flash','nele'), sampling_type="cell",  function=_nele, units="code_length**-3")
+        self.add_field(('flash','edens'), sampling_type="cell",  function=_nele, units="code_length**-3")
         def _nion(field, data):
             Na_code = data.ds.quan(Na, '1/code_mass')
             return data["flash","dens"]*data["flash","sumy"]*Na_code
-        self.add_field(('flash','nion'), "cell",  function=_nion, units="code_length**-3")
+        self.add_field(('flash','nion'), sampling_type="cell",  function=_nion, units="code_length**-3")
 
         if ("flash", "abar") in self.field_list:
-            self.add_output_field(("flash", "abar"), "cell",  units="1")
+            self.add_output_field(("flash", "abar"), sampling_type="cell",  units="1")
         else:
             def _abar(field, data):
                 return 1.0 / data["flash","sumy"]
-            self.add_field(("flash","abar"), "cell",  function=_abar, units="1")
+            self.add_field(("flash","abar"), sampling_type="cell",  function=_abar, units="1")
 
         def _number_density(fields,data):
             return (data["nele"]+data["nion"])
-        self.add_field(("gas","number_density"), "cell",  function=_number_density,
+        self.add_field(("gas","number_density"), sampling_type="cell",  function=_number_density,
                        units=unit_system["number_density"])
 
         setup_magnetic_field_aliases(self, "flash", ["mag%s" % ax for ax in "xyz"])

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/gadget/fields.py
--- a/yt/frontends/gadget/fields.py
+++ b/yt/frontends/gadget/fields.py
@@ -52,7 +52,7 @@
                 return _Fraction
 
             self.add_field( (ptype, metal_name+"_fraction"),
-                            "particle",
+                            sampling_type="particle",
                             function=_Fraction_wrap(i),
                             units="")
 
@@ -64,7 +64,7 @@
                 return _Metal_density
 
             self.add_field( (ptype, metal_name+"_density"),
-                            "particle",
+                            sampling_type="particle",
                             function=_Density_wrap(i),
                             units=self.ds.unit_system["density"])
 
@@ -90,7 +90,7 @@
 
         self.add_field(
             (ptype, "Temperature"),
-            "particle",
+            sampling_type="particle",
             function=_temperature,
             units=self.ds.unit_system["temperature"])
 

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/gamer/fields.py
--- a/yt/frontends/gamer/fields.py
+++ b/yt/frontends/gamer/fields.py
@@ -69,7 +69,7 @@
                 return data["gas", "momentum_%s"%v] / data["gas","density"]
             return _velocity
         for v in "xyz":
-            self.add_field( ("gas","velocity_%s"%v), "cell",
+            self.add_field( ("gas","velocity_%s"%v), sampling_type="cell",
                             function = velocity_xyz(v),
                             units = unit_system["velocity"] )
 
@@ -95,21 +95,21 @@
         # thermal energy per mass (i.e., specific)
         def _thermal_energy(field, data):
             return et(data) / data["gamer","Dens"]
-        self.add_field( ("gas","thermal_energy"), "cell",
+        self.add_field( ("gas","thermal_energy"), sampling_type="cell",
                         function = _thermal_energy,
                         units = unit_system["specific_energy"] )
 
         # total energy per mass
         def _total_energy(field, data):
             return data["gamer","Engy"] / data["gamer","Dens"]
-        self.add_field( ("gas","total_energy"), "cell",
+        self.add_field( ("gas","total_energy"), sampling_type="cell",
                         function = _total_energy,
                         units = unit_system["specific_energy"] )
 
         # pressure
         def _pressure(field, data):
             return et(data)*(data.ds.gamma-1.0)
-        self.add_field( ("gas","pressure"), "cell",
+        self.add_field( ("gas","pressure"), sampling_type="cell",
                         function = _pressure,
                         units = unit_system["pressure"] )
 
@@ -117,7 +117,7 @@
         def _temperature(field, data):
             return data.ds.mu*mh*data["gas","pressure"] / \
                    (data["gas","density"]*boltzmann_constant_cgs)
-        self.add_field( ("gas","temperature"), "cell",
+        self.add_field( ("gas","temperature"), sampling_type="cell",
                         function = _temperature,
                         units = unit_system["temperature"] )
 

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/gizmo/fields.py
--- a/yt/frontends/gizmo/fields.py
+++ b/yt/frontends/gizmo/fields.py
@@ -73,7 +73,7 @@
 
         self.add_field(
             (ptype, "H_density"),
-            "particle",
+            sampling_type="particle",
             function=_h_density,
             units=self.ds.unit_system["density"])
         add_species_field_by_density(self, ptype, "H", particle_type=True)
@@ -88,7 +88,7 @@
 
         self.add_field(
             (ptype, "H_p1_density"),
-            "particle",
+            sampling_type="particle",
             function=_h_p1_density,
             units=self.ds.unit_system["density"])
         add_species_field_by_density(self, ptype, "H_p1", particle_type=True)
@@ -111,7 +111,7 @@
         for species in self.nuclei_names:
             self.add_field(
                 (ptype, "%s_nuclei_mass_density" % species),
-                "particle",
+                sampling_type="particle",
                 function=_nuclei_mass_density_field,
                 units=self.ds.unit_system["density"])
 

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/open_pmd/fields.py
--- a/yt/frontends/open_pmd/fields.py
+++ b/yt/frontends/open_pmd/fields.py
@@ -44,7 +44,7 @@
         return poynting
 
     for ax in "xyz":
-        self.add_field(("openPMD", "poynting_vector_%s" % ax), "cell", 
+        self.add_field(("openPMD", "poynting_vector_%s" % ax), sampling_type="cell", 
                        function=_get_poyn(ax),
                        units="W/m**2")
 
@@ -57,7 +57,7 @@
         mass = data[ptype, "particle_mass"] * data[ptype, "particle_weighting"]
         return speed_of_light * np.sqrt(p2 + mass ** 2 * speed_of_light ** 2) - mass * speed_of_light ** 2
 
-    self.add_field((ptype, "particle_kinetic_energy"), "cell", 
+    self.add_field((ptype, "particle_kinetic_energy"), sampling_type="cell", 
                    function=_kin_en,
                    units="kg*m**2/s**2",
                    particle_type=True)
@@ -78,7 +78,7 @@
         return velocity
 
     for ax in "xyz":
-        self.add_field((ptype, "particle_velocity_%s" % ax), "cell", 
+        self.add_field((ptype, "particle_velocity_%s" % ax), sampling_type="cell", 
                        function=_get_vel(ax),
                        units="m/s",
                        particle_type=True)
@@ -93,7 +93,7 @@
         return ap
 
     for ax in "xyz":
-        self.add_field((ptype, "particle_position_%s" % ax), "cell", 
+        self.add_field((ptype, "particle_position_%s" % ax), sampling_type="cell", 
                        function=_abs_pos(ax),
                        units="m",
                        particle_type=True)

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/owls/fields.py
--- a/yt/frontends/owls/fields.py
+++ b/yt/frontends/owls/fields.py
@@ -217,7 +217,7 @@
             fname = yt_ion + '_density'
             dens_func = self._create_ion_density_func( ftype, ion )
             self.add_field( (ftype, fname),
-                            "particle",
+                            sampling_type="particle",
                             function = dens_func,
                             units=self.ds.unit_system["density"])
             self._show_field_errors.append( (ftype,fname) )

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -89,7 +89,7 @@
             rv = data["gas", "pressure"]/data["gas", "density"]
             rv *= mass_hydrogen_cgs/boltzmann_constant_cgs
             return rv
-        self.add_field(("gas", "temperature"), "cell",  function=_temperature,
+        self.add_field(("gas", "temperature"), sampling_type="cell",  function=_temperature,
                         units=self.ds.unit_system["temperature"])
         self.create_cooling_fields()
 
@@ -107,7 +107,7 @@
                      'logT' : np.log10(data["temperature"]).ravel()}
                 rv = 10**interp_object(d).reshape(shape)
                 return rv
-            self.add_field(name = name, sampling_type = "cell", function=_func,
+            self.add_field(name = name, sampling_type = sampling_type="cell", function=_func,
                                  units = "code_length**-3")
         avals = {}
         tvals = {}

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/stream/fields.py
--- a/yt/frontends/stream/fields.py
+++ b/yt/frontends/stream/fields.py
@@ -75,7 +75,7 @@
             setup_magnetic_field_aliases
         for field in self.ds.stream_handler.field_units:
             units = self.ds.stream_handler.field_units[field]
-            if units != '': self.add_output_field(field, "cell", units=units)
+            if units != '': self.add_output_field(field, sampling_type="cell", units=units)
         setup_magnetic_field_aliases(self, "stream", ["magnetic_field_%s" % ax for ax in "xyz"])
 
     def add_output_field(self, name, sampling_type, **kwargs):

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/tipsy/fields.py
--- a/yt/frontends/tipsy/fields.py
+++ b/yt/frontends/tipsy/fields.py
@@ -73,6 +73,6 @@
 
         self.add_field(
             (ptype, "smoothing_length"),
-            "particle",
+            sampling_type="particle",
             function=_func(),
             units="code_length")

diff -r 2efc57ec3f0c945d0aa7256e760d05ba77f41de7 -r 2daa80b00e042f129a7da7577da791e5b5862a4e yt/frontends/ytdata/fields.py
--- a/yt/frontends/ytdata/fields.py
+++ b/yt/frontends/ytdata/fields.py
@@ -48,7 +48,7 @@
                 return data["grid", "dx"] * \
                   data["grid", "dy"] * \
                   data["grid", "dz"]
-            self.add_field(("grid", "cell_volume"), "cell",  function=_cell_volume,
+            self.add_field(("grid", "cell_volume"), sampling_type="cell",  function=_cell_volume,
                            units="cm**3", particle_type=True)
 
 class YTGridFieldInfo(FieldInfoContainer):


https://bitbucket.org/yt_analysis/yt/commits/ded30bee7a53/
Changeset:   ded30bee7a53
Branch:      yt
User:        al007
Date:        2016-09-26 20:48:19+00:00
Summary:     Find and replace in coordinates/ and off_axis_projection.py
Affected #:  6 files

diff -r 2daa80b00e042f129a7da7577da791e5b5862a4e -r ded30bee7a53dcf4131a11eff093307a9d2af5ff yt/geometry/coordinates/cartesian_coordinates.py
--- a/yt/geometry/coordinates/cartesian_coordinates.py
+++ b/yt/geometry/coordinates/cartesian_coordinates.py
@@ -37,17 +37,17 @@
     def setup_fields(self, registry):
         for axi, ax in enumerate(self.axis_order):
             f1, f2 = _get_coord_fields(axi)
-            registry.add_field(("index", "d%s" % ax), "cell",  function = f1,
+            registry.add_field(("index", "d%s" % ax), sampling_type="cell",  function = f1,
                                display_field = False,
                                units = "code_length")
-            registry.add_field(("index", "path_element_%s" % ax), "cell",  function = f1,
+            registry.add_field(("index", "path_element_%s" % ax), sampling_type="cell",  function = f1,
                                display_field = False,
                                units = "code_length")
-            registry.add_field(("index", "%s" % ax), "cell",  function = f2,
+            registry.add_field(("index", "%s" % ax), sampling_type="cell",  function = f2,
                                display_field = False,
                                units = "code_length")
             f3 = _get_vert_fields(axi)
-            registry.add_field(("index", "vertex_%s" % ax), "cell",  function = f3,
+            registry.add_field(("index", "vertex_%s" % ax), sampling_type="cell",  function = f3,
                                display_field = False,
                                units = "code_length")
         def _cell_volume(field, data):
@@ -55,7 +55,7 @@
             rv *= data["index", "dy"]
             rv *= data["index", "dz"]
             return rv
-        registry.add_field(("index", "cell_volume"), "cell",  function=_cell_volume,
+        registry.add_field(("index", "cell_volume"), sampling_type="cell",  function=_cell_volume,
                            display_field=False, units = "code_length**3")
         registry.check_derived_fields(
             [("index", "dx"), ("index", "dy"), ("index", "dz"),

diff -r 2daa80b00e042f129a7da7577da791e5b5862a4e -r ded30bee7a53dcf4131a11eff093307a9d2af5ff yt/geometry/coordinates/cylindrical_coordinates.py
--- a/yt/geometry/coordinates/cylindrical_coordinates.py
+++ b/yt/geometry/coordinates/cylindrical_coordinates.py
@@ -39,31 +39,31 @@
 
     def setup_fields(self, registry):
         # return the fields for r, z, theta
-        registry.add_field(("index", "dx"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "dy"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "x"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "y"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "dx"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "dy"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "x"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "y"), sampling_type="cell",  function=_unknown_coord)
         f1, f2 = _get_coord_fields(self.axis_id['r'])
-        registry.add_field(("index", "dr"), "cell",  function = f1,
+        registry.add_field(("index", "dr"), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "code_length")
-        registry.add_field(("index", "r"), "cell",  function = f2,
+        registry.add_field(("index", "r"), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "code_length")
 
         f1, f2 = _get_coord_fields(self.axis_id['z'])
-        registry.add_field(("index", "dz"), "cell",  function = f1,
+        registry.add_field(("index", "dz"), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "code_length")
-        registry.add_field(("index", "z"), "cell",  function = f2,
+        registry.add_field(("index", "z"), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "code_length")
 
         f1, f2 = _get_coord_fields(self.axis_id['theta'], "")
-        registry.add_field(("index", "dtheta"), "cell",  function = f1,
+        registry.add_field(("index", "dtheta"), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "theta"), "cell",  function = f2,
+        registry.add_field(("index", "theta"), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "")
 
@@ -72,24 +72,24 @@
                  * data["index", "r"] \
                  * data["index", "dr"] \
                  * data["index", "dz"]
-        registry.add_field(("index", "cell_volume"), "cell", 
+        registry.add_field(("index", "cell_volume"), sampling_type="cell", 
                  function=_CylindricalVolume,
                  units = "code_length**3")
 
         def _path_r(field, data):
             return data["index", "dr"]
-        registry.add_field(("index", "path_element_r"), "cell", 
+        registry.add_field(("index", "path_element_r"), sampling_type="cell", 
                  function = _path_r,
                  units = "code_length")
         def _path_theta(field, data):
             # Note: this already assumes cell-centered
             return data["index", "r"] * data["index", "dtheta"]
-        registry.add_field(("index", "path_element_theta"), "cell", 
+        registry.add_field(("index", "path_element_theta"), sampling_type="cell", 
                  function = _path_theta,
                  units = "code_length")
         def _path_z(field, data):
             return data["index", "dz"]
-        registry.add_field(("index", "path_element_z"), "cell", 
+        registry.add_field(("index", "path_element_z"), sampling_type="cell", 
                  function = _path_z,
                  units = "code_length")
 

diff -r 2daa80b00e042f129a7da7577da791e5b5862a4e -r ded30bee7a53dcf4131a11eff093307a9d2af5ff yt/geometry/coordinates/geographic_coordinates.py
--- a/yt/geometry/coordinates/geographic_coordinates.py
+++ b/yt/geometry/coordinates/geographic_coordinates.py
@@ -37,33 +37,33 @@
 
     def setup_fields(self, registry):
         # return the fields for r, z, theta
-        registry.add_field(("index", "dx"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "dy"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "dz"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "x"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "y"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "z"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "dx"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "dy"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "dz"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "x"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "y"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "z"), sampling_type="cell",  function=_unknown_coord)
         f1, f2 = _get_coord_fields(self.axis_id['latitude'], "")
-        registry.add_field(("index", "dlatitude"), "cell",  function = f1,
+        registry.add_field(("index", "dlatitude"), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "latitude"), "cell",  function = f2,
+        registry.add_field(("index", "latitude"), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "")
 
         f1, f2 = _get_coord_fields(self.axis_id['longitude'], "")
-        registry.add_field(("index", "dlongitude"), "cell",  function = f1,
+        registry.add_field(("index", "dlongitude"), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "longitude"), "cell",  function = f2,
+        registry.add_field(("index", "longitude"), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "")
 
         f1, f2 = _get_coord_fields(self.axis_id[self.radial_axis])
-        registry.add_field(("index", "d%s" % (self.radial_axis,)), "cell",  function = f1,
+        registry.add_field(("index", "d%s" % (self.radial_axis,)), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "code_length")
-        registry.add_field(("index", self.radial_axis), "cell",  function = f2,
+        registry.add_field(("index", self.radial_axis), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "code_length")
 
@@ -76,20 +76,20 @@
             vol *= data["index", "dtheta"]
             vol *= data["index", "dphi"]
             return vol
-        registry.add_field(("index", "cell_volume"), "cell", 
+        registry.add_field(("index", "cell_volume"), sampling_type="cell", 
                  function=_SphericalVolume,
                  units = "code_length**3")
 
         def _path_radial_axis(field, data):
             return data["index", "d%s" % self.radial_axis]
-        registry.add_field(("index", "path_element_%s" % self.radial_axis), "cell", 
+        registry.add_field(("index", "path_element_%s" % self.radial_axis), sampling_type="cell", 
                  function = _path_radial_axis,
                  units = "code_length")
         def _path_latitude(field, data):
             # We use r here explicitly
             return data["index", "r"] * \
                 data["index", "dlatitude"] * np.pi/180.0
-        registry.add_field(("index", "path_element_latitude"), "cell", 
+        registry.add_field(("index", "path_element_latitude"), sampling_type="cell", 
                  function = _path_latitude,
                  units = "code_length")
         def _path_longitude(field, data):
@@ -97,31 +97,31 @@
             return data["index", "r"] \
                     * data["index", "dlongitude"] * np.pi/180.0 \
                     * np.sin((data["index", "latitude"] + 90.0) * np.pi/180.0)
-        registry.add_field(("index", "path_element_longitude"), "cell", 
+        registry.add_field(("index", "path_element_longitude"), sampling_type="cell", 
                  function = _path_longitude,
                  units = "code_length")
 
         def _latitude_to_theta(field, data):
             # latitude runs from -90 to 90
             return (data["latitude"] + 90) * np.pi/180.0
-        registry.add_field(("index", "theta"), "cell", 
+        registry.add_field(("index", "theta"), sampling_type="cell", 
                  function = _latitude_to_theta,
                  units = "")
         def _dlatitude_to_dtheta(field, data):
             return data["dlatitude"] * np.pi/180.0
-        registry.add_field(("index", "dtheta"), "cell", 
+        registry.add_field(("index", "dtheta"), sampling_type="cell", 
                  function = _dlatitude_to_dtheta,
                  units = "")
 
         def _longitude_to_phi(field, data):
             # longitude runs from -180 to 180
             return (data["longitude"] + 180) * np.pi/180.0
-        registry.add_field(("index", "phi"), "cell", 
+        registry.add_field(("index", "phi"), sampling_type="cell", 
                  function = _longitude_to_phi,
                  units = "")
         def _dlongitude_to_dphi(field, data):
             return data["dlongitude"] * np.pi/180.0
-        registry.add_field(("index", "dphi"), "cell", 
+        registry.add_field(("index", "dphi"), sampling_type="cell", 
                  function = _dlongitude_to_dphi,
                  units = "")
 
@@ -138,7 +138,7 @@
                 else:
                     surface_height = data.ds.quan(0.0, "code_length")
             return data["altitude"] + surface_height
-        registry.add_field(("index", "r"), "cell", 
+        registry.add_field(("index", "r"), sampling_type="cell", 
                  function=_altitude_to_radius,
                  units = "code_length")
         registry.alias(("index", "dr"), ("index", "daltitude"))
@@ -341,7 +341,7 @@
                     rax = self.axis_id[self.radial_axis]
                     outer_radius = data.ds.domain_right_edge[rax]
             return -1.0 * data["depth"] + outer_radius
-        registry.add_field(("index", "r"), "cell", 
+        registry.add_field(("index", "r"), sampling_type="cell", 
                  function=_depth_to_radius,
                  units = "code_length")
         registry.alias(("index", "dr"), ("index", "ddepth"))

diff -r 2daa80b00e042f129a7da7577da791e5b5862a4e -r ded30bee7a53dcf4131a11eff093307a9d2af5ff yt/geometry/coordinates/spec_cube_coordinates.py
--- a/yt/geometry/coordinates/spec_cube_coordinates.py
+++ b/yt/geometry/coordinates/spec_cube_coordinates.py
@@ -67,14 +67,14 @@
                     rv[:] = 1.0
                     return rv
                 return _length_func
-            registry.add_field(("index", "d%s" % ax), "cell",  function = f1,
+            registry.add_field(("index", "d%s" % ax), sampling_type="cell",  function = f1,
                                display_field = False,
                                units = "code_length")
-            registry.add_field(("index", "path_element_%s" % ax), "cell", 
+            registry.add_field(("index", "path_element_%s" % ax), sampling_type="cell", 
                                function = _get_length_func(),
                                display_field = False,
                                units = "")
-            registry.add_field(("index", "%s" % ax), "cell",  function = f2,
+            registry.add_field(("index", "%s" % ax), sampling_type="cell",  function = f2,
                                display_field = False,
                                units = "code_length")
         def _cell_volume(field, data):
@@ -82,7 +82,7 @@
             rv *= data["index", "dy"]
             rv *= data["index", "dz"]
             return rv
-        registry.add_field(("index", "cell_volume"), "cell",  function=_cell_volume,
+        registry.add_field(("index", "cell_volume"), sampling_type="cell",  function=_cell_volume,
                            display_field=False, units = "code_length**3")
         registry.check_derived_fields(
             [("index", "dx"), ("index", "dy"), ("index", "dz"),

diff -r 2daa80b00e042f129a7da7577da791e5b5862a4e -r ded30bee7a53dcf4131a11eff093307a9d2af5ff yt/geometry/coordinates/spherical_coordinates.py
--- a/yt/geometry/coordinates/spherical_coordinates.py
+++ b/yt/geometry/coordinates/spherical_coordinates.py
@@ -35,33 +35,33 @@
 
     def setup_fields(self, registry):
         # return the fields for r, z, theta
-        registry.add_field(("index", "dx"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "dy"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "dz"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "x"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "y"), "cell",  function=_unknown_coord)
-        registry.add_field(("index", "z"), "cell",  function=_unknown_coord)
+        registry.add_field(("index", "dx"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "dy"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "dz"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "x"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "y"), sampling_type="cell",  function=_unknown_coord)
+        registry.add_field(("index", "z"), sampling_type="cell",  function=_unknown_coord)
         f1, f2 = _get_coord_fields(self.axis_id['r'])
-        registry.add_field(("index", "dr"), "cell",  function = f1,
+        registry.add_field(("index", "dr"), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "code_length")
-        registry.add_field(("index", "r"), "cell",  function = f2,
+        registry.add_field(("index", "r"), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "code_length")
 
         f1, f2 = _get_coord_fields(self.axis_id['theta'], "")
-        registry.add_field(("index", "dtheta"), "cell",  function = f1,
+        registry.add_field(("index", "dtheta"), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "theta"), "cell",  function = f2,
+        registry.add_field(("index", "theta"), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "")
 
         f1, f2 = _get_coord_fields(self.axis_id['phi'], "")
-        registry.add_field(("index", "dphi"), "cell",  function = f1,
+        registry.add_field(("index", "dphi"), sampling_type="cell",  function = f1,
                            display_field = False,
                            units = "")
-        registry.add_field(("index", "phi"), "cell",  function = f2,
+        registry.add_field(("index", "phi"), sampling_type="cell",  function = f2,
                            display_field = False,
                            units = "")
 
@@ -73,19 +73,19 @@
             vol *= data["index", "dtheta"]
             vol *= data["index", "dphi"]
             return vol
-        registry.add_field(("index", "cell_volume"), "cell", 
+        registry.add_field(("index", "cell_volume"), sampling_type="cell", 
                  function=_SphericalVolume,
                  units = "code_length**3")
 
         def _path_r(field, data):
             return data["index", "dr"]
-        registry.add_field(("index", "path_element_r"), "cell", 
+        registry.add_field(("index", "path_element_r"), sampling_type="cell", 
                  function = _path_r,
                  units = "code_length")
         def _path_theta(field, data):
             # Note: this already assumes cell-centered
             return data["index", "r"] * data["index", "dtheta"]
-        registry.add_field(("index", "path_element_theta"), "cell", 
+        registry.add_field(("index", "path_element_theta"), sampling_type="cell", 
                  function = _path_theta,
                  units = "code_length")
         def _path_phi(field, data):
@@ -93,7 +93,7 @@
             return data["index", "r"] \
                     * data["index", "dphi"] \
                     * np.sin(data["index", "theta"])
-        registry.add_field(("index", "path_element_phi"), "cell", 
+        registry.add_field(("index", "path_element_phi"), sampling_type="cell", 
                  function = _path_phi,
                  units = "code_length")
 

diff -r 2daa80b00e042f129a7da7577da791e5b5862a4e -r ded30bee7a53dcf4131a11eff093307a9d2af5ff yt/visualization/volume_rendering/off_axis_projection.py
--- a/yt/visualization/volume_rendering/off_axis_projection.py
+++ b/yt/visualization/volume_rendering/off_axis_projection.py
@@ -138,7 +138,7 @@
                 return b.apply_units(tr, a.units)
                 return tr
             return temp_weightfield
-        data_source.ds.field_info.add_field(weightfield, "cell",
+        data_source.ds.field_info.add_field(weightfield, sampling_type="cell",
             function=_make_wf(item, weight))
         # Now we have to tell the dataset to add it and to calculate
         # its dependencies..


https://bitbucket.org/yt_analysis/yt/commits/9cf6901f10b6/
Changeset:   9cf6901f10b6
Branch:      yt
User:        al007
Date:        2016-09-26 20:50:34+00:00
Summary:     Too much replace in particle_fields.py.
Affected #:  1 file

diff -r ded30bee7a53dcf4131a11eff093307a9d2af5ff -r 9cf6901f10b631d5d512454ad68e3ae2777e195a yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -103,7 +103,7 @@
         return data.apply_units(d, field.units)
 
     registry.add_field(("deposit", "%s_count" % ptype),
-             sampling_type="cell",          
+             sampling_type="cell",
              function = particle_count,
              validators = [ValidateSpatial()],
              units = '',
@@ -117,7 +117,7 @@
         return data.apply_units(d, field.units)
 
     registry.add_field(("deposit", "%s_mass" % ptype),
-             sampling_type="cell",          
+             sampling_type="cell",
              function = particle_mass,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s Mass}" % ptype_dn,
@@ -132,7 +132,7 @@
         return d
 
     registry.add_field(("deposit", "%s_density" % ptype),
-             sampling_type="cell",          
+             sampling_type="cell",
              function = particle_density,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s Density}" % ptype_dn,
@@ -146,7 +146,7 @@
         return d
 
     registry.add_field(("deposit", "%s_cic" % ptype),
-             sampling_type="cell",          
+             sampling_type="cell",
              function = particle_cic,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s CIC Density}" % ptype_dn,
@@ -208,7 +208,7 @@
         data.deposit(pos, [ids], method = "mesh_id")
         return data.apply_units(ids, "")
     registry.add_field((ptype, "mesh_id"),
-            sampling_type="particle",           
+            sampling_type="particle",
             function = particle_mesh_ids,
             validators = [ValidateSpatial()],
             units = '')
@@ -239,7 +239,7 @@
 def particle_vector_functions(ptype, coord_names, vel_names, registry):
 
     unit_system = registry.ds.unit_system
-    
+
     # This will column_stack a set of scalars to create vector fields.
 
     def _get_vec_func(_ptype, names):
@@ -320,7 +320,7 @@
         f, v = _get_spec_ang_mom_comp(axi, ax, ptype)
         registry.add_field(
             (ptype, "particle_specific_angular_momentum_%s" % ax),
-            sampling_type = sampling_type="particle", function=f, units=unit_system["specific_angular_momentum"],
+            sampling_type="particle", function=f, units=unit_system["specific_angular_momentum"],
             validators=[ValidateParameter("center")]
         )
         registry.add_field((ptype, "particle_angular_momentum_%s" % ax),
@@ -338,7 +338,7 @@
               validators=[ValidateParameter("center")])
 
     create_magnitude_field(registry, "particle_angular_momentum",
-                           unit_system["angular_momentum"], 
+                           unit_system["angular_momentum"],
                            ftype=ptype, particle_type=True)
 
     def _particle_radius(field, data):
@@ -428,7 +428,7 @@
         return data[ptype, 'particle_position_spherical_radius']
 
     registry.add_field((ptype, "particle_spherical_position_radius"),
-              sampling_type="particle",  
+              sampling_type="particle",
               function=_particle_spherical_position_radius,
               units=unit_system["length"],
               validators=[ValidateParameter("normal"),


https://bitbucket.org/yt_analysis/yt/commits/e25f51c19d81/
Changeset:   e25f51c19d81
Branch:      yt
User:        al007
Date:        2016-09-26 21:34:48+00:00
Summary:     Fix typo in ramses/fields.py
Affected #:  1 file

diff -r 9cf6901f10b631d5d512454ad68e3ae2777e195a -r e25f51c19d814cfb89aa04ecbf4f42dbdfc54a2c yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -107,7 +107,7 @@
                      'logT' : np.log10(data["temperature"]).ravel()}
                 rv = 10**interp_object(d).reshape(shape)
                 return rv
-            self.add_field(name = name, sampling_type = sampling_type="cell", function=_func,
+            self.add_field(name = name, sampling_type="cell", function=_func,
                                  units = "code_length**-3")
         avals = {}
         tvals = {}


https://bitbucket.org/yt_analysis/yt/commits/3b49ff119bd8/
Changeset:   3b49ff119bd8
Branch:      yt
User:        al007
Date:        2016-09-26 22:41:54+00:00
Summary:     Import warnings in static_output.py.
Affected #:  1 file

diff -r e25f51c19d814cfb89aa04ecbf4f42dbdfc54a2c -r 3b49ff119bd8f149c7ed538bbc067f6940e9ae5e yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -20,6 +20,7 @@
 import os
 import time
 import weakref
+import warnings
 
 from collections import defaultdict
 from yt.extern.six import add_metaclass, string_types


https://bitbucket.org/yt_analysis/yt/commits/a2c2f5e1dde6/
Changeset:   a2c2f5e1dde6
Branch:      yt
User:        al007
Date:        2016-09-27 14:28:12+00:00
Summary:     Catch contradicting sampling_type='cell' and particle_type='True'
Affected #:  4 files

diff -r 3b49ff119bd8f149c7ed538bbc067f6940e9ae5e -r a2c2f5e1dde6bca960102d12a540e0ebd3941db8 yt/frontends/artio/fields.py
--- a/yt/frontends/artio/fields.py
+++ b/yt/frontends/artio/fields.py
@@ -59,8 +59,8 @@
         ("MASS", ("code_mass", ["particle_mass"], None)),
         ("PID", ("", ["particle_index"], None)),
         ("SPECIES", ("", ["particle_type"], None)),
-        ("BIRTH_TIME", ("", [], None)),  # code-units defined as dimensionless to 
-                                         # avoid incorrect conversion 
+        ("BIRTH_TIME", ("", [], None)),  # code-units defined as dimensionless to
+                                         # avoid incorrect conversion
         ("INITIAL_MASS", ("code_mass", ["initial_mass"], None)),
         ("METALLICITY_SNIa", ("", ["metallicity_snia"], None)),
         ("METALLICITY_SNII", ("", ["metallicity_snii"], None)),
@@ -73,7 +73,7 @@
                 return data["momentum_%s" % axis]/data["density"]
             return velocity
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax), sampling_type="cell", 
+            self.add_field(("gas", "velocity_%s" % ax), sampling_type="cell",
                            function = _get_vel(ax),
                            units = unit_system["velocity"])
 
@@ -100,7 +100,7 @@
         self.add_field(("gas", "temperature"), sampling_type="cell",  function = _temperature,
                        units = unit_system["temperature"])
 
-        # Create a metal_density field as sum of existing metal fields. 
+        # Create a metal_density field as sum of existing metal fields.
         flag1 = ("artio", "HVAR_METAL_DENSITY_Ia") in self.field_list
         flag2 = ("artio", "HVAR_METAL_DENSITY_II") in self.field_list
         if flag1 or flag2:
@@ -117,7 +117,7 @@
                 def _metal_density(field, data):
                     tr = data["metal_ii_density"]
                     return tr
-            self.add_field(("gas","metal_density"), sampling_type="cell", 
+            self.add_field(("gas","metal_density"), sampling_type="cell",
                            function=_metal_density,
                            units=unit_system["density"],
                            take_log=True)
@@ -125,7 +125,7 @@
     def setup_particle_fields(self, ptype):
         if ptype == "STAR":
             def _creation_time(field,data):
-                # this test is necessary to avoid passing invalid tcode values 
+                # this test is necessary to avoid passing invalid tcode values
                 # to the function tphys_from_tcode during field detection
                 # (1.0 is not a valid tcode value)
                 if isinstance(data, FieldDetector):
@@ -137,21 +137,18 @@
                     return data["STAR","creation_time"]
                 return data.ds.current_time - data["STAR","creation_time"]
 
-            self.add_field((ptype, "creation_time"), sampling_type="cell",  function=_creation_time, units="yr",
-                        particle_type=True)
-            self.add_field((ptype, "age"), sampling_type="cell",  function=_age, units="yr",
-                        particle_type=True)
+            self.add_field((ptype, "creation_time"), sampling_type="particle",  function=_creation_time, units="yr")
+            self.add_field((ptype, "age"), sampling_type="particle",  function=_age, units="yr")
 
             if self.ds.cosmological_simulation:
                 def _creation_redshift(field,data):
-                    # this test is necessary to avoid passing invalid tcode values 
+                    # this test is necessary to avoid passing invalid tcode values
                     # to the function auni_from_tcode during field detection
                     # (1.0 is not a valid tcode value)
                     if isinstance(data, FieldDetector):
                         return data["STAR","BIRTH_TIME"]
                     return 1.0/data.ds._handle.auni_from_tcode_array(data["STAR","BIRTH_TIME"]) - 1.0
 
-                self.add_field((ptype, "creation_redshift"), sampling_type="cell",  function=_creation_redshift,
-                        particle_type=True)
+                self.add_field((ptype, "creation_redshift"), sampling_type="particle",  function=_creation_redshift)
 
         super(ARTIOFieldInfo, self).setup_particle_fields(ptype)

diff -r 3b49ff119bd8f149c7ed538bbc067f6940e9ae5e -r a2c2f5e1dde6bca960102d12a540e0ebd3941db8 yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -98,9 +98,8 @@
             return velocity
 
         for ax in 'xyz':
-            self.add_field((ptype, "particle_velocity_%s" % ax), sampling_type="cell",
+            self.add_field((ptype, "particle_velocity_%s" % ax), sampling_type="particle",
                            function=_get_vel(ax),
-                           particle_type=True,
                            units="code_length/code_time")
 
         super(BoxlibFieldInfo, self).setup_particle_fields(ptype)

diff -r 3b49ff119bd8f149c7ed538bbc067f6940e9ae5e -r a2c2f5e1dde6bca960102d12a540e0ebd3941db8 yt/frontends/open_pmd/fields.py
--- a/yt/frontends/open_pmd/fields.py
+++ b/yt/frontends/open_pmd/fields.py
@@ -44,7 +44,7 @@
         return poynting
 
     for ax in "xyz":
-        self.add_field(("openPMD", "poynting_vector_%s" % ax), sampling_type="cell", 
+        self.add_field(("openPMD", "poynting_vector_%s" % ax), sampling_type="cell",
                        function=_get_poyn(ax),
                        units="W/m**2")
 
@@ -57,11 +57,9 @@
         mass = data[ptype, "particle_mass"] * data[ptype, "particle_weighting"]
         return speed_of_light * np.sqrt(p2 + mass ** 2 * speed_of_light ** 2) - mass * speed_of_light ** 2
 
-    self.add_field((ptype, "particle_kinetic_energy"), sampling_type="cell", 
+    self.add_field((ptype, "particle_kinetic_energy"), sampling_type="particle",
                    function=_kin_en,
-                   units="kg*m**2/s**2",
-                   particle_type=True)
-
+                   units="kg*m**2/s**2")
 
 def setup_velocity(self, ptype):
     def _get_vel(axis):
@@ -78,10 +76,9 @@
         return velocity
 
     for ax in "xyz":
-        self.add_field((ptype, "particle_velocity_%s" % ax), sampling_type="cell", 
+        self.add_field((ptype, "particle_velocity_%s" % ax), sampling_type="particle",
                        function=_get_vel(ax),
-                       units="m/s",
-                       particle_type=True)
+                       units="m/s")
 
 
 def setup_absolute_positions(self, ptype):
@@ -93,10 +90,9 @@
         return ap
 
     for ax in "xyz":
-        self.add_field((ptype, "particle_position_%s" % ax), sampling_type="cell", 
+        self.add_field((ptype, "particle_position_%s" % ax), sampling_type="particle",
                        function=_abs_pos(ax),
-                       units="m",
-                       particle_type=True)
+                       units="m")
 
 
 class OpenPMDFieldInfo(FieldInfoContainer):

diff -r 3b49ff119bd8f149c7ed538bbc067f6940e9ae5e -r a2c2f5e1dde6bca960102d12a540e0ebd3941db8 yt/frontends/ytdata/fields.py
--- a/yt/frontends/ytdata/fields.py
+++ b/yt/frontends/ytdata/fields.py
@@ -48,8 +48,8 @@
                 return data["grid", "dx"] * \
                   data["grid", "dy"] * \
                   data["grid", "dz"]
-            self.add_field(("grid", "cell_volume"), sampling_type="cell",  function=_cell_volume,
-                           units="cm**3", particle_type=True)
+            self.add_field(("grid", "cell_volume"), sampling_type="particle",  function=_cell_volume,
+                           units="cm**3")
 
 class YTGridFieldInfo(FieldInfoContainer):
     known_other_fields = (


https://bitbucket.org/yt_analysis/yt/commits/9b5937af5857/
Changeset:   9b5937af5857
Branch:      yt
User:        atmyers
Date:        2016-09-28 05:42:30+00:00
Summary:     Merged in al007/yt (pull request #2385)

Make sampler_type required for built-in derived fields.
Affected #:  39 files

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -20,6 +20,7 @@
 import os
 import time
 import weakref
+import warnings
 
 from collections import defaultdict
 from yt.extern.six import add_metaclass, string_types
@@ -214,7 +215,7 @@
             obj = _cached_datasets[apath]
         return obj
 
-    def __init__(self, filename, dataset_type=None, file_style=None, 
+    def __init__(self, filename, dataset_type=None, file_style=None,
                  units_override=None, unit_system="cgs"):
         """
         Base class for generating new output types.  Principally consists of
@@ -338,7 +339,7 @@
         in that directory, and a list of subdirectories.  It should return a
         list of filenames (defined relative to the supplied directory) and a
         boolean as to whether or not further directories should be recursed.
-        
+
         This function doesn't need to catch all possibilities, nor does it need
         to filter possibilities.
         """
@@ -938,7 +939,7 @@
             "dangerous option that may yield inconsistent results, and must be "
             "used very carefully, and only if you know what you want from it.")
         for unit, cgs in [("length", "cm"), ("time", "s"), ("mass", "g"),
-                          ("velocity","cm/s"), ("magnetic","gauss"), 
+                          ("velocity","cm/s"), ("magnetic","gauss"),
                           ("temperature","K")]:
             val = self.units_override.get("%s_unit" % unit, None)
             if val is not None:
@@ -1043,7 +1044,7 @@
         self._quan = functools.partial(YTQuantity, registry=self.unit_registry)
         return self._quan
 
-    def add_field(self, name, function=None, **kwargs):
+    def add_field(self, name, function=None, sampling_type=None, **kwargs):
         """
         Dataset-specific call to add_field
 
@@ -1081,7 +1082,18 @@
         if not override and name in self.field_info:
             mylog.warning("Field %s already exists. To override use " +
                           "force_override=True.", name)
-        self.field_info.add_field(name, function=function, **kwargs)
+        if kwargs.setdefault('particle_type', False):
+            if sampling_type is not None and sampling_type != "particle":
+                raise RuntimeError("Clashing definition of 'sampling_type' and "
+                               "'particle_type'. Note that 'particle_type' is "
+                               "deprecated. Please just use 'sampling_type'.")
+            else:
+                sampling_type = "particle"
+        if sampling_type is None:
+            warnings.warn("Because 'sampling_type' not specified, yt will "
+                          "assume a cell 'sampling_type'")
+            sampling_type = "cell"
+        self.field_info.add_field(name, sampling_type, function=function, **kwargs)
         self.field_info._show_field_errors.append(name)
         deps, _ = self.field_info.check_derived_fields([name])
         self.field_dependencies.update(deps)

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/angular_momentum.py
--- a/yt/fields/angular_momentum.py
+++ b/yt/fields/angular_momentum.py
@@ -59,15 +59,15 @@
         rv = data.ds.arr(rv, input_units = data["index", "x"].units)
         return xv * rv[...,1] - yv * rv[...,0]
 
-    registry.add_field((ftype, "specific_angular_momentum_x"),
+    registry.add_field((ftype, "specific_angular_momentum_x"), sampling_type="cell", 
                         function=_specific_angular_momentum_x,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
-    registry.add_field((ftype, "specific_angular_momentum_y"),
+    registry.add_field((ftype, "specific_angular_momentum_y"), sampling_type="cell", 
                         function=_specific_angular_momentum_y,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
-    registry.add_field((ftype, "specific_angular_momentum_z"),
+    registry.add_field((ftype, "specific_angular_momentum_z"), sampling_type="cell", 
                         function=_specific_angular_momentum_z,
                         units=unit_system["specific_angular_momentum"],
                         validators=[ValidateParameter("center")])
@@ -78,7 +78,7 @@
     def _angular_momentum_x(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_x"]
-    registry.add_field((ftype, "angular_momentum_x"),
+    registry.add_field((ftype, "angular_momentum_x"), sampling_type="cell", 
                        function=_angular_momentum_x,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])
@@ -86,7 +86,7 @@
     def _angular_momentum_y(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_y"]
-    registry.add_field((ftype, "angular_momentum_y"),
+    registry.add_field((ftype, "angular_momentum_y"), sampling_type="cell", 
                        function=_angular_momentum_y,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])
@@ -94,7 +94,7 @@
     def _angular_momentum_z(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_z"]
-    registry.add_field((ftype, "angular_momentum_z"),
+    registry.add_field((ftype, "angular_momentum_z"), sampling_type="cell", 
                        function=_angular_momentum_z,
                        units=unit_system["angular_momentum"],
                        validators=[ValidateParameter('center')])

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/astro_fields.py
--- a/yt/fields/astro_fields.py
+++ b/yt/fields/astro_fields.py
@@ -52,7 +52,7 @@
         """
         return np.sqrt(3.0 * np.pi / (16.0 * G * data[ftype, "density"]))
 
-    registry.add_field((ftype, "dynamical_time"),
+    registry.add_field((ftype, "dynamical_time"), sampling_type="cell", 
                        function=_dynamical_time,
                        units=unit_system["time"])
 
@@ -65,7 +65,7 @@
              (data[ftype, "density"]**(-0.5)))
         return u
 
-    registry.add_field((ftype, "jeans_mass"),
+    registry.add_field((ftype, "jeans_mass"), sampling_type="cell", 
                        function=_jeans_mass,
                        units=unit_system["mass"])
 
@@ -88,7 +88,7 @@
                                     - 1.6667 * logT0**1  - 0.2193 * logT0)),
                            "") # add correct units here
 
-    registry.add_field((ftype, "chandra_emissivity"),
+    registry.add_field((ftype, "chandra_emissivity"), sampling_type="cell", 
                        function=_chandra_emissivity,
                        units="") # add correct units here
 
@@ -102,7 +102,7 @@
         nenh *= 0.5*(1.+X_H)*X_H*data["cell_volume"]
         return nenh
     
-    registry.add_field((ftype, "emission_measure"),
+    registry.add_field((ftype, "emission_measure"), sampling_type="cell", 
                        function=_emission_measure,
                        units=unit_system["number_density"])
 
@@ -112,7 +112,7 @@
                            * data[ftype, "temperature"].to_ndarray()**0.5,
                            "") # add correct units here
 
-    registry.add_field((ftype, "xray_emissivity"),
+    registry.add_field((ftype, "xray_emissivity"), sampling_type="cell", 
                        function=_xray_emissivity,
                        units="") # add correct units here
 
@@ -121,7 +121,7 @@
         # Only useful as a weight_field for temperature, metallicity, velocity
         return data["density"]*data["density"]*data["kT"]**-0.25/mh/mh
 
-    registry.add_field((ftype,"mazzotta_weighting"),
+    registry.add_field((ftype,"mazzotta_weighting"), sampling_type="cell", 
                        function=_mazzotta_weighting,
                        units="keV**-0.25*cm**-6")
 
@@ -135,7 +135,7 @@
         # See issue #1225
         return -scale * vel * data[ftype, "density"]
 
-    registry.add_field((ftype, "sz_kinetic"),
+    registry.add_field((ftype, "sz_kinetic"), sampling_type="cell", 
                        function=_sz_kinetic,
                        units=unit_system["length"]**-1,
                        validators=[
@@ -145,6 +145,6 @@
         scale = 0.88 / mh * kboltz / (me * clight*clight) * sigma_thompson
         return scale * data[ftype, "density"] * data[ftype, "temperature"]
 
-    registry.add_field((ftype, "szy"),
+    registry.add_field((ftype, "szy"), sampling_type="cell", 
                        function=_szy,
                        units=unit_system["length"]**-1)

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/cosmology_fields.py
--- a/yt/fields/cosmology_fields.py
+++ b/yt/fields/cosmology_fields.py
@@ -45,14 +45,14 @@
         return data[ftype, "density"] + \
           data[ftype, "dark_matter_density"]
 
-    registry.add_field((ftype, "matter_density"),
+    registry.add_field((ftype, "matter_density"), sampling_type="cell", 
                        function=_matter_density,
                        units=unit_system["density"])
 
     def _matter_mass(field, data):
         return data[ftype, "matter_density"] * data["index", "cell_volume"]
 
-    registry.add_field((ftype, "matter_mass"),
+    registry.add_field((ftype, "matter_mass"), sampling_type="cell", 
                        function=_matter_mass,
                        units=unit_system["mass"])
 
@@ -65,7 +65,7 @@
         return data[ftype, "matter_density"] / \
           co.critical_density(data.ds.current_redshift)
 
-    registry.add_field((ftype, "overdensity"),
+    registry.add_field((ftype, "overdensity"), sampling_type="cell", 
                        function=_overdensity,
                        units="")
 
@@ -83,7 +83,7 @@
         return data[ftype, "density"] / omega_baryon / co.critical_density(0.0) / \
           (1.0 + data.ds.current_redshift)**3
 
-    registry.add_field((ftype, "baryon_overdensity"),
+    registry.add_field((ftype, "baryon_overdensity"), sampling_type="cell", 
                        function=_baryon_overdensity,
                        units="",
                        validators=[ValidateParameter("omega_baryon")])
@@ -100,7 +100,7 @@
           co.critical_density(0.0) / \
           (1.0 + data.ds.current_redshift)**3
 
-    registry.add_field((ftype, "matter_overdensity"),
+    registry.add_field((ftype, "matter_overdensity"), sampling_type="cell", 
                        function=_matter_overdensity,
                        units="")
 
@@ -109,7 +109,7 @@
         virial_radius = data.get_field_parameter("virial_radius")
         return data["radius"] / virial_radius
 
-    registry.add_field(("index", "virial_radius_fraction"),
+    registry.add_field(("index", "virial_radius_fraction"), sampling_type="cell", 
                        function=_virial_radius_fraction,
                        validators=[ValidateParameter("virial_radius")],
                        units="")
@@ -137,7 +137,7 @@
         return (1.5 * (co.hubble_constant / speed_of_light_cgs)**2 * (dl * dls / ds) * \
           data[ftype, "matter_overdensity"]).in_units("1/cm")
 
-    registry.add_field((ftype, "weak_lensing_convergence"),
+    registry.add_field((ftype, "weak_lensing_convergence"), sampling_type="cell", 
                        function=_weak_lensing_convergence,
                        units=unit_system["length"]**-1,
         validators=[ValidateParameter("observer_redshift"),

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/derived_field.py
--- a/yt/fields/derived_field.py
+++ b/yt/fields/derived_field.py
@@ -91,8 +91,8 @@
        The dimensions of the field, only needed if units="auto" and only used
        for error checking.
     """
-    def __init__(self, name, function, units=None,
-                 take_log=True, validators=None, sampling_type = "mesh",
+    def __init__(self, name, sampling_type, function, units=None,
+                 take_log=True, validators=None,
                  particle_type=None, vector_field=False, display_field=True,
                  not_in_all=False, display_name=None, output_units=None,
                  dimensions=None, ds=None):

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/field_info_container.py
--- a/yt/fields/field_info_container.py
+++ b/yt/fields/field_info_container.py
@@ -97,9 +97,9 @@
                 output_units = units
             if (ptype, f) not in self.field_list:
                 continue
-            self.add_output_field((ptype, f),
-                units = units, sampling_type = "particle",
-                display_name = dn, output_units = output_units)
+            self.add_output_field((ptype, f), sampling_type="particle",
+                units = units, display_name = dn, 
+                output_units = output_units)
             for alias in aliases:
                 self.alias((ptype, alias), (ptype, f), units = output_units)
 
@@ -134,9 +134,8 @@
                 raise RuntimeError
             if field[0] not in self.ds.particle_types:
                 continue
-            self.add_output_field(field, 
-                                  units = self.ds.field_units.get(field, ""),
-                                  sampling_type = "particle")
+            self.add_output_field(field, sampling_type="particle",
+                                  units = self.ds.field_units.get(field, ""))
         self.setup_smoothed_fields(ptype, 
                                    num_neighbors=num_neighbors,
                                    ftype=ftype)
@@ -196,12 +195,12 @@
                 units = ""
             elif units == 1.0:
                 units = ""
-            self.add_output_field(field, units = units,
+            self.add_output_field(field, sampling_type="cell", units = units,
                                   display_name = display_name)
             for alias in aliases:
                 self.alias(("gas", alias), field)
 
-    def add_field(self, name, function=None, **kwargs):
+    def add_field(self, name, sampling_type, function=None, **kwargs):
         """
         Add a new field, along with supplemental metadata, to the list of
         available fields.  This respects a number of arguments, all of which
@@ -250,12 +249,12 @@
         kwargs.setdefault('ds', self.ds)
         if function is None:
             def create_function(f):
-                self[name] = DerivedField(name, f, **kwargs)
+                self[name] = DerivedField(name, sampling_type, f, **kwargs)
                 return f
             return create_function
 
         if isinstance(name, tuple):
-            self[name] = DerivedField(name, function, **kwargs)
+            self[name] = DerivedField(name, sampling_type, function, **kwargs)
             return
 
         if kwargs.get("particle_type", False):
@@ -265,10 +264,11 @@
 
         if (ftype, name) not in self:
             tuple_name = (ftype, name)
-            self[tuple_name] = DerivedField(tuple_name, function, **kwargs)
+            self[tuple_name] = DerivedField(tuple_name, sampling_type, function,
+                                            **kwargs)
             self.alias(name, tuple_name)
         else:
-            self[name] = DerivedField(name, function, **kwargs)
+            self[name] = DerivedField(name, sampling_type, function, **kwargs)
 
     def load_all_plugins(self, ftype="gas"):
         loaded = []
@@ -296,9 +296,9 @@
         self.ds.derived_field_list = list(sorted(dfl, key=tupleize))
         return loaded, unavailable
 
-    def add_output_field(self, name, **kwargs):
+    def add_output_field(self, name, sampling_type, **kwargs):
         kwargs.setdefault('ds', self.ds)
-        self[name] = DerivedField(name, NullFunc, **kwargs)
+        self[name] = DerivedField(name, sampling_type, NullFunc, **kwargs)
 
     def alias(self, alias_name, original_name, units = None):
         if original_name not in self: return

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/fluid_fields.py
--- a/yt/fields/fluid_fields.py
+++ b/yt/fields/fluid_fields.py
@@ -59,14 +59,14 @@
     def _cell_mass(field, data):
         return data[ftype, "density"] * data[ftype, "cell_volume"]
 
-    registry.add_field((ftype, "cell_mass"),
+    registry.add_field((ftype, "cell_mass"), sampling_type="cell", 
         function=_cell_mass,
         units=unit_system["mass"])
 
     def _sound_speed(field, data):
         tr = data.ds.gamma * data[ftype, "pressure"] / data[ftype, "density"]
         return np.sqrt(tr)
-    registry.add_field((ftype, "sound_speed"),
+    registry.add_field((ftype, "sound_speed"), sampling_type="cell", 
              function=_sound_speed,
              units=unit_system["velocity"])
 
@@ -74,7 +74,7 @@
         """ Radial component of M{|v|/c_sound} """
         tr = data[ftype, "radial_velocity"] / data[ftype, "sound_speed"]
         return np.abs(tr)
-    registry.add_field((ftype, "radial_mach_number"),
+    registry.add_field((ftype, "radial_mach_number"), sampling_type="cell", 
              function=_radial_mach_number,
              units = "")
 
@@ -82,14 +82,14 @@
         return 0.5*data[ftype, "density"] * ( data[ftype, "velocity_x"]**2.0
                                               + data[ftype, "velocity_y"]**2.0
                                               + data[ftype, "velocity_z"]**2.0 )
-    registry.add_field((ftype, "kinetic_energy"),
+    registry.add_field((ftype, "kinetic_energy"), sampling_type="cell", 
                        function = _kin_energy,
                        units = unit_system["pressure"])
 
     def _mach_number(field, data):
         """ M{|v|/c_sound} """
         return data[ftype, "velocity_magnitude"] / data[ftype, "sound_speed"]
-    registry.add_field((ftype, "mach_number"),
+    registry.add_field((ftype, "mach_number"), sampling_type="cell", 
             function=_mach_number,
             units = "")
 
@@ -103,7 +103,7 @@
         tr = np.minimum(np.minimum(t1, t2), t3)
         return tr
 
-    registry.add_field((ftype, "courant_time_step"),
+    registry.add_field((ftype, "courant_time_step"), sampling_type="cell", 
              function=_courant_time_step,
              units=unit_system["time"])
 
@@ -113,13 +113,13 @@
            * (data[ftype, "density"] * data[ftype, "thermal_energy"])
         return tr
 
-    registry.add_field((ftype, "pressure"),
+    registry.add_field((ftype, "pressure"), sampling_type="cell", 
              function=_pressure,
              units=unit_system["pressure"])
 
     def _kT(field, data):
         return (kboltz*data[ftype, "temperature"]).in_units("keV")
-    registry.add_field((ftype, "kT"),
+    registry.add_field((ftype, "kT"), sampling_type="cell", 
                        function=_kT,
                        units="keV",
                        display_name="Temperature")
@@ -132,7 +132,7 @@
         gammam1 = 2./3.
         tr = data[ftype,"kT"] / ((data[ftype, "density"]/mw)**gammam1)
         return data.apply_units(tr, field.units)
-    registry.add_field((ftype, "entropy"),
+    registry.add_field((ftype, "entropy"), sampling_type="cell", 
              units="keV*cm**2",
              function=_entropy)
 
@@ -140,13 +140,13 @@
         tr = data[ftype, "metal_density"] / data[ftype, "density"]
         tr /= metallicity_sun
         return data.apply_units(tr, "Zsun")
-    registry.add_field((ftype, "metallicity"),
+    registry.add_field((ftype, "metallicity"), sampling_type="cell", 
              function=_metallicity,
              units="Zsun")
 
     def _metal_mass(field, data):
         return data[ftype, "metal_density"] * data[ftype, "cell_volume"]
-    registry.add_field((ftype, "metal_mass"),
+    registry.add_field((ftype, "metal_mass"), sampling_type="cell", 
                        function=_metal_mass,
                        units=unit_system["mass"])
 
@@ -156,13 +156,13 @@
         for species in data.ds.field_info.species_names:
             field_data += data["gas", "%s_number_density" % species]
         return field_data
-    registry.add_field((ftype, "number_density"),
+    registry.add_field((ftype, "number_density"), sampling_type="cell", 
                        function = _number_density,
                        units=unit_system["number_density"])
     
     def _mean_molecular_weight(field, data):
         return (data[ftype, "density"] / (mh * data[ftype, "number_density"]))
-    registry.add_field((ftype, "mean_molecular_weight"),
+    registry.add_field((ftype, "mean_molecular_weight"), sampling_type="cell", 
               function=_mean_molecular_weight,
               units="")
 
@@ -207,7 +207,7 @@
 
     for axi, ax in enumerate('xyz'):
         f = grad_func(axi, ax)
-        registry.add_field((ftype, "%s_gradient_%s" % (fname, ax)),
+        registry.add_field((ftype, "%s_gradient_%s" % (fname, ax)), sampling_type="cell", 
                            function = f,
                            validators = [ValidateSpatial(1, [grad_field])],
                            units = grad_units)

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/fluid_vector_fields.py
--- a/yt/fields/fluid_vector_fields.py
+++ b/yt/fields/fluid_vector_fields.py
@@ -67,7 +67,7 @@
     bv_validators = [ValidateSpatial(1, [(ftype, "density"), (ftype, "pressure")])]
     for ax in 'xyz':
         n = "baroclinic_vorticity_%s" % ax
-        registry.add_field((ftype, n), function=eval("_%s" % n),
+        registry.add_field((ftype, n), sampling_type="cell",  function=eval("_%s" % n),
                            validators=bv_validators,
                            units=unit_system["frequency"]**2)
 
@@ -119,7 +119,7 @@
                              (ftype, "velocity_z")])]
     for ax in 'xyz':
         n = "vorticity_%s" % ax
-        registry.add_field((ftype, n),
+        registry.add_field((ftype, n), sampling_type="cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"],
                            validators=vort_validators)
@@ -138,7 +138,7 @@
         return data[ftype, "velocity_divergence"] * data[ftype, "vorticity_z"]
     for ax in 'xyz':
         n = "vorticity_stretching_%s" % ax
-        registry.add_field((ftype, n), 
+        registry.add_field((ftype, n), sampling_type="cell",  
                            function=eval("_%s" % n),
                            units = unit_system["frequency"]**2,
                            validators=vort_validators)
@@ -159,7 +159,7 @@
           data[ftype, "baroclinic_vorticity_z"]
     for ax in 'xyz':
         n = "vorticity_growth_%s" % ax
-        registry.add_field((ftype, n),
+        registry.add_field((ftype, n), sampling_type="cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vort_validators)
@@ -175,7 +175,7 @@
         result = np.sign(dot) * result
         return result
     
-    registry.add_field((ftype, "vorticity_growth_magnitude"),
+    registry.add_field((ftype, "vorticity_growth_magnitude"), sampling_type="cell", 
               function=_vorticity_growth_magnitude,
               units=unit_system["frequency"]**2,
               validators=vort_validators,
@@ -186,7 +186,7 @@
                        data[ftype, "vorticity_growth_y"]**2 +
                        data[ftype, "vorticity_growth_z"]**2)
     
-    registry.add_field((ftype, "vorticity_growth_magnitude_absolute"),
+    registry.add_field((ftype, "vorticity_growth_magnitude_absolute"), sampling_type="cell", 
                        function=_vorticity_growth_magnitude_absolute,
                        units=unit_system["frequency"]**2,
                        validators=vort_validators)
@@ -197,7 +197,7 @@
         domegaz_dt = data[ftype, "vorticity_z"] / data[ftype, "vorticity_growth_z"]
         return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
     
-    registry.add_field((ftype, "vorticity_growth_timescale"),
+    registry.add_field((ftype, "vorticity_growth_timescale"), sampling_type="cell", 
                        function=_vorticity_growth_timescale,
                        units=unit_system["time"],
                        validators=vort_validators)
@@ -232,7 +232,7 @@
                              (ftype, "radiation_acceleration_z")])]
     for ax in 'xyz':
         n = "vorticity_radiation_pressure_%s" % ax
-        registry.add_field((ftype, n),
+        registry.add_field((ftype, n), sampling_type="cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vrp_validators)
@@ -257,7 +257,7 @@
                
     for ax in 'xyz':
         n = "vorticity_radiation_pressure_growth_%s" % ax
-        registry.add_field((ftype, n),
+        registry.add_field((ftype, n), sampling_type="cell", 
                            function=eval("_%s" % n),
                            units=unit_system["frequency"]**2,
                            validators=vrp_validators)
@@ -273,7 +273,7 @@
         result = np.sign(dot) * result
         return result
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude"),
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude"), sampling_type="cell", 
                        function=_vorticity_radiation_pressure_growth_magnitude,
                        units=unit_system["frequency"]**2,
                        validators=vrp_validators,
@@ -284,7 +284,7 @@
                        data[ftype, "vorticity_radiation_pressure_growth_y"]**2 +
                        data[ftype, "vorticity_radiation_pressure_growth_z"]**2)
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude_absolute"),
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_magnitude_absolute"), sampling_type="cell", 
                        function=_vorticity_radiation_pressure_growth_magnitude_absolute,
                        units="s**(-2)",
                        validators=vrp_validators)
@@ -298,7 +298,7 @@
           data[ftype, "vorticity_radiation_pressure_growth_z"]
         return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
     
-    registry.add_field((ftype, "vorticity_radiation_pressure_growth_timescale"),
+    registry.add_field((ftype, "vorticity_radiation_pressure_growth_timescale"), sampling_type="cell", 
                        function=_vorticity_radiation_pressure_growth_timescale,
                        units=unit_system["time"],
                        validators=vrp_validators)
@@ -344,7 +344,7 @@
         new_field[sl_center, sl_center, sl_center] = f
         return new_field
     
-    registry.add_field((ftype, "shear"),
+    registry.add_field((ftype, "shear"), sampling_type="cell", 
                        function=_shear,
                        validators=[ValidateSpatial(1,
                         [(ftype, "velocity_x"),
@@ -361,7 +361,7 @@
         
         return data[ftype, "shear"] / data[ftype, "sound_speed"]
 
-    registry.add_field((ftype, "shear_criterion"),
+    registry.add_field((ftype, "shear_criterion"), sampling_type="cell", 
                        function=_shear_criterion,
                        units=unit_system["length"]**-1,
                        validators=[ValidateSpatial(1,
@@ -417,7 +417,7 @@
         new_field[sl_center, sl_center, sl_center] = f
         return new_field
     
-    registry.add_field((ftype, "shear_mach"),
+    registry.add_field((ftype, "shear_mach"), sampling_type="cell", 
                        function=_shear_mach,
                        units="",
                        validators=[ValidateSpatial(1,

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/geometric_fields.py
--- a/yt/fields/geometric_fields.py
+++ b/yt/fields/geometric_fields.py
@@ -46,7 +46,7 @@
         """
         return get_radius(data, "")
 
-    registry.add_field(("index", "radius"),
+    registry.add_field(("index", "radius"), sampling_type="cell", 
                        function=_radius,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -59,7 +59,7 @@
             return data._reshape_vals(arr)
         return arr
 
-    registry.add_field(("index", "grid_level"),
+    registry.add_field(("index", "grid_level"), sampling_type="cell", 
                        function=_grid_level,
                        units="",
                        validators=[ValidateSpatial(0)])
@@ -76,7 +76,7 @@
             return data._reshape_vals(arr)
         return arr
 
-    registry.add_field(("index", "grid_indices"),
+    registry.add_field(("index", "grid_indices"), sampling_type="cell", 
                        function=_grid_indices,
                        units="",
                        validators=[ValidateSpatial(0)],
@@ -87,7 +87,7 @@
         return np.ones(data["index", "ones"].shape,
                        dtype="float64")/data["index", "dx"]
 
-    registry.add_field(("index", "ones_over_dx"),
+    registry.add_field(("index", "ones_over_dx"), sampling_type="cell", 
                        function=_ones_over_dx,
                        units=unit_system["length"]**-1,
                        display_field=False)
@@ -97,7 +97,7 @@
         arr = np.zeros(data["index", "ones"].shape, dtype='float64')
         return data.apply_units(arr, field.units)
 
-    registry.add_field(("index", "zeros"),
+    registry.add_field(("index", "zeros"), sampling_type="cell", 
                        function=_zeros,
                        units="",
                        display_field=False)
@@ -109,7 +109,7 @@
             return data._reshape_vals(arr)
         return data.apply_units(arr, field.units)
 
-    registry.add_field(("index", "ones"),
+    registry.add_field(("index", "ones"), sampling_type="cell", 
                        function=_ones,
                        units="",
                        display_field=False)
@@ -132,7 +132,7 @@
                                 data["index", "z"].ravel(), LE, RE)
         morton.shape = data["index", "x"].shape
         return morton.view("f8")
-    registry.add_field(("index", "morton_index"), function=_morton_index,
+    registry.add_field(("index", "morton_index"), sampling_type="cell",  function=_morton_index,
                        units = "")
         
     def _spherical_radius(field, data):
@@ -144,7 +144,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_sph_r(coords), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "spherical_radius"),
+    registry.add_field(("index", "spherical_radius"), sampling_type="cell", 
                        function=_spherical_radius,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -153,7 +153,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data['index', 'spherical_radius']
 
-    registry.add_field(("index", "spherical_r"),
+    registry.add_field(("index", "spherical_r"), sampling_type="cell", 
                        function=_spherical_r,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -171,7 +171,7 @@
         coords = get_periodic_rvec(data)
         return get_sph_theta(coords, normal)
 
-    registry.add_field(("index", "spherical_theta"),
+    registry.add_field(("index", "spherical_theta"), sampling_type="cell", 
                        function=_spherical_theta,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -190,7 +190,7 @@
         coords = get_periodic_rvec(data)
         return get_sph_phi(coords, normal)
 
-    registry.add_field(("index", "spherical_phi"),
+    registry.add_field(("index", "spherical_phi"), sampling_type="cell", 
                        function=_spherical_phi,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -206,7 +206,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_cyl_r(coords, normal), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "cylindrical_radius"),
+    registry.add_field(("index", "cylindrical_radius"), sampling_type="cell", 
                        function=_cylindrical_radius,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -216,7 +216,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data['index', 'cylindrical_radius']
 
-    registry.add_field(("index", "cylindrical_r"),
+    registry.add_field(("index", "cylindrical_r"), sampling_type="cell", 
                        function=_cylindrical_r,
                        validators=[ValidateParameter("center")],
                        units=unit_system["length"])
@@ -231,7 +231,7 @@
         coords = get_periodic_rvec(data)
         return data.ds.arr(get_cyl_z(coords, normal), "code_length").in_base(unit_system.name)
 
-    registry.add_field(("index", "cylindrical_z"),
+    registry.add_field(("index", "cylindrical_z"), sampling_type="cell", 
                        function=_cylindrical_z,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -250,7 +250,7 @@
         coords = get_periodic_rvec(data)
         return get_cyl_theta(coords, normal)
 
-    registry.add_field(("index", "cylindrical_theta"),
+    registry.add_field(("index", "cylindrical_theta"), sampling_type="cell", 
                        function=_cylindrical_theta,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],
@@ -260,7 +260,7 @@
         """This field is dprecated and will be removed in a future release"""
         return data["index", "spherical_theta"]
 
-    registry.add_field(("index", "disk_angle"),
+    registry.add_field(("index", "disk_angle"), sampling_type="cell", 
                        function=_disk_angle,
                        take_log=False,
                        display_field=False,
@@ -272,7 +272,7 @@
         """This field is deprecated and will be removed in a future release"""
         return data["index", "cylindrical_z"]
 
-    registry.add_field(("index", "height"),
+    registry.add_field(("index", "height"), sampling_type="cell", 
                        function=_height,
                        validators=[ValidateParameter("center"),
                                    ValidateParameter("normal")],

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/local_fields.py
--- a/yt/fields/local_fields.py
+++ b/yt/fields/local_fields.py
@@ -12,6 +12,7 @@
 #
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
+import warnings
 
 from yt.utilities.logger import \
     ytLogger as mylog
@@ -23,7 +24,7 @@
     FieldInfoContainer
 
 class LocalFieldInfoContainer(FieldInfoContainer):
-    def add_field(self, name, function=None, **kwargs):
+    def add_field(self, name, function=None, sampling_type=None, **kwargs):
         if not isinstance(name, tuple):
             if kwargs.setdefault('particle_type', False):
                 name = ('all', name)
@@ -34,8 +35,19 @@
         if not override and name in self:
             mylog.warning("Field %s already exists. To override use " +
                           "force_override=True.", name)
+        if kwargs.setdefault('particle_type', False):
+            if sampling_type is not None and sampling_type != "particle":
+                raise RuntimeError("Clashing definition of 'sampling_type' and "
+                               "'particle_type'. Note that 'particle_type' is "
+                               "deprecated. Please just use 'sampling_type'.")
+            else:
+                sampling_type = "particle"
+        if sampling_type is None:
+            warnings.warn("Because 'sampling_type' not specified, yt will "
+                          "assume a cell 'sampling_type'")
+            sampling_type = "cell"
         return super(LocalFieldInfoContainer,
-                     self).add_field(name, function, **kwargs)
+                     self).add_field(name, sampling_type, function, **kwargs)
 
 # Empty FieldInfoContainer
 local_fields = LocalFieldInfoContainer(None, [], None)

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/magnetic_field.py
--- a/yt/fields/magnetic_field.py
+++ b/yt/fields/magnetic_field.py
@@ -46,26 +46,26 @@
               data[ftype,"magnetic_field_y"]**2 +
               data[ftype,"magnetic_field_z"]**2)
         return np.sqrt(B2)
-    registry.add_field((ftype,"magnetic_field_strength"),
+    registry.add_field((ftype,"magnetic_field_strength"), sampling_type="cell", 
                        function=_magnetic_field_strength,
                        units=u)
 
     def _magnetic_energy(field, data):
         B = data[ftype,"magnetic_field_strength"]
         return 0.5*B*B/mag_factors[B.units.dimensions]
-    registry.add_field((ftype, "magnetic_energy"),
+    registry.add_field((ftype, "magnetic_energy"), sampling_type="cell", 
              function=_magnetic_energy,
              units=unit_system["pressure"])
 
     def _plasma_beta(field,data):
         return data[ftype,'pressure']/data[ftype,'magnetic_energy']
-    registry.add_field((ftype, "plasma_beta"),
+    registry.add_field((ftype, "plasma_beta"), sampling_type="cell", 
              function=_plasma_beta,
              units="")
 
     def _magnetic_pressure(field,data):
         return data[ftype,'magnetic_energy']
-    registry.add_field((ftype, "magnetic_pressure"),
+    registry.add_field((ftype, "magnetic_pressure"), sampling_type="cell", 
              function=_magnetic_pressure,
              units=unit_system["pressure"])
 
@@ -83,7 +83,7 @@
 
         return get_sph_theta_component(Bfields, theta, phi, normal)
 
-    registry.add_field((ftype, "magnetic_field_poloidal"),
+    registry.add_field((ftype, "magnetic_field_poloidal"), sampling_type="cell", 
              function=_magnetic_field_poloidal,
              units=u, validators=[ValidateParameter("normal")])
 
@@ -99,19 +99,19 @@
         phi = data["index", 'spherical_phi']
         return get_sph_phi_component(Bfields, phi, normal)
 
-    registry.add_field((ftype, "magnetic_field_toroidal"),
+    registry.add_field((ftype, "magnetic_field_toroidal"), sampling_type="cell", 
              function=_magnetic_field_toroidal,
              units=u, validators=[ValidateParameter("normal")])
 
     def _alfven_speed(field,data):
         B = data[ftype,'magnetic_field_strength']
         return B/np.sqrt(mag_factors[B.units.dimensions]*data[ftype,'density'])
-    registry.add_field((ftype, "alfven_speed"), function=_alfven_speed,
+    registry.add_field((ftype, "alfven_speed"), sampling_type="cell",  function=_alfven_speed,
                        units=unit_system["velocity"])
 
     def _mach_alfven(field,data):
         return data[ftype,'velocity_magnitude']/data[ftype,'alfven_speed']
-    registry.add_field((ftype, "mach_alfven"), function=_mach_alfven,
+    registry.add_field((ftype, "mach_alfven"), sampling_type="cell",  function=_mach_alfven,
                        units="dimensionless")
 
 def setup_magnetic_field_aliases(registry, ds_ftype, ds_fields, ftype="gas"):
@@ -161,6 +161,6 @@
             return convert(data[fd])
         return _mag_field
     for ax, fd in zip("xyz", ds_fields):
-        registry.add_field((ftype,"magnetic_field_%s" % ax),
+        registry.add_field((ftype,"magnetic_field_%s" % ax), sampling_type="cell", 
                            function=mag_field(fd),
-                           units=unit_system[to_units.dimensions])
\ No newline at end of file
+                           units=unit_system[to_units.dimensions])

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -103,6 +103,7 @@
         return data.apply_units(d, field.units)
 
     registry.add_field(("deposit", "%s_count" % ptype),
+             sampling_type="cell",
              function = particle_count,
              validators = [ValidateSpatial()],
              units = '',
@@ -116,6 +117,7 @@
         return data.apply_units(d, field.units)
 
     registry.add_field(("deposit", "%s_mass" % ptype),
+             sampling_type="cell",
              function = particle_mass,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s Mass}" % ptype_dn,
@@ -130,6 +132,7 @@
         return d
 
     registry.add_field(("deposit", "%s_density" % ptype),
+             sampling_type="cell",
              function = particle_density,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s Density}" % ptype_dn,
@@ -143,6 +146,7 @@
         return d
 
     registry.add_field(("deposit", "%s_cic" % ptype),
+             sampling_type="cell",
              function = particle_cic,
              validators = [ValidateSpatial()],
              display_name = r"\mathrm{%s CIC Density}" % ptype_dn,
@@ -171,7 +175,7 @@
             function = _get_density_weighted_deposit_field(
                 "particle_velocity_%s" % ax, "cm/s", method)
             registry.add_field(
-                ("deposit", ("%s_"+name+"_velocity_%s") % (ptype, ax)),
+                ("deposit", ("%s_"+name+"_velocity_%s") % (ptype, ax)), sampling_type="cell",
                 function=function, units=unit_system["velocity"], take_log=False,
                 validators=[ValidateSpatial(0)])
 
@@ -179,7 +183,7 @@
         function = _get_density_weighted_deposit_field(
             "age", "s", method)
         registry.add_field(
-            ("deposit", ("%s_"+name+"_age") % (ptype)),
+            ("deposit", ("%s_"+name+"_age") % (ptype)), sampling_type="cell",
             function=function, units=unit_system["time"], take_log=False,
             validators=[ValidateSpatial(0)])
 
@@ -190,8 +194,8 @@
         return data.apply_units(v, field.units)
 
     registry.add_field((ptype, "particle_ones"),
+                       sampling_type="particle",
                        function = particle_ones,
-                       sampling_type = "particle",
                        units = "",
                        display_name = r"Particle Count")
 
@@ -204,10 +208,10 @@
         data.deposit(pos, [ids], method = "mesh_id")
         return data.apply_units(ids, "")
     registry.add_field((ptype, "mesh_id"),
+            sampling_type="particle",
             function = particle_mesh_ids,
             validators = [ValidateSpatial()],
-            units = '',
-            sampling_type = "particle")
+            units = '')
 
     return list(set(registry.keys()).difference(orig))
 
@@ -228,16 +232,14 @@
     for axi, ax in enumerate("xyz"):
         v, p = _get_coord_funcs(axi, ptype)
         registry.add_field((ptype, "particle_velocity_%s" % ax),
-            sampling_type = "particle", function = v,
-            units = "code_velocity")
+            sampling_type="particle", function = v, units = "code_velocity")
         registry.add_field((ptype, "particle_position_%s" % ax),
-            sampling_type = "particle", function = p,
-            units = "code_length")
+            sampling_type="particle", function = p, units = "code_length")
 
 def particle_vector_functions(ptype, coord_names, vel_names, registry):
 
     unit_system = registry.ds.unit_system
-    
+
     # This will column_stack a set of scalars to create vector fields.
 
     def _get_vec_func(_ptype, names):
@@ -248,13 +250,13 @@
             return data.apply_units(c, field.units)
         return particle_vectors
     registry.add_field((ptype, "particle_position"),
+                       sampling_type="particle",
                        function=_get_vec_func(ptype, coord_names),
-                       units = "code_length",
-                       particle_type=True)
+                       units = "code_length")
     registry.add_field((ptype, "particle_velocity"),
+                       sampling_type="particle",
                        function=_get_vec_func(ptype, vel_names),
-                       units = unit_system["velocity"],
-                       particle_type=True)
+                       units = unit_system["velocity"])
 
 def get_angular_momentum_components(ptype, data, spos, svel):
     if data.has_field_parameter("normal"):
@@ -282,8 +284,8 @@
                      + (data[ptype, svel % 'z'] - bulk_velocity[2])**2 )
 
     registry.add_field((ptype, "particle_velocity_magnitude"),
+                  sampling_type="particle",
                   function=_particle_velocity_magnitude,
-                  particle_type=True,
                   take_log=False,
                   units=unit_system["velocity"])
 
@@ -301,8 +303,8 @@
 
 
     registry.add_field((ptype, "particle_specific_angular_momentum"),
+              sampling_type="particle",
               function=_particle_specific_angular_momentum,
-              particle_type=True,
               units=unit_system["specific_angular_momentum"],
               validators=[ValidateParameter("center")])
 
@@ -318,11 +320,11 @@
         f, v = _get_spec_ang_mom_comp(axi, ax, ptype)
         registry.add_field(
             (ptype, "particle_specific_angular_momentum_%s" % ax),
-            sampling_type = "particle", function=f, units=unit_system["specific_angular_momentum"],
+            sampling_type="particle", function=f, units=unit_system["specific_angular_momentum"],
             validators=[ValidateParameter("center")]
         )
         registry.add_field((ptype, "particle_angular_momentum_%s" % ax),
-            function=v, units=unit_system["angular_momentum"], particle_type=True,
+            sampling_type="particle", function=v, units=unit_system["angular_momentum"],
             validators=[ValidateParameter('center')])
 
     def _particle_angular_momentum(field, data):
@@ -330,13 +332,13 @@
         return am.T
 
     registry.add_field((ptype, "particle_angular_momentum"),
+              sampling_type="particle",
               function=_particle_angular_momentum,
-              particle_type=True,
               units=unit_system["angular_momentum"],
               validators=[ValidateParameter("center")])
 
     create_magnitude_field(registry, "particle_angular_momentum",
-                           unit_system["angular_momentum"], 
+                           unit_system["angular_momentum"],
                            ftype=ptype, particle_type=True)
 
     def _particle_radius(field, data):
@@ -349,9 +351,9 @@
 
     registry.add_field(
         (ptype, "particle_radius"),
+        sampling_type="particle",
         function=_particle_radius,
         units=unit_system["length"],
-        particle_type=True,
         validators=[ValidateParameter("center")])
 
     def _particle_position_relative(field, data):
@@ -370,8 +372,8 @@
 
     registry.add_field(
         (ptype, "particle_position_relative"),
+        sampling_type="particle",
         function=_particle_position_relative,
-        particle_type=True,
         units=unit_system["length"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -391,8 +393,9 @@
         return vel
 
     registry.add_field((ptype, "particle_velocity_relative"),
+              sampling_type="particle",
               function=_particle_velocity_relative,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -406,18 +409,17 @@
     for axi, ax in enumerate("xyz"):
         v, p = _get_coord_funcs_relative(axi, ptype)
         registry.add_field((ptype, "particle_velocity_relative_%s" % ax),
-            sampling_type = "particle", function = v,
-            units = "code_velocity")
+            sampling_type="particle", function = v, units = "code_velocity")
         registry.add_field((ptype, "particle_position_relative_%s" % ax),
-            sampling_type = "particle", function = p,
-            units = "code_length")
+            sampling_type="particle", function = p, units = "code_length")
 
 
     # this is just particle radius but we add it with an alias for the sake of
     # consistent naming
     registry.add_field((ptype, "particle_position_spherical_radius"),
+              sampling_type="particle",
               function=_particle_radius,
-              particle_type=True, units=unit_system["length"],
+              units=unit_system["length"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -426,8 +428,9 @@
         return data[ptype, 'particle_position_spherical_radius']
 
     registry.add_field((ptype, "particle_spherical_position_radius"),
+              sampling_type="particle",
               function=_particle_spherical_position_radius,
-              particle_type=True, units=unit_system["length"],
+              units=unit_system["length"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -445,8 +448,8 @@
 
     registry.add_field(
         (ptype, "particle_position_spherical_theta"),
+        sampling_type="particle",
         function=_particle_position_spherical_theta,
-        particle_type=True,
         units="",
         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
@@ -455,8 +458,9 @@
         return data[ptype, 'particle_position_spherical_theta']
 
     registry.add_field((ptype, "particle_spherical_position_theta"),
+              sampling_type="particle",
               function=_particle_spherical_position_theta,
-              particle_type=True, units="",
+              units="",
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -474,8 +478,8 @@
 
     registry.add_field(
         (ptype, "particle_position_spherical_phi"),
+        sampling_type="particle",
         function=_particle_position_spherical_phi,
-        particle_type=True,
         units="",
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -484,8 +488,9 @@
         return data[ptype, 'particle_position_spherical_phi']
 
     registry.add_field((ptype, "particle_spherical_position_phi"),
+             sampling_type="particle",
              function=_particle_spherical_position_phi,
-             particle_type=True, units="",
+             units="",
              validators=[ValidateParameter("center"),
                          ValidateParameter("normal")])
 
@@ -509,8 +514,9 @@
         return sphr
 
     registry.add_field((ptype, "particle_velocity_spherical_radius"),
+              sampling_type="particle",
               function=_particle_velocity_spherical_radius,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -519,16 +525,18 @@
         return data[ptype, 'particle_velocity_spherical_radius']
 
     registry.add_field((ptype, "particle_spherical_velocity_radius"),
+              sampling_type="particle",
               function=_particle_spherical_velocity_radius,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
     # particel_velocity_spherical_radius is simply aliased to
     # "particle_radial_velocity" for convenience
     registry.add_field((ptype, "particle_radial_velocity"),
+              sampling_type="particle",
               function=_particle_spherical_velocity_radius,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -553,8 +561,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_spherical_theta"),
+        sampling_type="particle",
         function=_particle_velocity_spherical_theta,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -563,8 +571,9 @@
         return data[ptype, 'particle_velocity_spherical_theta']
 
     registry.add_field((ptype, "particle_spherical_velocity_theta"),
+              sampling_type="particle",
               function=_particle_spherical_velocity_theta,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -587,8 +596,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_spherical_phi"),
+        sampling_type="particle",
         function=_particle_velocity_spherical_phi,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -597,8 +606,9 @@
         return data[ptype, 'particle_spherical_velocity_theta']
 
     registry.add_field((ptype, "particle_spherical_velocity_phi"),
+              sampling_type="particle",
               function=_particle_spherical_velocity_phi,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -617,9 +627,9 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_radius"),
+        sampling_type="particle",
         function=_particle_position_cylindrical_radius,
         units=unit_system["length"],
-        particle_type=True,
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
     def _particle_position_cylindrical_theta(field,data):
@@ -636,8 +646,8 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_theta"),
+        sampling_type="particle",
         function=_particle_position_cylindrical_theta,
-        particle_type=True,
         units="",
         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
@@ -656,9 +666,9 @@
 
     registry.add_field(
         (ptype, "particle_position_cylindrical_z"),
+        sampling_type="particle",
         function=_particle_position_cylindrical_z,
         units=unit_system["length"],
-        particle_type=True,
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
     def _particle_velocity_cylindrical_radius(field, data):
@@ -680,8 +690,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_radius"),
+        sampling_type="particle",
         function=_particle_velocity_cylindrical_radius,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -704,8 +714,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_theta"),
+        sampling_type="particle",
         function=_particle_velocity_cylindrical_theta,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -714,8 +724,9 @@
         return data[ptype, 'particle_velocity_cylindrical_theta']
 
     registry.add_field((ptype, "particle_cylindrical_velocity_theta"),
+              sampling_type="particle",
               function=_particle_cylindrical_velocity_theta,
-              particle_type=True, units="cm/s",
+              units="cm/s",
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -737,8 +748,8 @@
 
     registry.add_field(
         (ptype, "particle_velocity_cylindrical_z"),
+        sampling_type="particle",
         function=_particle_velocity_cylindrical_z,
-        particle_type=True,
         units=unit_system["velocity"],
         validators=[ValidateParameter("normal"), ValidateParameter("center")])
 
@@ -747,8 +758,9 @@
         return data[ptype, "particle_velocity_cylindrical_z"]
 
     registry.add_field((ptype, "particle_cylindrical_velocity_z"),
+              sampling_type="particle",
               function=_particle_cylindrical_velocity_z,
-              particle_type=True, units=unit_system["velocity"],
+              units=unit_system["velocity"],
               validators=[ValidateParameter("normal"),
                           ValidateParameter("center")])
 
@@ -769,9 +781,8 @@
         v[np.isnan(v)] = 0.0
         return v
     fn = ("deposit", "%s_avg_%s" % (ptype, field_name))
-    registry.add_field(fn, function=_pfunc_avg,
+    registry.add_field(fn, sampling_type="cell", function=_pfunc_avg,
                        validators = [ValidateSpatial(0)],
-                       particle_type = False,
                        units = field_units)
     return fn
 
@@ -816,7 +827,7 @@
         rv /= hsml.uq**3 / hsml.uq.in_base(unit_system.name).uq**3
         rv = data.apply_units(rv, field_units)
         return rv
-    registry.add_field(field_name, function = _vol_weight,
+    registry.add_field(field_name, sampling_type="cell", function = _vol_weight,
                        validators = [ValidateSpatial(0)],
                        units = field_units)
     registry.find_dependencies((field_name,))
@@ -833,9 +844,8 @@
                          nneighbors = nneighbors)
         # Now some quick unit conversions.
         return distances
-    registry.add_field(field_name, function = _nth_neighbor,
+    registry.add_field(field_name, sampling_type="particle", function = _nth_neighbor,
                        validators = [ValidateSpatial(0)],
-                       sampling_type = "particle",
                        units = "code_length")
     return [field_name]
 
@@ -850,6 +860,6 @@
                              for dep_type in data.ds.particle_types_raw])
 
     registry.add_field((ptype, field_name),
+                       sampling_type="particle",
                        function=_cat_field,
-                       particle_type=True,
                        units=units)

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -75,17 +75,17 @@
     """
     unit_system = registry.ds.unit_system
 
-    registry.add_field((ftype, "%s_fraction" % species), 
+    registry.add_field((ftype, "%s_fraction" % species), sampling_type="cell",  
                        function = _create_fraction_func(ftype, species),
                        particle_type = particle_type,
                        units = "")
 
-    registry.add_field((ftype, "%s_mass" % species),
+    registry.add_field((ftype, "%s_mass" % species), sampling_type="cell", 
                        function = _create_mass_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["mass"])
 
-    registry.add_field((ftype, "%s_number_density" % species),
+    registry.add_field((ftype, "%s_number_density" % species), sampling_type="cell", 
                        function = _create_number_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["number_density"])
@@ -103,17 +103,17 @@
     """
     unit_system = registry.ds.unit_system
 
-    registry.add_field((ftype, "%s_density" % species), 
+    registry.add_field((ftype, "%s_density" % species), sampling_type="cell",  
                        function = _create_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["density"])
 
-    registry.add_field((ftype, "%s_mass" % species),
+    registry.add_field((ftype, "%s_mass" % species), sampling_type="cell", 
                        function = _create_mass_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["mass"])
 
-    registry.add_field((ftype, "%s_number_density" % species),
+    registry.add_field((ftype, "%s_number_density" % species), sampling_type="cell", 
                        function = _create_number_density_func(ftype, species),
                        particle_type = particle_type,
                        units = unit_system["number_density"])
@@ -145,13 +145,13 @@
     unit_system = registry.ds.unit_system
     elements = _get_all_elements(registry.species_names)
     for element in elements:
-        registry.add_field((ftype, "%s_nuclei_density" % element),
+        registry.add_field((ftype, "%s_nuclei_density" % element), sampling_type="cell", 
                            function = _nuclei_density,
                            particle_type = particle_type,
                            units = unit_system["number_density"])
     if len(elements) == 0:
         for element in ["H", "He"]:
-            registry.add_field((ftype, "%s_nuclei_density" % element),
+            registry.add_field((ftype, "%s_nuclei_density" % element), sampling_type="cell", 
                                function = _default_nuclei_density,
                                particle_type = particle_type,
                                units = unit_system["number_density"])

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/fields/vector_operations.py
--- a/yt/fields/vector_operations.py
+++ b/yt/fields/vector_operations.py
@@ -44,7 +44,7 @@
             mag += data[fn] * data[fn]
         return np.sqrt(mag)
 
-    registry.add_field((ftype, "%s_magnitude" % basename),
+    registry.add_field((ftype, "%s_magnitude" % basename), sampling_type="cell", 
                        function=_magnitude, units=field_units,
                        validators=validators, particle_type=particle_type)
 
@@ -62,7 +62,7 @@
             squared += data[fn] * data[fn]
         return squared
 
-    registry.add_field((ftype, "%s_squared" % basename),
+    registry.add_field((ftype, "%s_squared" % basename), sampling_type="cell", 
                        function=_squared, units=field_units,
                        validators=validators, particle_type=particle_type)
 
@@ -110,7 +110,7 @@
         rv[np.isnan(theta)] = 0.0
         return rv
 
-    registry.add_field((ftype, "%s_spherical_radius" % basename),
+    registry.add_field((ftype, "%s_spherical_radius" % basename), sampling_type="cell", 
                        function=_spherical_radius_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -127,17 +127,17 @@
         return np.sqrt(data[ftype, "%s_magnitude" % basename]**2.0 -
                        data[ftype, "%s_spherical_radius" % basename]**2.0)
 
-    registry.add_field((ftype, "radial_%s" % basename),
+    registry.add_field((ftype, "radial_%s" % basename), sampling_type="cell", 
                        function=_radial,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
                                    ValidateParameter("center")])
 
-    registry.add_field((ftype, "radial_%s_absolute" % basename),
+    registry.add_field((ftype, "radial_%s_absolute" % basename), sampling_type="cell", 
                        function=_radial_absolute,
                        units=field_units)
 
-    registry.add_field((ftype, "tangential_%s" % basename),
+    registry.add_field((ftype, "tangential_%s" % basename), sampling_type="cell", 
                        function=_tangential,
                        units=field_units)
 
@@ -154,7 +154,7 @@
         phi = resize_vector(data["index", "spherical_phi"], vectors)
         return get_sph_theta_component(vectors, theta, phi, normal)
 
-    registry.add_field((ftype, "%s_spherical_theta" % basename),
+    registry.add_field((ftype, "%s_spherical_theta" % basename), sampling_type="cell", 
                        function=_spherical_theta_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -173,7 +173,7 @@
         phi = resize_vector(data["index", "spherical_phi"], vectors)
         return get_sph_phi_component(vectors, phi, normal)
 
-    registry.add_field((ftype, "%s_spherical_phi" % basename),
+    registry.add_field((ftype, "%s_spherical_phi" % basename), sampling_type="cell", 
                        function=_spherical_phi_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -192,13 +192,13 @@
             return tr
         return _cp_val
 
-    registry.add_field((ftype, "cutting_plane_%s_x" % basename),
+    registry.add_field((ftype, "cutting_plane_%s_x" % basename), sampling_type="cell", 
                        function=_cp_vectors('x'),
                        units=field_units)
-    registry.add_field((ftype, "cutting_plane_%s_y" % basename),
+    registry.add_field((ftype, "cutting_plane_%s_y" % basename), sampling_type="cell", 
                        function=_cp_vectors('y'),
                        units=field_units)
-    registry.add_field((ftype, "cutting_plane_%s_z" % basename),
+    registry.add_field((ftype, "cutting_plane_%s_z" % basename), sampling_type="cell", 
                        function=_cp_vectors('z'),
                        units=field_units)
 
@@ -223,12 +223,12 @@
     field_units = Unit(field_units, registry=registry.ds.unit_registry)
     div_units = field_units / registry.ds.unit_system["length"]
 
-    registry.add_field((ftype, "%s_divergence" % basename),
+    registry.add_field((ftype, "%s_divergence" % basename), sampling_type="cell", 
                        function=_divergence,
                        units=div_units,
                        validators=[ValidateSpatial(1)])
     
-    registry.add_field((ftype, "%s_divergence_absolute" % basename),
+    registry.add_field((ftype, "%s_divergence_absolute" % basename), sampling_type="cell", 
                        function=_divergence_abs,
                        units=div_units)
 
@@ -236,7 +236,7 @@
         tr = data[ftype, "tangential_%s" % basename] / \
              data[ftype, "%s_magnitude" % basename]
         return np.abs(tr)
-    registry.add_field((ftype, "tangential_over_%s_magnitude" % basename),
+    registry.add_field((ftype, "tangential_over_%s_magnitude" % basename), sampling_type="cell", 
              function=_tangential_over_magnitude,
              take_log=False)
 
@@ -252,7 +252,7 @@
         theta = resize_vector(data["index", 'cylindrical_theta'], vectors)
         return get_cyl_r_component(vectors, theta, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_radius" % basename),
+    registry.add_field((ftype, "%s_cylindrical_radius" % basename), sampling_type="cell", 
                        function=_cylindrical_radius_component,
                        units=field_units,
                        validators=[ValidateParameter("normal")])
@@ -261,7 +261,7 @@
         """This field is deprecated and will be removed in a future version"""
         return data[ftype, '%s_cylindrical_radius' % basename]
 
-    registry.add_field((ftype, "cylindrical_radial_%s" % basename),
+    registry.add_field((ftype, "cylindrical_radial_%s" % basename), sampling_type="cell", 
                        function=_cylindrical_radial,
                        units=field_units)
 
@@ -269,7 +269,7 @@
         """This field is deprecated and will be removed in a future version"""
         return np.abs(data[ftype, '%s_cylindrical_radius' % basename])
 
-    registry.add_field((ftype, "cylindrical_radial_%s_absolute" % basename),
+    registry.add_field((ftype, "cylindrical_radial_%s_absolute" % basename), sampling_type="cell", 
                        function=_cylindrical_radial_absolute,
                        units=field_units,
                        validators=[ValidateParameter("normal")])
@@ -287,7 +287,7 @@
         theta = np.tile(theta, (3,) + (1,)*len(theta.shape))
         return get_cyl_theta_component(vectors, theta, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_theta" % basename),
+    registry.add_field((ftype, "%s_cylindrical_theta" % basename), sampling_type="cell", 
                        function=_cylindrical_theta_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -302,11 +302,11 @@
         """This field is deprecated and will be removed in a future release"""
         return np.abs(data['cylindrical_tangential_%s' % basename])
 
-    registry.add_field((ftype, "cylindrical_tangential_%s" % basename),
+    registry.add_field((ftype, "cylindrical_tangential_%s" % basename), sampling_type="cell", 
                        function=_cylindrical_tangential,
                        units=field_units)
 
-    registry.add_field((ftype, "cylindrical_tangential_%s_absolute" % basename),
+    registry.add_field((ftype, "cylindrical_tangential_%s_absolute" % basename), sampling_type="cell", 
                        function=_cylindrical_tangential_absolute,
                        units=field_units)
 
@@ -320,7 +320,7 @@
         vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
         return get_cyl_z_component(vectors, normal)
 
-    registry.add_field((ftype, "%s_cylindrical_z" % basename),
+    registry.add_field((ftype, "%s_cylindrical_z" % basename), sampling_type="cell", 
                        function=_cylindrical_z_component,
                        units=field_units,
                        validators=[ValidateParameter("normal"),
@@ -356,7 +356,7 @@
         new_field2[1:-1, 1:-1, 1:-1] = new_field / weight_field
         return new_field2
 
-    registry.add_field((ftype, "averaged_%s" % basename),
+    registry.add_field((ftype, "averaged_%s" % basename), sampling_type="cell", 
                        function=_averaged_field,
                        units=field_units,
                        validators=validators)

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -65,7 +65,7 @@
             tr *= (data.ds.parameters['gamma'] - 1.)
             tr /= data.ds.parameters['aexpn']**2
             return tr * data['art', 'GasEnergy'] / data['art', 'Density']
-        self.add_field(('gas', 'temperature'),
+        self.add_field(('gas', 'temperature'), sampling_type="cell", 
                        function=_temperature, 
                        units=unit_system["temperature"])
 
@@ -75,7 +75,7 @@
                         data[('gas','density')])
             return velocity
         for ax in 'xyz':
-            self.add_field(('gas','velocity_%s' % ax),
+            self.add_field(('gas','velocity_%s' % ax), sampling_type="cell", 
                            function = _get_vel(ax),
                            units=unit_system["velocity"])
 
@@ -85,7 +85,7 @@
                   data['gas','momentum_z']**2)**0.5
             tr *= data['index','cell_volume'].in_units('cm**3')
             return tr
-        self.add_field(('gas', 'momentum_magnitude'),
+        self.add_field(('gas', 'momentum_magnitude'), sampling_type="cell", 
                        function=_momentum_magnitude,
                        units=unit_system["momentum"])
 
@@ -93,7 +93,7 @@
             tr = data['gas','momentum_magnitude']
             tr /= data['gas','cell_mass']
             return tr
-        self.add_field(('gas', 'velocity_magnitude'),
+        self.add_field(('gas', 'velocity_magnitude'), sampling_type="cell", 
                        function=_velocity_magnitude,
                        units=unit_system["velocity"])
 
@@ -101,7 +101,7 @@
             tr = data['gas','metal_ia_density']
             tr += data['gas','metal_ii_density']
             return tr
-        self.add_field(('gas','metal_density'),
+        self.add_field(('gas','metal_density'), sampling_type="cell", 
                        function=_metal_density,
                        units=unit_system["density"])
 
@@ -109,7 +109,7 @@
             tr = data['gas','metal_density']
             tr /= data['gas','density']
             return tr
-        self.add_field(('gas', 'metal_mass_fraction'),
+        self.add_field(('gas', 'metal_mass_fraction'), sampling_type="cell", 
                        function=_metal_mass_fraction,
                        units='')
 
@@ -117,7 +117,7 @@
             tr = (1. - data.ds.parameters['Y_p'] - 
                   data['gas', 'metal_mass_fraction'])
             return tr
-        self.add_field(('gas', 'H_mass_fraction'),
+        self.add_field(('gas', 'H_mass_fraction'), sampling_type="cell", 
                        function=_H_mass_fraction,
                        units='')
 
@@ -125,6 +125,6 @@
             tr = data['gas','metal_mass_fraction']
             tr /= data['gas','H_mass_fraction']
             return tr
-        self.add_field(('gas', 'metallicity'),
+        self.add_field(('gas', 'metallicity'), sampling_type="cell", 
                        function=_metallicity,
                        units='')

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/frontends/artio/fields.py
--- a/yt/frontends/artio/fields.py
+++ b/yt/frontends/artio/fields.py
@@ -59,8 +59,8 @@
         ("MASS", ("code_mass", ["particle_mass"], None)),
         ("PID", ("", ["particle_index"], None)),
         ("SPECIES", ("", ["particle_type"], None)),
-        ("BIRTH_TIME", ("", [], None)),  # code-units defined as dimensionless to 
-                                         # avoid incorrect conversion 
+        ("BIRTH_TIME", ("", [], None)),  # code-units defined as dimensionless to
+                                         # avoid incorrect conversion
         ("INITIAL_MASS", ("code_mass", ["initial_mass"], None)),
         ("METALLICITY_SNIa", ("", ["metallicity_snia"], None)),
         ("METALLICITY_SNII", ("", ["metallicity_snii"], None)),
@@ -73,7 +73,7 @@
                 return data["momentum_%s" % axis]/data["density"]
             return velocity
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax),
+            self.add_field(("gas", "velocity_%s" % ax), sampling_type="cell",
                            function = _get_vel(ax),
                            units = unit_system["velocity"])
 
@@ -97,10 +97,10 @@
         # TODO: The conversion factor here needs to be addressed, as previously
         # it was set as:
         # unit_T = unit_v**2.0*mb / constants.k
-        self.add_field(("gas", "temperature"), function = _temperature,
+        self.add_field(("gas", "temperature"), sampling_type="cell",  function = _temperature,
                        units = unit_system["temperature"])
 
-        # Create a metal_density field as sum of existing metal fields. 
+        # Create a metal_density field as sum of existing metal fields.
         flag1 = ("artio", "HVAR_METAL_DENSITY_Ia") in self.field_list
         flag2 = ("artio", "HVAR_METAL_DENSITY_II") in self.field_list
         if flag1 or flag2:
@@ -117,7 +117,7 @@
                 def _metal_density(field, data):
                     tr = data["metal_ii_density"]
                     return tr
-            self.add_field(("gas","metal_density"),
+            self.add_field(("gas","metal_density"), sampling_type="cell",
                            function=_metal_density,
                            units=unit_system["density"],
                            take_log=True)
@@ -125,7 +125,7 @@
     def setup_particle_fields(self, ptype):
         if ptype == "STAR":
             def _creation_time(field,data):
-                # this test is necessary to avoid passing invalid tcode values 
+                # this test is necessary to avoid passing invalid tcode values
                 # to the function tphys_from_tcode during field detection
                 # (1.0 is not a valid tcode value)
                 if isinstance(data, FieldDetector):
@@ -137,21 +137,18 @@
                     return data["STAR","creation_time"]
                 return data.ds.current_time - data["STAR","creation_time"]
 
-            self.add_field((ptype, "creation_time"), function=_creation_time, units="yr",
-                        particle_type=True)
-            self.add_field((ptype, "age"), function=_age, units="yr",
-                        particle_type=True)
+            self.add_field((ptype, "creation_time"), sampling_type="particle",  function=_creation_time, units="yr")
+            self.add_field((ptype, "age"), sampling_type="particle",  function=_age, units="yr")
 
             if self.ds.cosmological_simulation:
                 def _creation_redshift(field,data):
-                    # this test is necessary to avoid passing invalid tcode values 
+                    # this test is necessary to avoid passing invalid tcode values
                     # to the function auni_from_tcode during field detection
                     # (1.0 is not a valid tcode value)
                     if isinstance(data, FieldDetector):
                         return data["STAR","BIRTH_TIME"]
                     return 1.0/data.ds._handle.auni_from_tcode_array(data["STAR","BIRTH_TIME"]) - 1.0
 
-                self.add_field((ptype, "creation_redshift"), function=_creation_redshift,
-                        particle_type=True)
+                self.add_field((ptype, "creation_redshift"), sampling_type="particle",  function=_creation_redshift)
 
         super(ARTIOFieldInfo, self).setup_particle_fields(ptype)

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/frontends/athena/fields.py
--- a/yt/frontends/athena/fields.py
+++ b/yt/frontends/athena/fields.py
@@ -51,13 +51,13 @@
             vel_field = ("athena", "velocity_%s" % comp)
             mom_field = ("athena", "momentum_%s" % comp)
             if vel_field in self.field_list:
-                self.add_output_field(vel_field, units="code_length/code_time")
+                self.add_output_field(vel_field, sampling_type="cell",  units="code_length/code_time")
                 self.alias(("gas","velocity_%s" % comp), vel_field,
                            units=unit_system["velocity"])
             elif mom_field in self.field_list:
-                self.add_output_field(mom_field,
+                self.add_output_field(mom_field, sampling_type="cell",
                                       units="code_mass/code_time/code_length**2")
-                self.add_field(("gas","velocity_%s" % comp),
+                self.add_field(("gas","velocity_%s" % comp), sampling_type="cell",
                                function=velocity_field(comp), units = unit_system["velocity"])
         # Add pressure, energy, and temperature fields
         def ekin1(data):
@@ -85,36 +85,36 @@
                 etot += emag(data)
             return etot
         if ("athena","pressure") in self.field_list:
-            self.add_output_field(("athena","pressure"),
+            self.add_output_field(("athena","pressure"), sampling_type="cell",
                                   units=pres_units)
             self.alias(("gas","pressure"),("athena","pressure"),
                        units=unit_system["pressure"])
             def _thermal_energy(field, data):
                 return data["athena","pressure"] / \
                        (data.ds.gamma-1.)/data["athena","density"]
-            self.add_field(("gas","thermal_energy"),
+            self.add_field(("gas","thermal_energy"), sampling_type="cell",
                            function=_thermal_energy,
                            units=unit_system["specific_energy"])
             def _total_energy(field, data):
                 return etot_from_pres(data)/data["athena","density"]
-            self.add_field(("gas","total_energy"),
+            self.add_field(("gas","total_energy"), sampling_type="cell",
                            function=_total_energy,
                            units=unit_system["specific_energy"])
         elif ("athena","total_energy") in self.field_list:
-            self.add_output_field(("athena","total_energy"),
+            self.add_output_field(("athena","total_energy"), sampling_type="cell",
                                   units=pres_units)
             def _pressure(field, data):
                 return eint_from_etot(data)*(data.ds.gamma-1.0)
-            self.add_field(("gas","pressure"), function=_pressure,
+            self.add_field(("gas","pressure"), sampling_type="cell",  function=_pressure,
                            units=unit_system["pressure"])
             def _thermal_energy(field, data):
                 return eint_from_etot(data)/data["athena","density"]
-            self.add_field(("gas","thermal_energy"),
+            self.add_field(("gas","thermal_energy"), sampling_type="cell",
                            function=_thermal_energy,
                            units=unit_system["specific_energy"])
             def _total_energy(field, data):
                 return data["athena","total_energy"]/data["athena","density"]
-            self.add_field(("gas","total_energy"),
+            self.add_field(("gas","total_energy"), sampling_type="cell",
                            function=_total_energy,
                            units=unit_system["specific_energy"])
 
@@ -124,9 +124,7 @@
             else:
                 mu = 0.6
             return mu*mh*data["gas","pressure"]/data["gas","density"]/kboltz
-        self.add_field(("gas","temperature"), function=_temperature,
+        self.add_field(("gas","temperature"), sampling_type="cell",  function=_temperature,
                        units=unit_system["temperature"])
 
         setup_magnetic_field_aliases(self, "athena", ["cell_centered_B_%s" % ax for ax in "xyz"])
-
-

diff -r 5a08f4cc1af1a18889e0dc93cb3afa908f2d3d2f -r 9b5937af58578d073179329863c7e220f8ec7df6 yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -98,9 +98,8 @@
             return velocity
 
         for ax in 'xyz':
-            self.add_field((ptype, "particle_velocity_%s" % ax), 
+            self.add_field((ptype, "particle_velocity_%s" % ax), sampling_type="particle",
                            function=_get_vel(ax),
-                           particle_type=True,
                            units="code_length/code_time")
 
         super(BoxlibFieldInfo, self).setup_particle_fields(ptype)
@@ -112,14 +111,14 @@
             self.setup_momentum_to_velocity()
         elif any(f[1] == "xvel" for f in self.field_list):
             self.setup_velocity_to_momentum()
-        self.add_field(("gas", "thermal_energy"),
+        self.add_field(("gas", "thermal_energy"), sampling_type="cell",
                        function=_thermal_energy,
                        units=unit_system["specific_energy"])
-        self.add_field(("gas", "thermal_energy_density"),
+        self.add_field(("gas", "thermal_energy_density"), sampling_type="cell",
                        function=_thermal_energy_density,
                        units=unit_system["pressure"])
         if ("gas", "temperature") not in self.field_aliases:
-            self.add_field(("gas", "temperature"),
+            self.add_field(("gas", "temperature"), sampling_type="cell",
                            function=_temperature,
                            units=unit_system["temperature"])
 
@@ -129,7 +128,7 @@
                 return data["%smom" % axis]/data["density"]
             return velocity
         for ax in 'xyz':
-            self.add_field(("gas", "velocity_%s" % ax),
+            self.add_field(("gas", "velocity_%s" % ax), sampling_type="cell",
                            function=_get_vel(ax),
                            units=self.ds.unit_system["velocity"])
 
@@ -139,7 +138,7 @@
                 return data["%svel" % axis]*data["density"]
             return momentum
         for ax in 'xyz':
-            self.add_field(("gas", "momentum_%s" % ax),
+            self.add_field(("gas", "momentum_%s" % ax), sampling_type="cell",
                            function=_get_mom(ax),
                            units=mom_units)
 
@@ -203,6 +202,7 @@
                            units="")
                 func = _create_density_func(("gas", "%s_fraction" % nice_name))
                 self.add_field(name=("gas", "%s_density" % nice_name),
+                               sampling_type="cell",
                                function = func,
                                units = self.ds.unit_system["density"])
                 # We know this will either have one letter, or two.
@@ -287,7 +287,7 @@
                 # We have a mass fraction
                 nice_name, tex_label = _nice_species_name(field)
                 # Overwrite field to use nicer tex_label display_name
-                self.add_output_field(("boxlib", field),
+                self.add_output_field(("boxlib", field), sampling_type="cell",
                                       units="",
                                       display_name=tex_label)
                 self.alias(("gas", "%s_fraction" % nice_name),
@@ -295,6 +295,7 @@
                            units="")
                 func = _create_density_func(("gas", "%s_fraction" % nice_name))
                 self.add_field(name=("gas", "%s_density" % nice_name),
+                               sampling_type="cell",
                                function=func,
                                units=unit_system["density"],
                                display_name=r'\rho %s' % tex_label)
@@ -317,7 +318,7 @@
                 nice_name, tex_label = _nice_species_name(field)
                 display_name = r'\dot{\omega}\left[%s\right]' % tex_label
                 # Overwrite field to use nicer tex_label'ed display_name
-                self.add_output_field(("boxlib", field), units=unit_system["frequency"],
+                self.add_output_field(("boxlib", field), sampling_type="cell",  units=unit_system["frequency"],
                                       display_name=display_name)
                 self.alias(("gas", "%s_creation_rate" % nice_name),
                            ("boxlib", field), units=unit_system["frequency"])

This diff is so big that we needed to truncate the remainder.

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list