Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6820959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:29:17+00:00 2026-05-26T21:29:17+00:00

I am trying to replicate the results from a paper. Two-dimensional Fourier Transform (2D-FT)

  • 0

I am trying to replicate the results from a paper.

“Two-dimensional Fourier Transform (2D-FT) in space and time along sections of constant latitude (east-west) and longitude (north-south) were used to characterize the spectrum of the simulated flux variability south of 40degS.” – Lenton et al(2006)
The figures published show “the log of the variance of the 2D-FT”.

I have tried to create an array consisting of the seasonal cycle of similar data as well as the noise. I have defined the noise as the original array minus the signal array.

Here is the code that I used to plot the 2D-FT of the signal array averaged in latitude:

import numpy as np

from numpy import ma
from matplotlib import pyplot as plt
from Scientific.IO.NetCDF import NetCDFFile 

### input directory 
indir = '/home/nicholas/data/'

### get the flux data which is in
### [time(5day ave for 10 years),latitude,longitude]
nc = NetCDFFile(indir + 'CFLX_2000_2009.nc','r')
cflux_southern_ocean  = nc.variables['Cflx'][:,10:50,:]
cflux_southern_ocean  = ma.masked_values(cflux_southern_ocean,1e+20) # mask land
nc.close()

cflux = cflux_southern_ocean*1e08 # change units of data from mmol/m^2/s

### create an array that consists of the seasonal signal fro each pixel
year_stack = np.split(cflux, 10, axis=0)
year_stack = np.array(year_stack)
signal_array = np.tile(np.mean(year_stack, axis=0), (10, 1, 1))
signal_array = ma.masked_where(signal_array > 1e20, signal_array) # need to mask
### average the array over latitude(or longitude)
signal_time_lon = ma.mean(signal_array, axis=1)

### do a 2D Fourier Transform of the time/space image
ft = np.fft.fft2(signal_time_lon)
mgft = np.abs(ft)   
ps = mgft**2 
log_ps = np.log(mgft)
log_mgft= np.log(mgft)

Every second row of the ft consists completely of zeros. Why is this?
Would it be acceptable to add a randomly small number to the signal to avoid this.

signal_time_lon = signal_time_lon + np.random.randint(0,9,size=(730, 182))*1e-05

EDIT: Adding images and clarify meaning

The output of rfft2 still appears to be a complex array. Using fftshift shifts the edges of the image to the centre; I still have a power spectrum regardless. I expect that the reason that I get rows of zeros is that I have re-created the timeseries for each pixel. The ft[0, 0] pixel contains the mean of the signal. So the ft[1, 0] corresponds to a sinusoid with one cycle over the entire signal in the rows of the starting image.

Here are is the starting image using following code:
Starting image

plt.pcolormesh(signal_time_lon); plt.colorbar(); plt.axis('tight')

Here is result using following code:
enter image description here

ft = np.fft.rfft2(signal_time_lon)
mgft = np.abs(ft)   
ps = mgft**2                    
log_ps = np.log1p(mgft)
plt.pcolormesh(log_ps); plt.colorbar(); plt.axis('tight')

It may not be clear in the image but it is only every second row that contains completely zeros. Every tenth pixel (log_ps[10, 0]) is a high value. The other pixels (log_ps[2, 0], log_ps[4, 0] etc) have very low values.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:29:18+00:00Added an answer on May 26, 2026 at 9:29 pm

    Consider the following example:

    In [59]: from scipy import absolute, fft
    
    In [60]: absolute(fft([1,2,3,4]))
    Out[60]: array([ 10.        ,   2.82842712,   2.        ,   2.82842712])
    
    In [61]: absolute(fft([1,2,3,4, 1,2,3,4]))
    Out[61]: 
    array([ 20.        ,   0.        ,   5.65685425,   0.        ,
             4.        ,   0.        ,   5.65685425,   0.        ])
    
    In [62]: absolute(fft([1,2,3,4, 1,2,3,4, 1,2,3,4]))
    Out[62]: 
    array([ 30.        ,   0.        ,   0.        ,   8.48528137,
             0.        ,   0.        ,   6.        ,   0.        ,
             0.        ,   8.48528137,   0.        ,   0.        ])
    

    If X[k] = fft(x), and Y[k] = fft([x x]), then Y[2k] = 2*X[k] for k in {0, 1, ..., N-1} and zero otherwise.

    Therefore, I would look into how your signal_time_lon is being tiled. That may be where the problem lies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I'm trying to replicate YouTube's ability to begin video playback from any part
I am trying to replicate the following formula from Excel in to a C#
I'm trying to replicate a formula from an Excel worksheet onto an ASP page,
i am trying to replicate data between two local database instance http://wiki.apache.org/couchdb/How_to_replicate_a_database As per
Im trying to replicate the following sql in Nhibernate ICriteria SELECT DISTINCT AP.ID FROM
Trying to replicate the docking controls in Visual Studio 2008. My application replays the
Im trying to replicate an effect as seen on http://www.fiat.co.uk/Showroom/#showroom/punto_evo/explore . I have made
I'm trying to replicate a UI like a gcalendar (only the layout not any
I am trying to replicate the text overlay effect that occurs when you mouse
I am trying to replicate TryParse for generic types and thought that TypeDescriptor might

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.