Matthew Turk avatar Matthew Turk committed e5cfe68

Adding upload script

Comments (0)

Files changed (1)

+from yt.mods import *
+from yt.utilities.minimal_representation import \
+    MinimalStaticOutput, MinimalProjectionData
+import h5py
+from md5 import md5
+import time
+import os
+
+pf = load("/scratch/bwoshea/testrun_nest_inline/RD0000/RD0000")
+
+class PFMock(object):
+    def __init__(self, base, f):
+        md, (a, c) = base._mrep._generate_post()
+        for i,v in md.items(): setattr(self, i, v)
+        self.cycle = f.filename.split("_")[1]
+        # Now we override
+        attrs = f["/attributes"].attrs
+        self.name = attrs["pf_name"]
+        self.current_redshift = attrs["redshift"]
+        self.unique_identifier = md5(self._hash).hexdigest()
+        self.current_time = attrs["time_seconds"]
+
+    def _hash(self):
+        s = "%s_%s" % (self.cycle, self.current_time)
+        return md5(s).hexdigest()
+
+class ProjMock(object):
+    def __init__(self, pf, f, axis, field, weight_field):
+        self.field_data = {}
+        self.axis = axis
+        self.field = field
+        self.weight_field = str(weight_field)
+        self.output_hash = pf._hash()
+        for fn in ['px', 'py', 'pdx', 'pdy', field]:
+            self.field_data[fn] = f["/axis_%02i/%s" % (axis, fn)][:]
+
+f = h5py.File("j_00010234_weighted.h5", "r")
+pfm = PFMock(pf, f)
+mso = MinimalStaticOutput(pfm)
+mso.name = pfm.name
+mso.upload()
+
+pm = ProjMock(pf, f, 0, "Density", "Density")
+mpj = MinimalProjectionData(pm)
+mpj.upload()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.