cassidymwagner / fluidsf

FluidSF is a package used to calculate structure functions from fluid data.
https://cassidymwagner.github.io/fluidsf
MIT License
5 stars 3 forks source link

Fix for latlon grid cases #29

Closed cassidymwagner closed 3 months ago

cassidymwagner commented 3 months ago

This PR aims to improve latlon grid support.

It's been challenging to test this. So far I've tried to reproduce the linear 2D example to show scaling with $r^2$ and $r^3$. It seems to match relatively well if I set the latitude and longitude arrays to vary from 0 to 1m, similar to the 0 to 1 code units range in the original example. But if I use a larger range of lats/lons, the amplitudes change a lot. Each SF still scales with $r^2$ and $r^3$ as before, but the factors are different, especially for the advective SF which becomes much smaller with a larger range of lats/lons. I expect that this is because of the advection/gradient calculation since dx/dy is now much larger (keeping nx/ny the same). Find the example notebook here, relevant figure below.

I've also included two new examples

Note: this branch was originally created from #23 so this PR will just update that branch/PR instead of main directly.

Screenshot 2024-07-29 at 6 05 56 PM