Open simonbyrne opened 3 years ago
We have code for this. It's just a matter of adapting it, e.g., for sphere (https://github.com/CliMA/ClimateMachine.jl/blob/9503cbc83eb098f0d92bef72745a1d214175940c/src/Diagnostics/atmos_gcm_spectra.jl) and for box (https://github.com/CliMA/ClimateMachine.jl/blob/9503cbc83eb098f0d92bef72745a1d214175940c/src/Common/Spectra/power_spectrum_les.jl).
I think the biggest issue with adapting the code is just getting pulling out the components of the field vector and copying them into Array
's as we don't support direct indexing on Fields
.
That should be straightforward but we need to add Array copy constructors for Field
s. you can also call (parent(field)
) to get an array that is indexable for people who are implementing this.
The easiest way to do this is to probably interpolate to a regular grid (using the same approach we use for plotting), then take the FFT.