[yt-svn] commit/yt-3.0: MatthewTurk: This adds a second derived field check after particle types have been created.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Oct 25 10:24:35 PDT 2013
1 new commit in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/commits/d9d68aac9f0c/
Changeset: d9d68aac9f0c
Branch: yt-3.0
User: MatthewTurk
Date: 2013-10-25 18:46:25
Summary: This adds a second derived field check after particle types have been created.
What this addresses is when a baryon field and a particle field are combined.
Currently the ordering of field construction makes one available and the other
not available. See #601 for more details.
I would prefer to see the solution be to re-generate dependencies as needed,
but we are not yet able to do that.
Affected #: 4 files
diff -r d927877e40391cb0f50d581a3e74f941482c333f -r d9d68aac9f0c49a052b6d8285ae4b4cebe37c882 yt/fields/universal_fields.py
--- a/yt/fields/universal_fields.py
+++ b/yt/fields/universal_fields.py
@@ -375,7 +375,7 @@
convert_function=_convertCellMassCode)
def _TotalMass(field,data):
- return (data["gas","Density"]+data[("deposit", "particle_density")]) * \
+ return (data["gas","Density"]+data[("deposit", "all_density")]) * \
data["CellVolume"]
add_field("TotalMass", function=_TotalMass, units=r"\rm{g}")
add_field("TotalMassMsun", units=r"M_{\odot}",
diff -r d927877e40391cb0f50d581a3e74f941482c333f -r d9d68aac9f0c49a052b6d8285ae4b4cebe37c882 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -150,7 +150,6 @@
if fid: fid.close()
return rv
-
class IOHandlerPackedHDF5GhostZones(IOHandlerPackedHDF5):
_data_style = "enzo_packed_3d_gz"
diff -r d927877e40391cb0f50d581a3e74f941482c333f -r d9d68aac9f0c49a052b6d8285ae4b4cebe37c882 yt/geometry/geometry_handler.py
--- a/yt/geometry/geometry_handler.py
+++ b/yt/geometry/geometry_handler.py
@@ -83,6 +83,9 @@
mylog.debug("Setting up particle fields")
self._setup_particle_types()
+ mylog.debug("Checking derived fields again")
+ self._derived_fields_add(self._check_later)
+
def __del__(self):
if self._data_file is not None:
self._data_file.close()
@@ -110,6 +113,7 @@
self._data_mode = None
self._max_locations = {}
self.num_grids = None
+ self._check_later = []
def _setup_classes(self, dd):
# Called by subclass
@@ -273,10 +277,12 @@
if fields_to_check is None:
fields_to_check = []
fi = self.parameter_file.field_info
+ self._check_later = []
for field in fields_to_check:
try:
fd = fi[field].get_dependencies(pf = self.parameter_file)
except Exception as e:
+ self._check_later.append(field)
if type(e) != YTFieldNotFound:
mylog.debug("Raises %s during field %s detection.",
str(type(e)), field)
diff -r d927877e40391cb0f50d581a3e74f941482c333f -r d9d68aac9f0c49a052b6d8285ae4b4cebe37c882 yt/utilities/io_handler.py
--- a/yt/utilities/io_handler.py
+++ b/yt/utilities/io_handler.py
@@ -114,7 +114,7 @@
return None
def _read_chunk_data(self, chunk, fields):
- return None
+ return {}
def _read_particle_selection(self, chunks, selector, fields):
rv = {}
Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/
--
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