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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Aug 2 05:34:32 PDT 2017


4 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/976ed44d254e/
Changeset:   976ed44d254e
User:        Alex Lindsay
Date:        2017-07-31 16:25:52+00:00
Summary:     Make force_override work for on-disk fields (#1511)
Affected #:  2 files

diff -r 995dd2a4b31cc288938fb9dc62faf5e79628dfe8 -r 976ed44d254eb324e84fe94377174d018aa8890f yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -1181,6 +1181,8 @@
         """
         self.index
         override = kwargs.get("force_override", False)
+        if override and name in self.index.field_list:
+            self.index.field_list.remove(name)
         # Handle the case where the field has already been added.
         if not override and name in self.field_info:
             mylog.warning("Field %s already exists. To override use " +

diff -r 995dd2a4b31cc288938fb9dc62faf5e79628dfe8 -r 976ed44d254eb324e84fe94377174d018aa8890f yt/fields/tests/test_fields.py
--- a/yt/fields/tests/test_fields.py
+++ b/yt/fields/tests/test_fields.py
@@ -358,3 +358,13 @@
         gpm = g['particle_mass'].sum()
         dpm = g['deposit', 'all_mass'].sum()
         assert_allclose_units(gpm, dpm)
+
+def test_on_disk_override():
+    def _test(field, data):
+        return data[('stream', 'velocity_x')]
+
+    ds = fake_random_ds(16)
+    ds.add_field(('stream', 'density'), function=_test, units='cm/s', force_override=True)
+    density = ds.all_data()[('stream', 'density')]
+    vel_x = ds.all_data()[('stream', 'velocity_x')]
+    assert_equal(density, vel_x)


https://bitbucket.org/yt_analysis/yt/commits/0208e8ee12a5/
Changeset:   0208e8ee12a5
User:        Alex Lindsay
Date:        2017-07-31 17:10:09+00:00
Summary:     Instead lets error (#1511)
Affected #:  1 file

diff -r 976ed44d254eb324e84fe94377174d018aa8890f -r 0208e8ee12a5d26f611f881d87d7323028b3a2e3 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -1177,12 +1177,16 @@
            Describes the dimensionality of the field.  Currently unused.
         display_name : str
            A name used in the plots
+        force_override : bool
+           Whether to override an existing derived field. Does not work with
+           on-disk fields.
 
         """
         self.index
         override = kwargs.get("force_override", False)
         if override and name in self.index.field_list:
-            self.index.field_list.remove(name)
+            raise RuntimeError("force_override is only meant to be used with "
+                               "derived fields, not on-disk fields.")
         # Handle the case where the field has already been added.
         if not override and name in self.field_info:
             mylog.warning("Field %s already exists. To override use " +


https://bitbucket.org/yt_analysis/yt/commits/0a68922b9af3/
Changeset:   0a68922b9af3
User:        Alex Lindsay
Date:        2017-08-01 18:39:14+00:00
Summary:     Remove test.
Affected #:  1 file

diff -r 0208e8ee12a5d26f611f881d87d7323028b3a2e3 -r 0a68922b9af30c94d9a7bf13e12e41448ca69dca yt/fields/tests/test_fields.py
--- a/yt/fields/tests/test_fields.py
+++ b/yt/fields/tests/test_fields.py
@@ -358,13 +358,3 @@
         gpm = g['particle_mass'].sum()
         dpm = g['deposit', 'all_mass'].sum()
         assert_allclose_units(gpm, dpm)
-
-def test_on_disk_override():
-    def _test(field, data):
-        return data[('stream', 'velocity_x')]
-
-    ds = fake_random_ds(16)
-    ds.add_field(('stream', 'density'), function=_test, units='cm/s', force_override=True)
-    density = ds.all_data()[('stream', 'density')]
-    vel_x = ds.all_data()[('stream', 'velocity_x')]
-    assert_equal(density, vel_x)


https://bitbucket.org/yt_analysis/yt/commits/b8aedc8ed7a1/
Changeset:   b8aedc8ed7a1
User:        ngoldbaum
Date:        2017-08-02 12:33:48+00:00
Summary:     Merge pull request #1516 from lindsayad/force_override_1511

Make force_override work for on-disk fields (#1511)
Affected #:  2 files

diff -r 43ce1051199f158b6b66f6f6a8feea794c92c4c2 -r b8aedc8ed7a1da10290ac924dcf219eb854d0a52 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -1177,10 +1177,16 @@
            Describes the dimensionality of the field.  Currently unused.
         display_name : str
            A name used in the plots
+        force_override : bool
+           Whether to override an existing derived field. Does not work with
+           on-disk fields.
 
         """
         self.index
         override = kwargs.get("force_override", False)
+        if override and name in self.index.field_list:
+            raise RuntimeError("force_override is only meant to be used with "
+                               "derived fields, not on-disk fields.")
         # Handle the case where the field has already been added.
         if not override and name in self.field_info:
             mylog.warning("Field %s already exists. To override use " +

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