k_arr2d

kgpy.fft.freq.k_arr2d(nx, ny, dx=1.0, dy=1.0, radians=False)

This is a port of CCK’s k_arr2d.pro to Python 3. Ported by NCG, 2020-07-30

Generate an array of wavenumber values (by default, in units of cycles per sample interval), arranged corresponding to the FFT of an nx by ny-element array.

Note: This is similar, but not identical, to using the helper function scipy.fft.fftfreq twice to generate arrays of frequencies. The main difference is that scipy.fft.fftfreq is limited to one dimension, and does not have the keyword argument to convert between radians snd cycles. -NCG

Parameters:
  • nx (int) – size of array in x-dimension (axis 0)

  • ny (int) – size of array in y-dimension (axis 1)

  • dx (float) – sample interval. If included, k will be converted to units of cycles (or radians, see radian keyword) per unit distance (or time), corresponding to the units of dx.

  • dy (float) – sample interval. If included, k will be converted to units of cycles (or radians, see radian keyword) per unit distance (or time), corresponding to the units of dy.

  • radians (bool) –

Returns:

k: kx, an array of horizontal wave numbers; ky: an array of vertical wavenumbers; big_kx, big_ky: nx by ny arrays of horizontal vertical wavenumbers, a meshgrid.