bmi icon indicating copy to clipboard operation
bmi copied to clipboard

Add support for geospatial data

Open mdpiper opened this issue 2 years ago • 2 comments

This PR adds four new functions that, together, allow a user to represent geospatial data in a BMI:

  • get_grid_coordinate_names
  • get_grid_coordinate_units
  • get_grid_coordinate
  • get_grid_crs

The changes in this PR are part of the BMI 2.1 Milestone. The BMI version has been incremented to v2.1-beta.

A summary of each function, and the problem it addresses, is given below.

get_grid_coordinate_names

This function supports the get_grid_coordinate function, described below, allowing coordinates to be named something other than x, y, and z (e.g., lon and lat for geographic data). The function is patterned on the existing get_input_var_names function: given a grid identifier, the function returns a 1D string array of coordinate names.

This resolves #90.

get_grid_coordinate_units

This function gets the units of a grid coordinate; e.g., a projected CRS may use meters for spatial coordinates. The function is patterned on the existing get_var_units function: given a grid identifier and a coordinate name from get_grid_coordinate_names, return the units of the coordinate as a string.

This resolves #87. See https://github.com/csdms/bmi/issues/90#issuecomment-985059735 for some discussion on this new function.

get_grid_coordinate

This function is patterned on, and supersedes, the get_grid_[xyz] functions. Given a grid identifier and a coordinate name (like "x"), this function gets a 1D array of locations for the coordinate. Put another way, given "x", this function replicates the behavior of get_grid_x.

The get_grid_[xyz] functions have been marked as deprecated in the documentation.

This resolves #88.

get_grid_crs

This is the primary function of this PR, and also the simplest. Given a grid identifier, return a string with coordinate reference system (CRS) information. The BMI does not stipulate the format of the CRS information. See the documentation for this function for more information and a brief example.

Resolves #80, resolves #11.

mdpiper avatar Mar 17 '22 20:03 mdpiper

@gregtucker This PR addresses the geospatial BMI task from CSDMS 3.

mdpiper avatar Mar 17 '22 20:03 mdpiper

The docs for the branch are active: https://bmi.readthedocs.io/en/mdpiper-get-grid-projection/

mdpiper avatar Mar 17 '22 21:03 mdpiper