Skip to content

Improve error messages from Python embedding to reflect type of embedding used #1473

@DanielAdriaansen

Description

@DanielAdriaansen

Describe the Enhancement

In the dataplane_from_xarray class, there is this comment:
// we just grab the numpy array and the attributes dictionary
// from the xarray DataArray object, and then hand them
// off to dataplane_from_numpy_array

It would be nice if the errors returned from dataplane_from_numpy_array acknowledged which type of object (NUMPY or XARRAY) the user requested. For example, I was using PYTHON_XARRAY but I received the following error message:

ERROR : dataplane_from_numpy_array() -> numpy array is not 2-dimensional! ... (dim = 3)

I realize we are re-using code to avoid having to duplicate the dataplane_from_numpy functionality for Xarray but we may be able to either:

  1. refactor the method dataplane_from_numpy_array to be more generic (dataplane_from_python_object, etc...) and simply refer to the numpy array as "data array"
  2. Develop specific function and error message naming for each type of Python embedding support (NUMPY, XARRAY) so that errors can be reported to the user that acknowledge and align with the type of embedding the user requested

Time Estimate

4 hours

Relevant Deadlines

NONE

Funding Source

2790541

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required
  • Select scientist(s) or no scientist required

Labels

  • Select component(s)
  • Select priority
  • Select requestor(s)

Projects and Milestone

  • Review projects and select relevant Repository and Organization ones
  • Select milestone

Define Related Issue(s)

Consider the impact to the other METplus components.

Enhancement Checklist

See the METplus Workflow for details.

  • Complete the issue definition above.
  • Fork this repository or create a branch of develop.
    Branch name: feature_<Issue Number>_<Description>
  • Complete the development and test your changes.
  • Add/update unit tests.
  • Add/update documentation.
  • Push local changes to GitHub.
  • Submit a pull request to merge into develop and link the pull request to this issue..
    Pull request: feature <Issue Number> <Description>
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Close this issue.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions