[yt-svn] commit/yt: 5 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Mar 13 11:59:56 PDT 2017


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/061a1658db9a/
Changeset:   061a1658db9a
Branch:      yt
User:        brittonsmith
Date:        2017-03-08 19:44:20+00:00
Summary:     Add cut_regions to the list of exempt data containers in the ytdata frontend.
Affected #:  1 file

diff -r 3eca2ae80ab14a48b643d3055d7d3c0933fa77ae -r 061a1658db9a645831e5e14609ed5c14a0a1537a yt/frontends/ytdata/data_structures.py
--- a/yt/frontends/ytdata/data_structures.py
+++ b/yt/frontends/ytdata/data_structures.py
@@ -275,7 +275,7 @@
             # since this is now particle-like data.
             data_type = self.parameters.get("data_type")
             container_type = self.parameters.get("container_type")
-            ex_container_type = ["cutting", "proj", "ray", "slice"]
+            ex_container_type = ["cutting", "proj", "ray", "slice", "cut_region"]
             if data_type == "yt_light_ray" or container_type in ex_container_type:
                 mylog.info("Returning an all_data data container.")
                 return self.all_data()


https://bitbucket.org/yt_analysis/yt/commits/9c01cabea0f9/
Changeset:   9c01cabea0f9
Branch:      yt
User:        brittonsmith
Date:        2017-03-08 19:44:51+00:00
Summary:     Save a string representation of an attribute if no HDF5 equivalent exists.
Affected #:  1 file

diff -r 061a1658db9a645831e5e14609ed5c14a0a1537a -r 9c01cabea0f978d280104cc971c54f7443e7ce49 yt/frontends/ytdata/utilities.py
--- a/yt/frontends/ytdata/utilities.py
+++ b/yt/frontends/ytdata/utilities.py
@@ -239,4 +239,9 @@
         val = np.array(val)
         if val.dtype.kind == 'U':
             val = val.astype('|S')
-    fh.attrs[str(attr)] = val
+    try:
+        fh.attrs[str(attr)] = val
+    # This is raised if no HDF5 equivalent exists.
+    # In that case, save its string representation.
+    except TypeError:
+        fh.attrs[str(attr)] = str(val)


https://bitbucket.org/yt_analysis/yt/commits/ebf886f353c9/
Changeset:   ebf886f353c9
Branch:      yt
User:        brittonsmith
Date:        2017-03-08 20:47:31+00:00
Summary:     Add test.
Affected #:  1 file

diff -r 9c01cabea0f978d280104cc971c54f7443e7ce49 -r ebf886f353c9a4e676de2f5c8bfefba8ce6d8a11 yt/frontends/ytdata/tests/test_outputs.py
--- a/yt/frontends/ytdata/tests/test_outputs.py
+++ b/yt/frontends/ytdata/tests/test_outputs.py
@@ -100,6 +100,12 @@
     assert isinstance(sphere_ds, YTDataContainerDataset)
     yield YTDataFieldTest(full_fn, ("grid", "density"))
     yield YTDataFieldTest(full_fn, ("all", "particle_mass"))
+    cr = ds.cut_region(sphere, ['obj["temperature"] > 1e4'])
+    fn = cr.save_as_dataset(fields=["temperature"])
+    full_fn = os.path.join(tmpdir, fn)
+    cr_ds = yt.load(full_fn)
+    assert isinstance(cr_ds, YTDataContainerDataset)
+    assert (cr["temperature"] == cr_ds.data["temperature"]).all()
     os.chdir(curdir)
     shutil.rmtree(tmpdir)
 


https://bitbucket.org/yt_analysis/yt/commits/70ef1e231986/
Changeset:   70ef1e231986
Branch:      yt
User:        brittonsmith
Date:        2017-03-13 17:49:59+00:00
Summary:     Fix typo.  Thanks, Kacper!
Affected #:  1 file

