Dear all,
I am encountering some issues when running the script enclosed:
######################################################################################################
loading DM_part/DD0001/CommonEnvelope0001
yt INFO 2010-06-03 17:36:57,270 Storing the binary hierarchy
yt INFO 2010-06-03 17:36:57,523 Gathering a field list
(this may take a moment.)
Traceback (most recent call last):
File "script2body.py", line 39, in <module>
region = data.h.region([0.5, 0.5, 0.5], [0.0, 0.0, 0.0], [1.0, 1.0,
1.0])
File
"/rpod2/jcpassy/yt-x86_64/src/yt-trunk-svn/yt/lagos/OutputTypes.py",
line 150, in _get_hierarchy
self.__hierarchy = self._hierarchy_class(self,
data_style=self.data_style)
File
"/rpod2/jcpassy/yt-x86_64/src/yt-trunk-svn/yt/lagos/HierarchyType.py",
line 374, in __init__
AMRHierarchy.__init__(self, pf, data_style)
File
"/rpod2/jcpassy/yt-x86_64/src/yt-trunk-svn/yt/lagos/HierarchyType.py",
line 64, in __init__
self._detect_fields()
File
"/rpod2/jcpassy/yt-x86_64/src/yt-trunk-svn/yt/lagos/HierarchyType.py",
line 615, in _detect_fields
self.save_data(list(field_list),"/","DataFields",passthrough=True)
File
"/rpod2/jcpassy/yt-x86_64/src/yt-trunk-svn/yt/lagos/HierarchyType.py",
line 192, in _save_data
arr = myGroup.create_dataset(name,data=array)
File
"/rpod2/jcpassy/yt-x86_64/lib/python2.6/site-packages/h5py-1.2.0-py2.6-linux-x86_64.egg/h5py/highlevel.py",
line 353, in create_dataset
return Dataset(self, name, *args, **kwds)
File
"/rpod2/jcpassy/yt-x86_64/lib/python2.6/site-packages/h5py-1.2.0-py2.6-linux-x86_64.egg/h5py/highlevel.py",
line 856, in __init__
space_id = h5s.create_simple(shape, maxshape)
File
"/rpod2/jcpassy/yt-x86_64/lib/python2.6/site-packages/h5py-1.2.0-py2.6-linux-x86_64.egg/h5py/_sync.py",
line 88, in wrap
return func(*args, **kwds)
File "h5s.pyx", line 106, in h5py.h5s.create_simple (h5py/h5s.c:973)
h5py._stub.ValueError: Zero sized dimension for non-unlimited dimension
(Function arguments: Bad value)
######################################################################################################
The weird thing is that if I run the script again, it works and then
breaks when trying to read the next file
(DM_part/DD0001/CommonEnvelope0001), and so on... Data contain only 2
particles without gas and as far as I remember, I could execute those
commands without problems before.
I would appreciate if someone could help me with that.
Thanks a lot,
Jean-Claude
#!/rpod2/jcpassy/yt-x86_64/bin python2.6
import sys
import commands as C
import numpy as N
import pylab as P
import yt.raven as R
import yt.lagos as L
filebase = sys.argv[-1]
minSnap = 0
maxSnap = 401
skip = 1
t = N.zeros(maxSnap/skip)
X = N.zeros((maxSnap/skip,3,2))
V = N.zeros((maxSnap/skip,3,2))
r = N.zeros(maxSnap/skip)
X2 = N.zeros((maxSnap/skip,3,2))
V2 = N.zeros((maxSnap/skip,3,2))
r2 = N.zeros(maxSnap/skip)
j = 0
for i in range(minSnap,maxSnap,skip):
# File 1
filen = 'DM_part/'+ 'DD' + '%04i' % i + '/' + filebase + '%04i' % i
print "loading %s" % filen
data = L.EnzoStaticOutput(filen,data_style="enzo_packed_3d") # if no gas
t[j] = data["InitialTime"] * data["years"]
region = data.h.region([0.5, 0.5, 0.5], [0.0, 0.0, 0.0], [1.0, 1.0, 1.0])
i1,i2 = region['particle_index']
X[j,0,i1],X[j,0,i2] = region['particle_position_x']
X[j,1,i1],X[j,1,i2] = region['particle_position_y']
X[j,2,i1],X[j,2,i2] = region['particle_position_z']
V[j,0,i1],V[j,0,i2] = region['particle_velocity_x']
V[j,1,i1],V[j,1,i2] = region['particle_velocity_y']
V[j,2,i1],V[j,2,i2] = region['particle_velocity_z']
r[j] = pow((X[j,0,i1] - X[j,0,i2]),2) + pow((X[j,1,i1] - X[j,1,i2]),2) + pow((X[j,2,i1] - X[j,2,i2]),2)
r[j] = pow(r[j],0.5)
j = j + 1