Commits

Sam Skillman  committed 940c7f1

Implementing data storage for athena datasets, and fixing a bug from h5py not
liking to save a string:

https://github.com/h5py/h5py/issues/63

  • Participants
  • Parent commits 4c9a9cd

Comments (0)

Files changed (2)

File yt/data_objects/hierarchy.py

         under the name *name* on the node /Objects.
         """
         s = cPickle.dumps(obj, protocol=-1)
-        self.save_data(s, "/Objects", name, force = True)
+        self.save_data(np.array(s), "/Objects", name, force = True)
 
     def load_object(self, name):
         """

File yt/frontends/athena/data_structures.py

 class AthenaGrid(AMRGridPatch):
     _id_offset = 0
     def __init__(self, id, hierarchy, level, start, dimensions):
-        df = hierarchy.storage_filename
+        df = hierarchy.parameter_file.filename[4:-4]
         if 'id0' not in hierarchy.parameter_file.filename:
             gname = hierarchy.parameter_file.filename
         else:
 
     grid = AthenaGrid
     _data_style='athena'
+    _data_file = None
     
     def __init__(self, pf, data_style='athena'):
         self.parameter_file = weakref.proxy(pf)
+        self.directory = os.path.dirname(self.parameter_file.filename)
         self.data_style = data_style
         # for now, the hierarchy file is the parameter file!
-        self.storage_filename = self.parameter_file.storage_filename
         self.hierarchy_filename = self.parameter_file.filename
         #self.directory = os.path.dirname(self.hierarchy_filename)
         self._fhandle = file(self.hierarchy_filename,'rb')
 
         self._fhandle.close()
 
-    def _initialize_data_storage(self):
-        pass
-
     def _detect_fields(self):
         field_map = {}
         f = open(self.hierarchy_filename,'rb')
     _data_style = "athena"
 
     def __init__(self, filename, data_style='athena',
-                 storage_filename = None, parameters = {}):
+                 storage_filename=None, parameters={}):
         self.specified_parameters = parameters
         StaticOutput.__init__(self, filename, data_style)
         self.filename = filename
-        self.storage_filename = filename[4:-4]
+        self.storage_filename = storage_filename 
         
         # Unfortunately we now have to mandate that the hierarchy gets 
         # instantiated so that we can make sure we have the correct left