[Yt-svn] yt-commit r825 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Sun Oct 12 12:05:06 PDT 2008
Author: mturk
Date: Sun Oct 12 12:05:06 2008
New Revision: 825
URL: http://yt.spacepope.org/changeset/825
Log:
Now serialize weight_field, and throw a warning to the user if it looks like
weight_field was not in the .yt file.
Modified:
trunk/yt/lagos/BaseDataTypes.py
Modified: trunk/yt/lagos/BaseDataTypes.py
==============================================================================
--- trunk/yt/lagos/BaseDataTypes.py (original)
+++ trunk/yt/lagos/BaseDataTypes.py Sun Oct 12 12:05:06 2008
@@ -556,7 +556,13 @@
if array == None:
mylog.debug("Didn't find it!")
return
- for i, f in enumerate(self._key_fields + [self.fields[0]]):
+ kf = self._key_fields[:]
+ if array.shape[0] != len(kf) + 1:
+ mylog.warning("There has been a change in the .yt file format.")
+ mylog.warning("It is recommended to remove %s",
+ self.hierarchy._data_file.filename)
+ kf = kf[:-1] # Fix for weight_field add
+ for i, f in enumerate(kf + [self.fields[0]]):
self[f] = array[i,:]
return True
@@ -817,6 +823,7 @@
class EnzoProjBase(Enzo2DData, ParallelAnalysisInterface):
_top_node = "/Projections"
+ _key_fields = Enzo2DData._key_fields + ['weight_field']
def __init__(self, axis, field, weight_field = None,
max_level = None, center = None, pf = None,
source=None, node_name = None, **kwargs):
@@ -1055,7 +1062,6 @@
field_data = data.pop('fields')
for fi, field in enumerate(fields):
self[field] = field_data[fi,:]
- self['weight_field'] = data.pop('weight_field')
for i in data.keys(): self[i] = data.pop(i)
def add_fields(self, fields, weight = "CellMassMsun"):
More information about the yt-svn
mailing list