예제 #1
0
 def test_downsample_staggered_2d(self):
     grid = StaggeredGrid(1, extrapolation.BOUNDARY, x=32, y=40)
     downsampled = field.downsample2x(grid)
     self.assertEqual(set(spatial(x=16, y=20) & channel(vector=2)),
                      set(downsampled.shape))
예제 #2
0
 def test_downsample_staggered_2d(self):
     grid = Domain(x=32, y=40).staggered_grid(1)
     downsampled = field.downsample2x(grid)
     self.assertEqual(
         math.shape(x=16, y=20, vector=2).alphabetically(),
         downsampled.shape.alphabetically())
예제 #3
0
 def test_upsample_downsample_centered_1d(self):
     grid = CenteredGrid(math.tensor([0, 1, 2, 3], spatial('x')))
     upsampled = field.upsample2x(grid)
     downsampled = field.downsample2x(upsampled)
     math.assert_close(downsampled.values.x[1:-1], grid.values.x[1:-1])
예제 #4
0
 def test_upsample_downsample_centered_1d(self):
     grid = Domain(x=4).scalar_grid([0, 1, 2, 3])
     upsampled = field.upsample2x(grid)
     downsampled = field.downsample2x(upsampled)
     math.assert_close(downsampled.values.x[1:-1], grid.values.x[1:-1])