apps130311_water.mapinmedata
ΒΆ
Map all the orbit data to the surface.
Map all (cena mass mode data availble) the orbit data to the surface.
''' Map all the orbit data to the surface.
Map all (cena mass mode data availble) the orbit data to the surface.
'''
import os
import gzip
import pickle
import irfpy.util.datafile
def masterinfo_reader(pathname):
if os.path.isdir(pathname):
pathname = os.path.join(pathname, 'masterinfo.dat')
datf = irfpy.util.datafile.Datafile(open(pathname))
datr = irfpy.util.datafile.DatafileReader(datf)
return datr
def orbitdata_reader(pathname):
fp = gzip.open(pathname)
m = pickle.load(fp) # SimpleGridSphere instance.
return m
def loadall(dirname):
''' Try to load all the file, but it consumes too much memory and too slow.
'''
fn = os.listdir(dirname)
fulldata = None
for f in fn:
if f.startswith('orbit') and f.endswith('_sv2cnt.txt.gz'):
ff = os.path.join(dirname, f)
print(ff)
m = orbitdata_reader(ff)
if fulldata == None:
fulldata = m
else:
fulldata = fulldata + m
fp = gzip.open(dirname + '_full.out.gz', 'w')
pickle.dump(fulldata, fp)
fp.close()
return fulldata