diff -r ebf886f353c9a4e676de2f5c8bfefba8ce6d8a11 -r 70ef1e2319865b2a419a5ec203759fe73e25bee9 yt/frontends/ytdata/tests/test_outputs.py
--- a/yt/frontends/ytdata/tests/test_outputs.py
+++ b/yt/frontends/ytdata/tests/test_outputs.py
@@ -103,7 +103,7 @@
     cr = ds.cut_region(sphere, ['obj["temperature"] > 1e4'])
     fn = cr.save_as_dataset(fields=["temperature"])
     full_fn = os.path.join(tmpdir, fn)
-    cr_ds = yt.load(full_fn)
+    cr_ds = load(full_fn)
     assert isinstance(cr_ds, YTDataContainerDataset)
     assert (cr["temperature"] == cr_ds.data["temperature"]).all()
     os.chdir(curdir)


https://bitbucket.org/yt_analysis/yt/commits/207d62a00399/
Changeset:   207d62a00399
Branch:      yt
User:        ngoldbaum
Date:        2017-03-13 18:59:48+00:00
Summary:     Merged in brittonsmith/yt (pull request #2541)

Allow cut regions to work with save_as_dataset (closes Issue #1330)

Approved-by: Nathan Goldbaum
Approved-by: Kacper Kowalik
Affected #:  3 files

diff -r 1088ca4ac8d84017d1809a6f114c852297286350 -r 207d62a0039957c5adb7e07fe7d0bcf73ab3e8c7 yt/frontends/ytdata/data_structures.py
--- a/yt/frontends/ytdata/data_structures.py
+++ b/yt/frontends/ytdata/data_structures.py
@@ -275,7 +275,7 @@
             # since this is now particle-like data.
             data_type = self.parameters.get("data_type")
             container_type = self.parameters.get("container_type")
-            ex_container_type = ["cutting", "proj", "ray", "slice"]
+            ex_container_type = ["cutting", "proj", "ray", "slice", "cut_region"]
             if data_type == "yt_light_ray" or container_type in ex_container_type:
                 mylog.info("Returning an all_data data container.")
                 return self.all_data()

diff -r 1088ca4ac8d84017d1809a6f114c852297286350 -r 207d62a0039957c5adb7e07fe7d0bcf73ab3e8c7 yt/frontends/ytdata/tests/test_outputs.py
--- a/yt/frontends/ytdata/tests/test_outputs.py
+++ b/yt/frontends/ytdata/tests/test_outputs.py
@@ -100,6 +100,12 @@
     assert isinstance(sphere_ds, YTDataContainerDataset)
     yield YTDataFieldTest(full_fn, ("grid", "density"))
     yield YTDataFieldTest(full_fn, ("all", "particle_mass"))
+    cr = ds.cut_region(sphere, ['obj["temperature"] > 1e4'])
+    fn = cr.save_as_dataset(fields=["temperature"])
+    full_fn = os.path.join(tmpdir, fn)
+    cr_ds = load(full_fn)
+    assert isinstance(cr_ds, YTDataContainerDataset)
+    assert (cr["temperature"] == cr_ds.data["temperature"]).all()
     os.chdir(curdir)
     shutil.rmtree(tmpdir)
 

diff -r 1088ca4ac8d84017d1809a6f114c852297286350 -r 207d62a0039957c5adb7e07fe7d0bcf73ab3e8c7 yt/frontends/ytdata/utilities.py
--- a/yt/frontends/ytdata/utilities.py
+++ b/yt/frontends/ytdata/utilities.py
@@ -239,4 +239,9 @@
         val = np.array(val)
         if val.dtype.kind == 'U':
             val = val.astype('|S')
-    fh.attrs[str(attr)] = val
+    try:
+        fh.attrs[str(attr)] = val
+    # This is raised if no HDF5 equivalent exists.
+    # In that case, save its string representation.
+    except TypeError:
+        fh.attrs[str(attr)] = str(val)

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list