bmi icon indicating copy to clipboard operation
bmi copied to clipboard

Handle geospatial data in the BMI

Open mdpiper opened this issue 4 years ago • 5 comments

The BMI should handle data with a coordinate reference system (CRS), allowing such data to be exchanged between models with a BMI. The BMI should handle geospatial data in the form of vectors (points, lines, polygons) and raster grids.

mdpiper avatar Feb 17 '21 02:02 mdpiper

Link to #11, which has a similar request.

mdpiper avatar Mar 17 '21 20:03 mdpiper

A suggestion for a new BMI function (in SIDL):

int get_grid_projection(in int grid, out string name);

where the output is a string with projection information in a standard format.

Note that the BMI doesn't specify which standard to use for the output; that's left to the implementation. We can, however, make recommendations; e.g., OGC Well-Known Text (WKT) representation of coordinate reference systems, or whatever xarray handles.

A return string of "" or "none" (but not the UDUNITS "1", which could be taken as an EPSG code) could indicate no projection information.

mdpiper avatar Mar 17 '21 21:03 mdpiper

We also need a function (or functions) to specify the units of the grid in the CRS. Suggestions:

int get_grid_units(in int grid, out string units);

or, to be careful:

int get_grid_x_units(in int grid, out string units);
int get_grid_y_units(in int grid, out string units);
int get_grid_z_units(in int grid, out string units);

The return is a string; e.g., "meters", "m", "degrees", "deg".

We can recommend UDUNITS strings, like we do for variables and time.

mdpiper avatar Mar 17 '21 22:03 mdpiper

We should also have an example that demonstrates this new functionality.

The current sample implementations wouldn't use the new functionality, since they're just models of heat diffusion on a plate. And I assert that they should be left as-is, since they're simple and generic, by design.

A candidate: @gantian127's SoilGrids data component could be modified. This wouldn't change the API or CLI of the component, but it would change the BMI, using the new functions to wrap the CRS information input through the API or CLI. We could then refer to this as the official sample implementation of the new functions.

mdpiper avatar Mar 18 '21 20:03 mdpiper

For reference, Data Carpentry has a short, useful lesson on CRS.

mdpiper avatar Mar 17 '22 21:03 mdpiper