小编Loc*_*sta的帖子

使用python(最好是scipy)对稀疏网格进行插值

我有一个大 (2000 x 2000) 像素网格,其值仅在某些 (x,y) 坐标处定义。例如,它的简化版本如下所示:

-5-3--
---0--
-6--4-
-4-5--
---0--
-6--4-
Run Code Online (Sandbox Code Playgroud)

我如何进行线性插值或最近邻插值,以便我可以在网格中的每个位置都有一个定义的值。

python grid interpolation numpy scipy

5
推荐指数
1
解决办法
4605
查看次数

使用python搜索极大的文本文件

我有一个4000万行,3千兆字节的文本文件(可能无法适应内存),格式如下:

399.4540176 {Some other data}
404.498759292 {Some other data}
408.362737492 {Some other data}
412.832976111 {Some other data}
415.70665675 {Some other data}
419.586515381 {Some other data}
427.316825959 {Some other data}
.......
Run Code Online (Sandbox Code Playgroud)

每行以数字开头,后跟一些其他数据.数字按排序顺序排列.我需要能够:

  1. 给定一个数字x和一个范围y,找到其数量在y范围内的所有行x.例如,如果x=20y=5,我需要找到其数量介于15和之间的所有行25.
  2. 将这些行存储到另一个单独的文件中

在不必遍历整个文件的情况下,这样做的有效方法是什么?

python search large-data

3
推荐指数
1
解决办法
5363
查看次数

标签 统计

python ×2

grid ×1

interpolation ×1

large-data ×1

numpy ×1

scipy ×1

search ×1