csdms / bmi

The Basic Model Interface is a standardized set of functions allowing coupling of models to models and models to data
https://bmi.readthedocs.io
MIT License
49 stars 17 forks source link

Support grids of rank > 3 #88

Open mdpiper opened 2 years ago

mdpiper commented 2 years ago

Currently, to obtain the nodes of rectilinear, structured quadrilateral, and unstructured grids, the BMI has functions

int get_grid_x(in int grid, in array<double, 1> x);
int get_grid_y(in int grid, in array<double, 1> y);
int get_grid_z(in int grid, in array<double, 1> z);

representing grids of up to three dimensions.

The BMI should also support grids of these types with rank greater than three.

mdpiper commented 2 years ago

A recent use case: when writing the ERA5 data component, @gantian127 found that the dataset uses 5 dimensions: three spatial + time + an ensemble number.

mdpiper commented 2 years ago

In https://github.com/csdms/bmi/issues/87#issuecomment-961404327, @mcflugen suggests

int get_grid_node_coordinates(in int grid, in int dim, in array<double, 1> coordinates)

Building on this. we could swap the dim parameter for a name parameter, which might be more readable (e.g., name = "x" or name = "x1" for the first coordinate dimension).

mdpiper commented 2 years ago

If we make a new function (or functions), it may break backward compatibility with BMI 2.