[Yt-svn] yt-commit r596 - in branches/yt-generalization: tests yt/lagos
joishi at wrangler.dreamhost.com
joishi at wrangler.dreamhost.com
Sat Jun 21 14:33:18 PDT 2008
Author: joishi
Date: Sat Jun 21 14:33:16 2008
New Revision: 596
URL: http://yt.spacepope.org/changeset/596
Log:
* getting closer...
* also, fixed the test_orion.py to find the right file
Modified:
branches/yt-generalization/tests/test_orion.py
branches/yt-generalization/yt/lagos/BaseGridType.py
branches/yt-generalization/yt/lagos/HierarchyType.py
branches/yt-generalization/yt/lagos/OutputTypes.py
branches/yt-generalization/yt/lagos/__init__.py
Modified: branches/yt-generalization/tests/test_orion.py
==============================================================================
--- branches/yt-generalization/tests/test_orion.py (original)
+++ branches/yt-generalization/tests/test_orion.py Sat Jun 21 14:33:16 2008
@@ -20,7 +20,7 @@
# The dataset used is located at:
# http://yt.spacepope.org/DD0018.zip
-fn = "uniformCollapse_base64_maxLev4"
+fn = "uniformCollapse_base64_maxLev4/plt0005"
fn = os.path.join(os.path.dirname(__file__), fn)
print "I AM GOING TO GET",fn
Modified: branches/yt-generalization/yt/lagos/BaseGridType.py
==============================================================================
--- branches/yt-generalization/yt/lagos/BaseGridType.py (original)
+++ branches/yt-generalization/yt/lagos/BaseGridType.py Sat Jun 21 14:33:16 2008
@@ -410,3 +410,10 @@
else:
self.filename = os.path.join(self.hierarchy.directory, filename)
return
+
+class OrionGridBase(AMRGridPatch):
+ def __init__(self,LeftEdge,RightEdge,index):
+ # should error check this
+ self.LeftEdge = LeftEdge
+ self.RightEdge = RightEdge
+ self.index = index
Modified: branches/yt-generalization/yt/lagos/HierarchyType.py
==============================================================================
--- branches/yt-generalization/yt/lagos/HierarchyType.py (original)
+++ branches/yt-generalization/yt/lagos/HierarchyType.py Sat Jun 21 14:33:16 2008
@@ -33,7 +33,7 @@
{ 4: (readDataHDF4, readAllDataHDF4, getFieldsHDF4, readDataSliceHDF4, getExceptionHDF4), \
5: (readDataHDF5, readAllDataHDF5, getFieldsHDF5, readDataSliceHDF5, getExceptionHDF5), \
6: (readDataPacked, readAllDataPacked, getFieldsPacked, readDataSlicePacked, getExceptionHDF5), \
- 7: (readDataNative, readAllDataNative, readDataSliceNative) \
+ 7: (readDataNative, readAllDataNative, None, readDataSliceNative, getExceptionHDF5) \
}
class AMRHierarchy:
@@ -798,9 +798,11 @@
return re.compile(rs,re.M)
class OrionHierarchy(AMRHierarchy):
- def __init__(self,filename):
- self.readGlobalHeader(filename)
-
+ def __init__(self,pf,data_style=7):
+ header_filename = os.path.join(pf.fullplotdir,'Header')
+ self.data_style = data_style
+ self.readGlobalHeader(header_filename)
+ AMRHierarchy.__init__(self,pf)
def readGlobalHeader(self,filename):
"""
read the global header file for an Orion plotfile output.
@@ -880,10 +882,24 @@
counter+=1
lo = na.array([xlo,ylo,zlo])
hi = na.array([xhi,yhi,zhi])
- self.levels[-1].grids.append(OrionGrid(lo,hi,grid_counter))
+ self.levels[-1].grids.append(OrionGridBase(lo,hi,grid_counter))
grid_counter += 1 # this is global, and shouldn't be reset
# for each level
self.levels[-1]._fileprefix = self.__global_header_lines[counter]
counter+=1
self.__header_file.close()
+
+ def _setup_classes(self):
+ dd = self._get_data_reader_dict()
+ self.grid = classobj("OrionGrid",(OrionGridBase,), dd)
+ AMRHierarchy._setup_classes(self, dd)
+
+
+class OrionLevel:
+ def __init__(self,level,ngrids):
+ self.level = level
+ self.ngrids = ngrids
+ self.grids = []
+
+
Modified: branches/yt-generalization/yt/lagos/OutputTypes.py
==============================================================================
--- branches/yt-generalization/yt/lagos/OutputTypes.py (original)
+++ branches/yt-generalization/yt/lagos/OutputTypes.py Sat Jun 21 14:33:16 2008
@@ -282,7 +282,7 @@
"""
_hierarchy_class = OrionHierarchy
- def __init__(self, plotname, paramFilename='inputs',data_style='Native'):
+ def __init__(self, plotname, paramFilename='inputs',data_style=7):
"""need to override for Orion file structure.
the paramfile is usually called "inputs"
@@ -297,8 +297,9 @@
self.basename = os.path.basename(plotname)
# this will be the directory ENCLOSING the pltNNNN directory
self.directory = os.path.dirname(plotname)
- self.parameter_filename = self.directory+paramFilename
+ self.parameter_filename = os.path.join(self.directory,paramFilename)
self.fullpath = os.path.abspath(self.directory)
+ self.fullplotdir = os.path.abspath(plotname)
if len(self.directory) == 0:
self.directory = "."
self.conversion_factors = {}
@@ -367,13 +368,7 @@
self.time_units = {}
if len(self.parameters) == 0:
self._parse_parameter_file()
- if self["ComovingCoordinates"]:
- raise RuntimeError("Orion doesn't do cosmology.")
- elif self.has_key("LengthUnits"):
- raise RuntimeError("Units not yet implemented.")
- #self._setup_getunits_units()
- else:
- self._setup_nounits_units()
+ self._setup_nounits_units()
self.time_units['1'] = 1
self.units['1'] = 1
seconds = self["Time"]
Modified: branches/yt-generalization/yt/lagos/__init__.py
==============================================================================
--- branches/yt-generalization/yt/lagos/__init__.py (original)
+++ branches/yt-generalization/yt/lagos/__init__.py Sat Jun 21 14:33:16 2008
@@ -66,6 +66,7 @@
import PointCombine
import HDF5LightReader
from EnzoDefs import *
+from OrionDefs import *
from DerivedFields import *
from DerivedQuantities import DerivedQuantityCollection, GridChildMaskWrapper
from DataReadingFuncs import *
More information about the yt-svn
mailing list