[Yt-svn] yt-commit r1094 - in trunk/yt: extensions lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Thu Jan 8 10:53:24 PST 2009
Author: mturk
Date: Thu Jan 8 10:53:24 2009
New Revision: 1094
URL: http://yt.spacepope.org/changeset/1094
Log:
Added always-copy option to amira exporter and changed a check-for-None
explicitly in the hierarchy reconstruction step
Modified:
trunk/yt/extensions/HierarchySubset.py
trunk/yt/lagos/HierarchyType.py
Modified: trunk/yt/extensions/HierarchySubset.py
==============================================================================
--- trunk/yt/extensions/HierarchySubset.py (original)
+++ trunk/yt/extensions/HierarchySubset.py Thu Jan 8 10:53:24 2009
@@ -58,8 +58,10 @@
class ExtractedHierarchy(object):
- def __init__(self, pf, min_level, max_level = -1, offset = None):
+ def __init__(self, pf, min_level, max_level = -1, offset = None,
+ always_copy=False):
self.pf = pf
+ self.always_copy = always_copy
self.min_level = min_level
self.int_offset = na.min([grid.get_global_startindex() for grid in
pf.h.select_grids(min_level)], axis=0).astype('float64')
@@ -114,7 +116,8 @@
grid_node._v_attrs.ghostzoneFlags = na.zeros(6, dtype='int32')
grid_node._v_attrs.numGhostzones = na.zeros(3, dtype='int32')
grid_node._v_attrs.dims = grid.ActiveDimensions[::-1].astype('int32')
- if self.pf.h.data_style == 6 and field in self.pf.h.field_list:
+ if not self.always_copy and self.pf.h.data_style == 6 \
+ and field in self.pf.h.field_list:
if grid.hierarchy.data_style == -1: # constructed grid
# if we can get conversion in amira we won't need to do this
ff = grid[field]
@@ -144,6 +147,9 @@
parser.add_option("-o", "--output", action="store", type="string",
dest="output", default="movie.a5",
help="Name of our output file")
+ parser.add_option("", "--always-copy", action="store_true",
+ dest="always_copy", default=False,
+ help="Should we always copy the data to the new file")
parser.add_option("", "--minlevel", action="store", type="int",
dest="min_level", default=0,
help="The minimum level to extract (chooses first grid at that level)")
@@ -189,7 +195,8 @@
pf = __get_pf(opts.basename, n)
hh = pf.h
times.append(pf["InitialTime"] * pf["years"])
- eh = ExtractedHierarchy(pf, opts.min_level, max_level = opts.max_level, offset=offset)
+ eh = ExtractedHierarchy(pf, opts.min_level, max_level = opts.max_level,
+ offset=offset, always_copy=opts.always_copy)
eh.export_output(afile, n, opts.field)
t2.append(pf["InitialTime"])
Modified: trunk/yt/lagos/HierarchyType.py
==============================================================================
--- trunk/yt/lagos/HierarchyType.py (original)
+++ trunk/yt/lagos/HierarchyType.py Thu Jan 8 10:53:24 2009
@@ -902,7 +902,7 @@
len(grids_to_recon))
for i,grid in enumerate(grids_to_recon):
if pbar: pbar.update(i)
- if grid.Parent: grid._guess_properties_from_parent()
+ if grid.Parent is not None: grid._guess_properties_from_parent()
if pbar: pbar.finish()
def _join_field_lists(self, field_list):
More information about the yt-svn
mailing list