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

[Feature]: Improve create_grid function #496

Closed
jasonb5 opened this issue Jun 6, 2023 · 0 comments · Fixed by #507
Closed

[Feature]: Improve create_grid function #496

jasonb5 opened this issue Jun 6, 2023 · 0 comments · Fixed by #507
Assignees
Labels
type: enhancement New enhancement request

Comments

@jasonb5
Copy link
Collaborator

jasonb5 commented Jun 6, 2023

Is your feature request related to a problem?

The create_grid arguments are not descriptive due to the use of **kwargs,

Describe the solution you'd like

Update create_grid function to def create_grid(x: Optional[Union[xr.DataArray, Tuple[xr.DataArray, xr.DataArray]]] = None, y: Optional[Union[xr.DataArray, Tuple[xr.DataArray, xr.DataArray]]] = None, z: Optional[Union[xr.DataArray, Tuple[xr.DataArray, xr.DataArray]]] = None, attrs: Optional[Dict[str, str]] = None) -> xr.Dataset.

Users can now explicitly define x, y, and z dimensions when creating a grid.

attrs will be grid attributes, we should consider if there are any defaults we want.

Add create_axis function, def create_axis(name: str, data: Union[List[Union[int, float]], np.ndarray], bounds: Optional[Union[List[List[Union[int, float]]], np.ndarray]] = None, attrs: Dict[str, str]) -> Tuple[xr.DataArray, Optional[xr.DataArray]]

attrs will be merged into the default attributes where the defaults take precedence.

If bounds is not passed should we automatically generate them? Otherwise we could add a generate_bounds argument to trigger the generation.

Describe alternatives you've considered

def create_grid(x: GridCoord, y: GridCoord, z: GridCoord) -> xr.Dataset:

Where GridCoord could be any of the following forms.

(name, data)
(name, data, attrs)
(name, data, bnds)
(name, data, bnds, attrs)

The data and bnds options can be List or np.ndarray.

Additional context

Previous discussion #388 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New enhancement request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant