我如何将网格从257x257点网格转换为129x129点网格或等效地从256x256单元网格转换为128x128单元网格 测试粗糙网格

问题描述

粗略地形的2倍。换句话说,我们将把网格从257x257点网格转换为129x129点网格(或等效地从256x256单元网格转换为128x128单元网格)。

在下面的代码块中,定义三个新的点数组xnew,ynew和znew并将它们组合到一个新的StructuredGrid对象中,该对象名为粗糙。

xnew = np.arange(-10,10,2)               
ynew = np.arange(-10,2)
znew = np.arange(-10,2)
x_new,y_new,z_new = np.meshgrid(xnew,ynew,znew)
coarse = pv.StructuredGrid(x_new,z_new)

# this code not using because not any error this code
#raise NotImplementedError(coarse)
#print(f"Coarsening from {terrain.dimensions[0]} to {math.ceil(terrain.dimensions[0]/2)}...")
coarse

测试粗糙网格。

assert xnew.shape == (129,129,1)
assert ynew.shape == (129,1)
np.testing.assert_allclose(xnew[0][0][0],1818580,rtol=1e-7)
np.testing.assert_allclose(xnew[5][120][0],1818730,rtol=1e-7)
np.testing.assert_allclose(ynew[128][120][0],5650680,rtol=1e-7)
np.testing.assert_allclose(znew[12][12][0],1880.53,rtol=1e-5)

我收到此错误。.请帮我吗?

AssertionError                            Traceback (most recent call last)
<ipython-input-27-d5f1c5e774bf> in <module>
      1 ### Tests for coarsenMesh.
      2 ### Please DO NOT hard-code the answers as we will also be using hidden test cases when grading your submission.
----> 3 assert xnew.shape == (129,1)
      4 assert ynew.shape == (129,1)
      5 np.testing.assert_allclose(xnew[0][0][0],rtol=1e-7)

AssertionError: 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)