コード例 #1
0
ファイル: copy_DA.py プロジェクト: bdb112/pyfusion
var='phases'  # ?? maybe was used to develop 
"""
exec(_var_defaults)
exec(process_cmd_line_args())

filters = tb.Filters(complevel=complevel, complib=complib)

dd = DA(DAfilename).da

if outfilename is None:
    (base, ext) = os.path.splitext(os.path.realpath(DAfilename))
    outfilename = base + os.path.extsep + 'h5'

outf = tb.openFile(outfilename, "a")

for var in dd.keys():

    st_copy = seconds()
    if var in [nd.name for nd in outf.listNodes('/')]:
        raise LookupError('{f} already has a node "{n}"'.format(
            f=outf.filename, n=var))
    val = dd[
        var]  # need to hold it in memory this way to avoid multiple access
    sizebytes = val.nbytes
    print('{dt:.1f}s to read {v} {GB:.2f} GB for {f}'.format(
        dt=seconds() - st_copy,
        GB=sizebytes / 1e9,
        f=os.path.split(outfilename)[-1],
        v=var))

    st_write = seconds()
コード例 #2
0
ファイル: copy_DA.py プロジェクト: bdb112/pyfusion
var='phases'  # ?? maybe was used to develop 
"""
exec(_var_defaults)
exec(process_cmd_line_args())

filters=tb.Filters(complevel=complevel, complib=complib)

dd = DA(DAfilename).da

if outfilename is None:
    (base, ext) = os.path.splitext(os.path.realpath(DAfilename))
    outfilename = base + os.path.extsep + 'h5'

outf = tb.openFile(outfilename, "a")

for var in dd.keys():

    st_copy = seconds()
    if var in [nd.name for nd in outf.listNodes('/')]:
        raise LookupError('{f} already has a node "{n}"'
                          .format(f=outf.filename, n=var))
    val = dd[var]  # need to hold it in memory this way to avoid multiple access
    sizebytes = val.nbytes
    print('{dt:.1f}s to read {v} {GB:.2f} GB for {f}'
          .format(dt=seconds()-st_copy, 
                  GB = sizebytes/1e9, f=os.path.split(outfilename)[-1], v=var))

    st_write = seconds()

    try:
        var_atom = tb.atom.Atom.from_dtype(numpy.dtype(val.dtype))