本文介绍了在Python中下采样数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有基本的2-D numpy数组,我想将它们缩减到更粗糙的分辨率。是否有一个简单的numpy或scipy模块可以很容易地做到这一点?我还应该注意,这个数组是通过Basemap模块在地理上显示的。



SAMPLE:

解决方案

scikit-image 已实施<$的工作版本c $ c>下采样这里,虽然他们回避称它为下采样因为它不是DSP的下采样,如果我理解正确的话:





但它非常有效好吧,它是我在Python中找到的唯一下采样器,它可以处理图像中的 np.nan 。我很快就对这个巨大的图像进行了下采样。

I have basic 2-D numpy arrays and I'd like to "downsample" them to a more coarse resolution. Is there a simple numpy or scipy module that can easily do this? I should also note that this array is being displayed geographically via Basemap modules.

SAMPLE:

解决方案

scikit-image has implemented a working version of downsampling here, although they shy away from calling it downsampling for it not being a downsampling in terms of DSP, if I understand correctly:

http://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.block_reduce

but it works very well, and it is the only downsampler that I found in Python that can deal with np.nan in the image. I have downsampled gigantic images with this very quickly.

这篇关于在Python中下采样数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 12:36