[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Nov 13 16:52:46 PST 2017
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/3556e72eb18d/
Changeset: 3556e72eb18d
User: ngoldbaum
Date: 2017-11-01 19:58:27+00:00
Summary: Ensure field accesses on 2D grids keep their dummy dimension
Affected #: 2 files
diff -r 21be624bbb559f9f6ff0c47251e53397d8804f1b -r 3556e72eb18dbd2e63d44aa57df63b85784adb8e yt/data_objects/grid_patch.py
--- a/yt/data_objects/grid_patch.py
+++ b/yt/data_objects/grid_patch.py
@@ -95,8 +95,10 @@
finfo = self.ds._get_field_info(*fields[0])
if not finfo.particle_type:
num_nodes = 2**sum(finfo.nodal_flag)
- new_shape = list(self.ActiveDimensions) + [num_nodes]
- return np.squeeze(tr.reshape(new_shape))
+ new_shape = list(self.ActiveDimensions)
+ if num_nodes > 1:
+ new_shape += [num_nodes]
+ return tr.reshape(new_shape)
return tr
def convert(self, datatype):
diff -r 21be624bbb559f9f6ff0c47251e53397d8804f1b -r 3556e72eb18dbd2e63d44aa57df63b85784adb8e yt/frontends/enzo/tests/test_outputs.py
--- a/yt/frontends/enzo/tests/test_outputs.py
+++ b/yt/frontends/enzo/tests/test_outputs.py
@@ -219,3 +219,12 @@
assert_allclose_units(c, c_actual)
assert_equal(max([g['density'].max() for g in ds.index.grids]), v)
+
+ at requires_file(kh2d)
+def test_2d_grid_shape():
+ # see issue #1601
+ # we want to make sure that accessing data on a grid object
+ # returns a 3D array with a dummy dimension.
+ ds = data_dir_load(kh2d)
+ g = ds.index.grids[1]
+ assert g['density'].shape == (128, 100, 1)
https://bitbucket.org/yt_analysis/yt/commits/f675aaf2e660/
Changeset: f675aaf2e660
User: atmyers
Date: 2017-11-14 00:52:33+00:00
Summary: Merge pull request #1603 from ngoldbaum/2d-grid-fix
Ensure field accesses on 2D grids keep their dummy dimension
Affected #: 2 files
diff -r 4e4b5f4b6e5b17a4bc026e30bfafa206a24294d8 -r f675aaf2e660adb7d92124a1481ec604f022475e yt/data_objects/grid_patch.py
--- a/yt/data_objects/grid_patch.py
+++ b/yt/data_objects/grid_patch.py
@@ -95,8 +95,10 @@
finfo = self.ds._get_field_info(*fields[0])
if not finfo.particle_type:
num_nodes = 2**sum(finfo.nodal_flag)
- new_shape = list(self.ActiveDimensions) + [num_nodes]
- return np.squeeze(tr.reshape(new_shape))
+ new_shape = list(self.ActiveDimensions)
+ if num_nodes > 1:
+ new_shape += [num_nodes]
+ return tr.reshape(new_shape)
return tr
def convert(self, datatype):
diff -r 4e4b5f4b6e5b17a4bc026e30bfafa206a24294d8 -r f675aaf2e660adb7d92124a1481ec604f022475e yt/frontends/enzo/tests/test_outputs.py
--- a/yt/frontends/enzo/tests/test_outputs.py
+++ b/yt/frontends/enzo/tests/test_outputs.py
@@ -219,3 +219,12 @@
assert_allclose_units(c, c_actual)
assert_equal(max([g['density'].max() for g in ds.index.grids]), v)
+
+ at requires_file(kh2d)
+def test_2d_grid_shape():
+ # see issue #1601
+ # we want to make sure that accessing data on a grid object
+ # returns a 3D array with a dummy dimension.
+ ds = data_dir_load(kh2d)
+ g = ds.index.grids[1]
+ assert g['density'].shape == (128, 100, 1)
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