微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决我如何将网格从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 举报,一经查实,本站将立刻删除。