29 lines
844 B
Python
29 lines
844 B
Python
# coding: utf-8
|
|
|
|
import argparse
|
|
import os
|
|
from snapshotprocessor import SnapshotProcessor
|
|
|
|
|
|
def convert_to_hdf5(path, snap_num, path_out=".", filename=None, **kwargs):
|
|
snap = SnapshotProcessor(path=path, num=snap_num, path_out=path_out, **kwargs)
|
|
snap.convert_hdf5(filename)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(
|
|
description="Convert Ramses output into a list of cells"
|
|
)
|
|
parser.add_argument(
|
|
"snapshots", help="path to the snapshots", nargs="+", default=[]
|
|
)
|
|
parser.add_argument("-o", "--out", help="path to the output", default=".")
|
|
|
|
args = parser.parse_args()
|
|
|
|
for snap in args.snapshots:
|
|
path = os.path.dirname(snap)
|
|
numstem = os.path.basename(snap)
|
|
snap_num = int(numstem.split("_")[1])
|
|
convert_to_hdf5(path, snap_num, args.out)
|