cloudsci / cloudmetrics

Toolkit for computing 15+ metrics characterising 2D cloud patterns
16 stars 8 forks source link

Make spectral metrics operate on `scalar_field` #58

Open martinjanssens opened 2 years ago

martinjanssens commented 2 years ago

I'd suggest we leave this for the next release, but I remembered we're still computing the spectral metrics following the original refactoring, which has the individual spectral metrics requiring a spectrum as input, which must first be computed, e.g.:

wavenumbers, psd_1d_radial, psd_1d_azimuthal = scalar.compute_spectra(scalar_field,...)
spectral_length_moment = scalar.spectral_length_moment(wavenumbers, psd_1d_radial)

I imagine we eventually would want to make this consistent with the rest of the interface, i.e.

spectral_length_moment = scalar.spectral_length_moment(scalar_field,...)

which would require us doing some internal caching like we do for the object metrics, to avoid having to recompute the spectra for every metric you want to compute (see also discussion in #30).

For the release, I've added a few notes on how to compute the spectral metrics with our current setup in the README (under #51).

leifdenby commented 2 years ago

imagine we eventually would want to make this consistent with the rest of the interface, i.e.

spectral_length_moment = scalar.spectral_length_moment(scalar_field,...)

Agreed! Good to make a note of this for the next release