快速傅立叶变换fft

Meteorology students hardly experience smooth and expeditious data analysis. When comes to results, they oftentimes plunge to nebulous insights and vague conclusions. Despite how clearly the method used, meteorology students shouldn’t take the idea of being creative in handling the data for granted. The quality of results totally depends on how creative they scramble the data and extract its insights. Hence the better result quality comes the more beneficial explanation. For the practical instance, when harnessing the time series meteorological dataset on analysis, many students trivialize the existence of another possible domain on the dataset. Many students don’t treat the time series data as a signal or wave that related to many parameters such as frequency and period. In this post, I’m going to show an uncomplicated example on how we use other possible domain of time series data -which is frequency- on analyzing meteorology phenomenon encompassing its practical step-by-step methods using python programming language.

气象专业的学生几乎不会经历流畅而Swift的数据分析。 当涉及到结果时,他们通常会陷入模糊的见解和模糊的结论。 尽管使用的方法有多清晰,但气象学学生在处理数据时不应抱有创造性的想法。 结果的质量完全取决于他们如何创造性地加扰数据并提取其见解。 因此,更好的结果质量来自更有益的解释。 在实际情况中,当利用时间序列气象数据集进行分析时,许多学生轻视了数据集上另一个可能域的存在。 许多学生不会将时间序列数据视为与许多参数(例如频率和周期)相关的信号或波。 在本文中,我将展示一个简单的示例,说明如何使用其他可能的时间序列数据域(即频率)来分析气象现象,其中包括使用python编程语言进行的实用逐步方法。

Prepare the data

准备数据

First things first, prepare the data that going to be analyzed. For example, I use 37-years daily precipitation from CHIRPS which is rainfall estimates from rain gauge and satellite observations. The data has been cropped at the specific BMKG Station in Bandung, named Cemara Weather Station. Since CHIRPS data more complete than BMKG data, I personally prefer to use CHIRPS rather than use BMKG data despite the considerable discrepancy in the data when compared.

首先,准备要分析的数据。 例如,我使用来自CHIRPS的 37年日降水量,这是根据雨量计和卫星观测得出的降雨量估算值。 数据已在万隆特定的BMKG站Cemara气象站进行了裁剪。 由于CHIRPS数据比BMKG数据更完整,因此我个人更喜欢使用CHIRPS而不是BMKG数据,尽管与之相比数据存在很大差异。

Fig 1 shows the daily precipitation (mm) from 1st January of 1981 until 31st December of 2018. We might already have known that Bandung or any other region located on Java island has two seasons (dry and rainy). The peak of rainy season in Bandung normally happens in December-January-February (DJF) and the trough of rainy season -which also called dry season- in Bandung normally happens in June-July-August. Much of research proved that seasonality weather in Bandung (and mostly western Indonesia) is affected by Asia-Australia monsoon. As we know the trend of rain seasonality, we suppose to be able to depict it as a wave or signal since it has the peak and trough. For the better overview, instead of figure the data as a panel fraught of raw points connected to each other, let’s turn it to monthly precipitation.

图1显示了从1981年1月1日到2018年12月31日的日降水量(mm)。我们可能已经知道万隆或Java岛上的任何其他地区有两个季节(干燥和多雨)。 万隆的雨季高峰通常发生在12月至1月至2月(DJF),而万隆的雨季低谷(也称为旱季)通常发生在6月,7月至8月。 许多研究证明,万隆(主要是印度尼西亚西部)的季节性天气受亚澳季风影响。 我们知道降雨季节的趋势,因为它具有波峰和波谷,因此我们可以将其描述为波浪或信号。 为了获得更好的概览,我们不要将数据看作是相互连接的原始点的面板,而是将其转换为月降水量。

Fig 2. Precipitation — Monthly Average (Stasiun Cemara, Bandung)图2.降水—月平均数(万隆的Stasiun Cemara)

Now we have a better overview of rain seasonality in Bandung. This wavy pattern transpires one time a year and some years may have shifted of peak and trough of the rainy season. Notwithstanding, the pattern remains.

现在,我们对万隆的降雨季节有了更好的了解。 这种波浪形图案每年发生一次,并且有些年份可能已经转移了雨季的高峰和低谷。 尽管如此,模式仍然存在。

How if there were any else possibly periodically pattern occur in a year? Semiannual pattern or quarter-annually pattern? It could be and it should have been known by meteorology students as they recognize that rain pattern in Indonesia is very complex and affected by up to global-scale events and influenced by various topographic features.

