简体   繁体   English

python函数在2D字段中的一点处插值

[英]python function to interpolate the value at a point in a 2D field

I have a 2D pressure field and I would like to interpolate the value at particular set of singular points or locations. 我有一个二维压力场,我想在特定的一组奇异点或位置上插值。 I'm suspect downscaling is a solution but before I try and write the functions for python, I was wondering if there is a way/code already in existence. 我怀疑降级是一种解决方案,但是在尝试为python编写函数之前,我想知道是否已经存在一种方式/代码。 Perhaps scipy has a function but I'm unaware and cannot find any. 也许scipy具有功能,但是我不知道并且找不到任何东西。

Any help is appreciated 任何帮助表示赞赏

Scipy has a 2-dimensional interpolation function: Scipy具有二维插值功能:

    scipy.interpolate.interp2d

Information on how to use this function can be found on http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.interpolate.interp2d.html 有关如何使用此功能的信息,请参见http://docs.scipy.org/doc/scipy-0.14.0/reference/generation/scipy.interpolate.interp2d.html

    scipy.interpolate.interp2d(x, y, z)

in which x and y are 1-dimensional arrays of coordinates corresponding to the two dimensional array z which is your pressurefield. 其中xy是对应于二维数组z一维坐标数组, z是您的压力场。

x corresponds to the second axis of the z -matrix. x对应于z矩阵的第二轴。 y corresponds to the first axis of the z -matrix y对应于z -matrix的第一轴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM