scipy.interpolate.griddata:剪切z值并获取其中的面积 [英] scipy.interpolate.griddata: cut z-value and get area inside it

查看:102
本文介绍了scipy.interpolate.griddata:剪切z值并获取其中的面积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于此:类似于scipy.interpolate.griddata? 我还有一个问题: 我的输出看起来像这样:

Regarding to this: analogy to scipy.interpolate.griddata? I have an additional question: My output looks like this:

这是一座有噪音的金字塔(没有地面). scipy.interpolate.griddata中是否有可能输入/选择某个z值,以便等于此z值的所有点都被删除?在我的示例中:例如我输入了一个较高的z值->只有具有特定红色值(= z值)的点才能保持活动状态,并向我显示未填充,有噪点的红色三角形.目的是获得该三角形内的面积.

It's a pyramid with noise (and without ground side). Is there a possibility in scipy.interpolate.griddata to enter/choose a certain z-value so that all points which aren't equal this z-values gets deleted? In my example: e.g. I enter a high z-value -> only the points with a certain red-value (= z-value) should stay alive and show me a non-filled, noised, red triangle. The goal is to get the area inside this noised triangle.

tldr:据我了解,这是我要寻找的 isoline 及其内部区域.

edit: tldr: as I just learned, it's an isoline what I am looking for and the area inside it.

edit2: 因此,我从此示例中发现 http://docs.scipy.org/doc/scipy/reference/generation/scipy.interpolate.griddata.html "grid_z1.T"返回一个包含所有z值的数组.在循环中,我可以消除所有不等于某个z值的值->我得到了等值线.问题在于,它不是重排iso 线,而是重排具有某些iso值的网格.没关系,但是也许有更好的解决方案? 除了grid_z.T之外,还有其他一些方法可以满足我的需求吗?

edit2: So I found out that from this example http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html "grid_z1.T" returns me an array with all the z-values. In a loop I could eliminate all values which does not equal a certain z-value -> I got my isoline. Problem is, that it's not rellay an isoline but a grid with some iso-values. It's quite ok, but maybe there is a better solutions? Are there some other methods then grid_z.T which could fit my needs?

推荐答案

在这种特殊情况下,我可以通过一种简单的方法解决它: 我没有消除所有不等于某个z值的值,而是消除了所有高于某个z值的值:

In that special case I could solve it an easy way: Instead of eliminating all values which doesn't equal a certain z-value, I just eliminated all values which ar above a certain z-value:

if grid_z1.T[i][j] > z0 or math.isnan(grid_z1.T[i][j]):
    grid_z1.T[i][j] = np.nan

因为我自己定义了网格大小,所以我可以轻松地通过将网格大小乘以点数来计算面积.

Because I defined gridsize by myself I easily can calculate area by multiply gridsize with count of points.

OT:很抱歉回复这么晚-我去医院已有1周了.

OT: Sorry for replying that late - I've been 1 week in hospital.

这篇关于scipy.interpolate.griddata:剪切z值并获取其中的面积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