一年中是否还有其他可能定期出现的模式? 半年模式还是每半年一次? 气象学学生应该知道,而且应该知道,因为他们认识到印度尼西亚的降雨模式非常复杂,并且受到全球范围内最大事件的影响,并受到各种地形特征的影响。

Use FFT!

使用FFT!

Fast Fourier Transform (FFT) is one of the most useful tools and widely used in signal processing. FFT has contributed to many problems solving observations in astronomy, physics, and chemistry. In meteorology, FFT has been utilized for many kinds of research and most of it is related to climate data analysis. Climate data tend to have a long period of observation which reflects scientist’s definition that climate normal as an average over a recent 30-year period.

快速傅立叶变换(FFT)是最有用的工具之一,广泛用于信号处理中。 FFT导致解决天文学,物理学和化学观测问题的许多问题。 在气象学中,FFT已用于多种研究,其中大多数与气候数据分析有关。 气候数据趋向于长期观测,这反映了科学家的定义,即最近30年的平均气候平均值。

FFT is a very complicated mathematical equation, and to be honest, I’ve never fully understood how’s the FFT equation works. To see more about FFT and how it works, check this out (A gentle introduction to the FFT). In this article, I want to introduce how to use scipy.fft library in python to decompose seasonality patterns in 37-year precipitation data and get yourself (and myself) to gradually adept with python data analysis library.

FFT是一个非常复杂的数学方程式,老实说,我从未完全理解过FFT方程的工作原理。 要了解有关FFT及其工作原理的更多信息,请检查一下( FFT的简要介绍 )。 在本文中,我想介绍如何使用python中的scipy.fft库分解37年降水数据中的季节性模式,并使自己(和我自己)逐渐适应python数据分析库。

import matplotlib

导入matplotlib

import matplotlib.pyplot as plt

导入matplotlib.pyplot作为plt

from pylab import *

从pylab导入*

from math import *

从数学导入*

import warnings

进口警告

warnings.simplefilter(‘ignore’)

warnings.simplefilter('ignore')

import numpy as np

将numpy导入为np

from numpy.fft import fftfreq

从numpy.fft导入fftfreq

from scipy.fftpack import *

从scipy.fftpack导入*

from scipy.signal import butter, filtfilt , freqz

来自scipy.signal进口黄油,filtfilt,freqz

import pandas as pd

将熊猫作为pd导入

Import all the libraries needed. Scipy is the main library use in this analysis. It contains many of FFT formulas and filtering methods. Then, read the data.

导入所有需要的库。 Scipy是此分析中主要使用的库。 它包含许多FFT公式和滤波方法。 然后,读取数据。

prec = pd.read_csv(‘prec_chirps.csv’)

prec = pd.read_csv('prec_chirps.csv')

Use pandas library to read csv to see the data as data frame like this:

使用pandas库读取csv可以将数据作为数据框查看,如下所示:

Fig 3. Data frame图3.数据框

The data has 13,879 rows represents daily precipitation (mm) from 1981–2018 and has no null values. The annual seasonality in Fig. 1 can be seen by a naked eye. However, it’s not enough to present the existence of seasonality only by subjective plain sight towards a graph, thus we need more palpable images that could indicate the seasonality by exact number.

该数据有13,879行代表1981-2018年的每日降水量(mm),没有空值。 用肉眼可以看到图1中的年度季节性。 但是,仅凭主观直视图表来呈现季节的存在是不够的,因此我们需要更多可触摸的图像,以确切的数字指示季节。

dt = 1

dt = 1

n = prec.shape[0]

n = prec.shape [0]

F = fft(prec[‘prec’])

F = fft(prec ['prec'])

w = fftfreq(n, dt)

w = fftfreq(n,dt)

t=np.linspace(1, n, n)

t = np.linspace(1,n,n)

T = n/t[0:6939]

T = n / t [0:6939]

indices = where(w > 0)

索引=其中(w> 0)

w_pos = abs(w[indices])

w_pos = abs(w [indices])

F_pos = abs(F[indices])

F_pos = abs(F [indices])

In this step, we start to use FFT to transform the precipitation data which only has time domain to frequency domain. Declare dt = 1 as long as we want to analyze the data on daily basis over a 37-year period of time. The FFT result represents by F.

在这一步中,我们开始使用FFT将仅具有时域的降水数据转换为频域。 只要我们想在37年的时间内每天分析数据,就声明dt = 1。 FFT结果用F表示。

Bear in mind that the time series precipitation data is a combination of many frequency waves which has each wave parameters and amplify one another. By transforming the data to frequency domain, we could get each set of waves with certain frequencies that build-up the data.

请记住,时间序列降水量数据是许多频率波的组合,这些频率波具有各自的波参数并相互放大。 通过将数据转换到频域,我们可以获得具有一定频率的每组波,这些波构成了数据。

Next, assign data length to n and calculate sample frequency with fftfreq function in which requires n and dt as arguments. It returns float array w contains the frequency bin centers in cycles per unit of the sample spacing (with zero at the start). Don’t forget to set synthetic data variable which represents the time array with an increasing value from 1 until n (data length). Then, set a new variable that portrays the number of periodicity types of the signal whereby the length is half of the original data. After that, select only indices for elements that correspond to positive frequencies. To know the details about why we do this step, check this thread: Why is FFT “mirrored”?

接下来,将数据长度分配给n并使用fftfreq函数计算采样频率,其中需要n和dt作为参数。 它返回的浮点数组w包含频率单元中心,以每个采样间隔单位的周期为周期(开始时为零)。 不要忘记设置合成数据变量,该变量代表时间数组,其值从1到n(数据长度)递增。 然后,设置一个新变量,该变量描述信号的周期性类型的数量,其中长度是原始数据的一半。 之后,仅选择与正频率相对应的元素的索引。 要了解有关为什么执行此步骤的详细信息,请检查以下线程: 为什么FFT是“镜像”的?

Now, we’re all set to figure the desirable of time-domain transformation to the frequency domain.

现在,我们都准备好将时域转换为频域的理想方法。

fig1 = plt.figure()

图1 = plt.figure()

ax = fig1.add_axes([0, 0, 2, 0.8])

斧= fig1.add_axes([0,0,2,0.8])

axF = fig1.add_axes([0, 1.2, 2, 0.8])

axF = fig1.add_axes([0,1.2,2,0.8])

axF.plot(w_pos, abs(F_pos))

axF.plot(w_pos,abs(F_pos))

axF.set_xlabel(‘Frequency’, fontsize = 13)

axF.set_xlabel('Frequency',fontsize = 13)

axF.set_ylabel(‘magnitude’, fontsize = 13)

axF.set_ylabel('magnitude',fontsize = 13)

axF.set_title(‘Periodogram (FFT Result)’, fontsize = 15)

axF.set_title('周期图(FFT结果)',fontsize = 15)

axF.tick_params(labelsize = 13)

axF.tick_params(labelsize = 13)

ax.plot(T, abs(F_pos))

ax.plot(T,abs(F_pos))

ax.set_xlabel(‘Period’, fontsize = 13)

ax.set_xlabel('Period',fontsize = 13)

ax.set_ylabel(‘magnitude’, fontsize = 13)

ax.set_ylabel('magnitude',fontsize = 13)

ax.set_title(‘Periodogram (FFT Result)’, fontsize = 15)

ax.set_title('周期图(FFT结果)',fontsize = 15)

ax.tick_params(labelsize = 13)

ax.tick_params(labelsize = 13)

Fig 4. Periodogram (FFT Result)图4.周期图(FFT结果)

The graph called periodogram. The difference between the two graphs above is on the x-axis. The upper graph shows periodogram with frequency as an x-axis, on the contrary, the lower graph uses 1/frequency (period) as x-axis. I found that the lower graph is way more intuitive and comprehensible since the period’s unit is the same as the data time unit which is a day. The y-axis is the amplitude of each periodicity/frequency that build-up the data. From the lower graph, it can be seen that from the 37-years length of data, the highest contributions are ranging between lower period sub-signal for exact < 1000 days of a period. Let’s point out that range.

该图称为周期图。 上面两个图表之间的差异在x轴上。 上方的图显示频率为x轴的周期图,相反,下方的图使用1 /频率(周期)为x轴。 我发现较低的图形更加直观和易于理解,因为时间段的单位与一天的数据时间单位相同。 y轴是建立数据的每个周期性/频率的幅度。 从下面的图表中可以看出,从37年的数据长度来看,最大的贡献介于精确到<1000天的较低周期子信号之间。 让我们指出这个范围。

Fig 5. Highlighted Periodogram图5.突出显示的周期图

By limiting the x-axis range, we get the clear-cut of the periodicity ranges which have a significant amplitude in forming the original data. Without being examined, 365-days periodicity has the highest amplitude as I mentioned earlier. It clearly represents the most common and well-known of Bandung rain seasonality (annual seasonality). The second highest amplitude is on 183-days (~6-month, semi-annual seasonality) and the third is on 122-days (~4-month, quarter-annual seasonality). It turns out that Bandung rain seasonality is not only transpired annually, but it also has semi-annual and quarter-annual patterns, nevertheless, the amplitude is not quite high which means that the patterns are less frequent to exist over the time scope of the data.

通过限制x轴范围,我们可以清楚地看到周期性范围,该范围在形成原始数据时具有明显的幅度。 如前所述,未经检查,365天的周期具有最高的振幅。 显然,它代表了万隆雨季最常见和最著名的一年(季节性)。 第二高的振幅是在183天(约6个月,每半年一次的季节性),而第三高的振幅是在122天(约4个月,每半年一次的季节性)。 事实证明,万隆的降雨季节不仅每年发生一次,而且还具有半年和四分之一的规律,但幅度并不很高,这意味着在整个时间范围内这些规律的存在频率较低。数据。

Meteorologically, these patterns could happen inflicted by various events such as local disturbances until global variabilities like El Nino-La Nina or Madden-Julian Oscillation (MJO) effects. We should need more researches to be able to answer the cause of these available patterns of Bandung rainfall seasonality. Python programming language with its user-friendly scientific package has been bringing us to advance the data analysis regarding many sectors. This simple use case in meteorology maybe not as complex as other use cases, but it worth knowing and worth sharing. After using FFT and knowing the hidden patterns of the data, there are so many analysis tools which also practical to meteorological science use cases, like filtering (low-pass, band-pass, high-pass filtering) and many more. Hope this article is pertinent to your study field and could help you to get more profound data analysis.

在气象上,这些模式可能是由各种事件(例如局部扰动)造成的,直到像El Nino-La Nina或Madden-Julian振荡(MJO)效应这样的全球变率为止。 我们应该进行更多的研究,才能回答万隆降雨季节性变化的这些可用模式。 Python编程语言及其用户友好的科学软件包已使我们推进了许多领域的数据分析。 气象学中的这个简单用例可能没有其他用例那么复杂,但是值得了解和分享。 使用FFT并了解数据的隐藏模式后,有许多分析工具对气象科学用例也很实用,例如滤波(低通,带通,高通滤波)等等。 希望本文与您的研究领域相关,并且可以帮助您获得更深入的数据分析。

翻译自: https://medium.com/@tiofaizintio/extract-seasonality-patterns-from-climate-data-with-fast-fourier-transform-fft-de479303f01

快速傅立叶变换fft


http://www.taodudu.cc/news/show-3408403.html

相关文章:

  • 另一种历史
  • 一)关羽和赵云在敌人心目中的对比
  • (转)赵云在长坂坡杀的都是些什么人?一一道来...
  • 三国志吞食天地2(街机)的全人物通关研究
  • 基于Elo Rating System的三国演义武将排名
  • 一个计算机爱好者的不完整回忆(五十六)CPS1基板上的那些经典游戏(1)
  • 关羽和赵云谁更厉害
  • 23种设计模式(十一)外观模式(阁瑞钛伦特软件-九耶实训)
  • 几个有用的小工具
  • 传输某条数据到另一个页面回填
  • 如何用 Sprite Kit 和 Swift 制作一个逃逸游戏-第一部分
  • 30多岁裸辞,一个工程师的自白
  • 22万个木箱!TWaver 3D极限压榨
  • 木马免杀小尝试
  • 一个小博主的奇葩经历
  • 大学一年级计算机组成语结构试题,一年级语文期终试卷
  • 常见鸟的种类及特点_常见鸟类 我国鸟类常见种类及分布
  • 有一个学计算机男友是什么体验,有一个程序员男朋友是怎样的体验?
  • java自动化框架编写第一周
  • 静态代码扫描调研
  • java如何写一个简单的定时任务?
  • 计算机网络的定义中的三个关键词,计算机网络应用基础概述论文(2)
  • node.js mysql h5_【京东个人中心】——Nodejs/Ajax/HTML5/Mysql爬坑之功能与数据分析
  • 计算机网络应用基础论文,计算机网络应用基础研究论文
  • 4计算机网络应用,浅谈计算机网络应用基础
  • 监控 服务器与显示器一体化,一体化视频监控系统探讨
  • 【图像识别】基于卷积神经网络cnn实现银行卡数字识别matlab源码
  • 吉林大学计算机学院王健,吉林大学计算机科学与技术学院研究生导师简介-王 健...
  • 【Git分支开发命令大全】
  • 【sonar集成jenkins实现静态代码扫描】

