I'm having trouble running 2D Fast Fourier Transforms on a three-dimensional array. They are mathematical in nature and "understand python / zero."
EDIT. To clarify the main questions: How does numpy.fft handle masked arrays? Can I average over the axis, and then do fft and get the same result as doing fft, and then average over the axes that were not involved in fft?
The array consists of the value of the carbon dioxide flow (in units) between the atmosphere and the ocean for each degree of latitude and longitude (in a specific area). The shape of the array (730, 50, 182) corresponds to (time, latitude, longitude). Earth values ββare masked using:
import numpy as np
from numpy import ma
carbon_flux = ma.masked_values(carbon_flux, 1e+20)
I would like to show the variance log of the two-dimensional Fourier transform of a carbon stream averaged over longitude. I average the array along the last axis (longitude) and then do the Fourier transform:
ft_type_1 = np.log(np.abs(np.fft.fft2(ma.mean(cflux, 2)))
This gives me an acceptable result. However, I was told to do averaging first:
ft_type_2 = np.log(np.mean(np.abs(np.fft.fft2(carbon_flux, axes=(0, 1))),axis=2)
This leads to the masked values ββused to calculate fft (I can say that the first fft value is of the order of 10e19).
From what I understand, the result of averaging to fft will be different from averaging after fft. Am I correct in the assumption or does it not matter what order I perform these functions?
Does fft use masked values? Can i avoid this?
, , . , VARIANCE , . fft- , ?
, , , . .