[Yt-svn] commit/yt: jwise77: Making the file_style argument in EnzoStaticOutput functional. For

Bitbucket commits-noreply at bitbucket.org
Tue Jun 14 10:29:30 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/c673e10a82c5/
changeset:   c673e10a82c5
branch:      yt
user:        jwise77
date:        2011-06-14 19:29:17
summary:     Making the file_style argument in EnzoStaticOutput functional.  For
example, if your data files are named redshift0000.grid.cpu0000, you
would call

EnzoStaticOutput("redshift0000", file_style="%s.grid.cpu%%04i")
affected #:  2 files (179 bytes)

--- a/yt/data_objects/static_output.py	Tue Jun 14 12:37:21 2011 -0400
+++ b/yt/data_objects/static_output.py	Tue Jun 14 13:29:17 2011 -0400
@@ -62,12 +62,13 @@
             _cached_pfs[apath] = obj
         return _cached_pfs[apath]
 
-    def __init__(self, filename, data_style=None):
+    def __init__(self, filename, data_style=None, file_style=None):
         """
         Base class for generating new output types.  Principally consists of
         a *filename* and a *data_style* which will be passed on to children.
         """
         self.data_style = data_style
+        self.file_style = file_style
         self.parameter_filename = str(filename)
         self.basename = os.path.basename(filename)
         self.directory = os.path.expanduser(os.path.dirname(filename))


--- a/yt/frontends/enzo/data_structures.py	Tue Jun 14 12:37:21 2011 -0400
+++ b/yt/frontends/enzo/data_structures.py	Tue Jun 14 13:29:17 2011 -0400
@@ -132,10 +132,13 @@
     _strip_path = False
     grid = EnzoGrid
 
-    def __init__(self, pf, data_style, file_style="%s.cpu%%04i"):
+    def __init__(self, pf, data_style):
         
         self.data_style = data_style
-        self._bn = file_style
+        if pf.file_style != None:
+            self._bn = pf.file_style
+        else:
+            self._bn = "%s.cpu%%04i"
         self.hierarchy_filename = os.path.abspath(
             "%s.hierarchy" % (pf.parameter_filename))
         harray_fn = self.hierarchy_filename[:-9] + "harrays"
@@ -634,6 +637,7 @@
     _hierarchy_class = EnzoHierarchy
     _fieldinfo_class = EnzoFieldContainer
     def __init__(self, filename, data_style=None,
+                 file_style = None,
                  parameter_override = None,
                  conversion_override = None,
                  storage_filename = None):
@@ -653,7 +657,7 @@
         self._conversion_override = conversion_override
         self.storage_filename = storage_filename
 
-        StaticOutput.__init__(self, filename, data_style)
+        StaticOutput.__init__(self, filename, data_style, file_style=file_style)
         if "InitialTime" not in self.parameters:
             self.current_time = 0.0
         rp = os.path.join(self.directory, "rates.out")

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