Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to get names of grid node coordinates #90

Open
mdpiper opened this issue Nov 12, 2021 · 6 comments · May be fixed by #99
Open

Add function to get names of grid node coordinates #90

mdpiper opened this issue Nov 12, 2021 · 6 comments · May be fixed by #99
Milestone

Comments

@mdpiper
Copy link
Member

mdpiper commented Nov 12, 2021

To help address #87 and #88, the BMI should have a function to return the names of the dimensions node coordinates of a grid.

@mdpiper
Copy link
Member Author

mdpiper commented Nov 12, 2021

In BMI 2.0, we implicitly assume grid dimensions are named x, y, and z. Not only may this be a misnomer (what if the model uses natural coordinates or geographic coordinates or sigma coordinates?) but when BMI is extended to more than three dimensions (#88), what will the additional dimensions be named?

By adding a new function to the BMI, we'll allow a model developer to explicitly name the dimensions of a model grid; e.g., s, t, n, or lon, lat, sigma.

@mdpiper
Copy link
Member Author

mdpiper commented Nov 12, 2021

The new function would provide the name parameter of the suggested get_grid_units function in #87 and get_grid_node_coordinates function in #88.

@mdpiper
Copy link
Member Author

mdpiper commented Nov 12, 2021

One possibility for this function, suggested here, is:

int get_grid_dimension_names(in int grid, out array<string, 1> names);

It could return ["x", "y", "z"] or ["x1", "x2", "x3"] or N names for grids with N dimensions.

This function name is kinda clumsy, though.

@mdpiper mdpiper added this to the BMI 3.0 milestone Nov 12, 2021
@hrajagers
Copy link
Collaborator

hrajagers commented Nov 16, 2021 via email

@mcflugen
Copy link
Member

mcflugen commented Dec 2, 2021

Thanks very much for your input @hrajagers! 🎉

I agree, when talking about a grid’s dimensions with respect to the spatial positions of its nodes, we should use coordinates rather than dimensions.

The following potential functions—much like the get_input_var_names and get_output_var_names—could return the names of each coordinate of a grid (e.g. x, y, etc.),

int get_grid_coordinate_count(in int grid, out int n_coordinates);
int get_grid_coordinates(in int grid, out array<string, 1> names);

Following on this, to get the units of a grid coordinate and its value at each grid node, we could have,

int get_grid_coordinate_units(in int grid, in string coordinate, out string units);
int get_grid_node_coordinate(in int grid, in string coordinate, out array<double> values);

where the coordinate argument would be one of the strings obtained from get_grid_coordinates.

Although they don’t strictly have to be, we intended for BMI grids to be spatial. In the case of time, BMI treats time specially through the update methods and the get_time functions. For a client to get a value of a quantity at a specific time, it would need to update the model to that time and then make a get_values call. An implementer can, however, extend the grid concept to non-spatial coordinates if they wish—get_grid_coordinates could return, for example, time, station_id, ensemble_number, etc.—but frameworks that try to interpret these sorts of grids could get confused, particularly when trying to map between model grids. For non-spatial dimensions we recommend those quantities be passed as separate quantities through get_values functions—that is, something like

get_values("grid_node__station_id", ids);

@mdpiper mdpiper changed the title Add function to get names of grid dimensions Add function to get names of grid node coordinates Dec 15, 2021
@mdpiper
Copy link
Member Author

mdpiper commented Dec 15, 2021

I updated the title and description based on the comments from @hrajagers and @mcflugen.

@mdpiper mdpiper linked a pull request Mar 17, 2022 that will close this issue
@mdpiper mdpiper modified the milestones: BMI 3.0, BMI 2.2 Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants