jejjohnson / oceanbench

OceanBench - SSH edition
https://jejjohnson.github.io/oceanbench/
MIT License
16 stars 2 forks source link

Functions for Derived Variables #18

Closed jejjohnson closed 1 year ago

jejjohnson commented 1 year ago

We want the functionality to calculate all relevant derived variables that are necessary for post analysis work.


Motivation

We will have a lot of post analysis stuff when we try to compare our predictions with the reference fields. Most of the analysis is in the derived variables, e.g. U,V, kinetic energy, potential vorticity. And most of these variables pertain to the types of PDEs we are interested for the Ocean, e.g. Quasi-Geostrophic Eqns, Shallow Water Eqns, and Navier-Stokes. All of the derived quantities will be in xr.Dataset format. We will need the work from #17 which will have all of the differential operators.

Note: There is a lot of overlap between this ticket and #17 . We may want to just skip ahead to this step directly and ignore the differential operators.


Demo API

As usual, we will have a functional method that operates on np.ndarray and a convenience wrapper that does everything though xr.Datasets.

ds = load_dataset()

# functional calculation
ssh: np.ndarray = ds.ssh.values
lat: np.ndarray = ds.coords.lat.values
g: = 9.81
LR: = 2.7
f: Union[float, np.ndarray] = coriolis_param(lat)
psi: np.ndarray = stream_function(ssh, g, f, LR)

# convenience wrapper
g: = 9.81
LR: = 2.7
ds = calculate_streamfunction(ds, g, LR)

Note: I don't think the functional API is as important.


Derived Variables

jejjohnson commented 1 year ago

Closing due to #17 #36