快速傅立叶变换fft_使用快速傅立叶变换fft从气候数据中提取季节性模式相关推荐

  1. 理解离散傅立叶变换(一)——傅立叶变换的由来

    理解离散傅立叶变换(一) --傅立叶变换的由来 关于傅立叶变换,无论是书本还是在网上可以很容易找到关于傅立叶变换的描述,但是大都是些故弄玄虚的文章,太过抽象,尽是一些让人看了就望而生畏的公式的罗列,让 ...

  2. UA OPTI512R 傅立叶光学导论17 离散傅立叶变换简介

    UA OPTI512R 傅立叶光学导论17 离散傅立叶变换简介 DFT及其矩阵形式 DFT的性质 上一讲提到对连续波形f(x)f(x)f(x)做周期性采样时可以用采样函数来表示采样结果: fS(x)= ...

  3. UA OPTI512R 傅立叶光学导论15 2-D Fourier变换与Hankel变换

    UA OPTI512R 傅立叶光学导论15 2-D Fourier变换与Hankel变换 2-D Fourier变换的定义 2-D Fourier变换的性质 极坐标系中的2-D Fourier变换 H ...

  4. 离散哈特莱变换(DHT)及快速哈特莱变换(FHT)学习

    离散哈特莱变换(DHT)及快速哈特莱变换(FHT)学习 说在前边 最近复习\(DSP\)的时候,发现了一个号称专门针对离散实序列的变换,经分析总运算量为普通\(FFT\)的几乎一半,而且完全没有复数. ...

  5. matlab零阶保持器法求z变换,教你快速求解闭环脉冲传递函数φ(z)或输出Z变换C(z)!...

    大家好,我是宝刀君,很高兴我们又见面了~ 在离散系统分析中,大家刚开始学习时,会遇到2类题:一类是没有采样开关,让你求系统的输出Z变换C(z):另一类是有采样开关时,让你求系统的闭环脉冲传递函数,进而 ...

  6. 通俗介绍拉普拉斯变换,傅里叶变换和z变换

    原文:https://zhidao.baidu.com/question/2140860086243217068.html 早期的数学以微积分为主.微分方程的计算过程通常都是非常复杂的.有时很难求解. ...

  7. 从傅里叶(Fourier)变换到伽柏(Gabor)变换再到小波(Wavelet)变换

    从傅里叶(Fourier)变换到伽柏(Gabor)变换再到小波(Wavelet)变换 本文是边学习边总结和摘抄各参考文献内容而成的,是一篇综述性入门文档,重点在于梳理傅里叶变换到伽柏变换再到小波变换的 ...

  8. Fourier变换、STFT变换、Gabor变换、小波变换、Haar变换、Hilbert变换

    参考:https://blog.csdn.net/chenaiyanmie/article/details/80246108#傅立叶变换 参考:http://www.360doc.com/conten ...

  9. Xcode中快速定位、快速查找、快速查看文档、快速解决不再打印等技巧

    文章原文地址:http://blog.sina.com.cn/s/blog_68f324850102x4et.html 技巧一:快速定位 XGLog(@"----%s----%d------ ...

最新文章

  1. java内存数据管理
  2. linux安装的时候网卡配置失败,Linux下安装网卡执行make install失败
  3. python web-python web入坑指南
  4. BZOJ 2301 Problem b(莫比乌斯反演+分块优化)
  5. Oracle高可用概述(HA与RAC的关系解惑)
  6. Android功耗优化(7)---如何分析wakelock(wakeup source)持锁问题
  7. VC下sql+ado数据库v_strTemp.vt == VT_NULL判断的问题
  8. 逾845.5万枚XRP从币安交易所转入未知钱包,价值超过496万美元
  9. 区块链之比特币的私钥,公钥和地址是什么?
  10. 10 步让你成为更优秀的Coder
  11. Windows批处理添加注释
  12. Unity 之自动化打包ipa
  13. Autovue 集成
  14. 新房和二手房的优缺点
  15. 思科下一代数据中心Nexus7000优势
  16. GObject对象系统
  17. 百度搜索和百度信息流有什么区别?
  18. 智慧消防管理系统实现全民消防造福全社会
  19. AI面试总结_20190511
  20. 2008年研究生入学考试西医综合真题及其答案

热门文章

  1. 三大期货交易所齐进全球20强
  2. freeswitch挂断事件表格
  3. 2069;【例2.12 】糖果游戏(信奥一本通)
  4. Vue点击按钮跳转到新路由
  5. DataGridView减少闪烁的解决办法
  6. OpenGL天空贴图以及反射纹理映射即镜面反射
  7. 使用NumPy获取MNIST图片
  8. Conformal ECO 流程介绍
  9. 音频文件变成html文档,C#生成音频文件以及转换成需要的格式
  10. 公务员计算机专业包括哪些专业,公务员计算机类及相关专业有哪些