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

fix: use custom type pydantic class to wrap ndarray and avoid validation problem #487

Merged

Conversation

frodehk
Copy link
Contributor

@frodehk frodehk commented May 15, 2024

ECALC-965
fixes #482

Have you remembered and considered?

  • I have remembered to update documentation
  • I have remembered to update manual changelog (docs/docs/changelog/next.md)
  • I have remembered to update migration guide (docs/docs/migration_guides/)
  • I have committed with BREAKING: in footer or ! in header, if breaking
  • I have added tests (if not, comment why)
  • I have used conventional commits syntax (if you squash, make sure that conventional commit is used)
  • I have included the Jira issue ID somewhere in the commit body (ECALC-XXXX)

Why is this pull request needed?

When users are using eCalc directly on CLI, they will be met with a few warnings that will most likely be difficult for them to understand, so we should either handle them or silence them.

What does this pull request change?

The problem is caused by sending numpy.ndarrays directly into pydantic, giving validation problems. Avoiding the problem using custom type PydanticNDArray to wrap numpy.ndarray, and use that type instead of numpy.ndarray directly.

A more long term solution is to return List and Float from core.

Issues related to this change:

https://equinor-ecalc.atlassian.net/browse/ECALC-965?atlOrigin=eyJpIjoiNjUxNmVlMmY4ZWEyNGU5YzhmN2RhM2MyZTY0NGE2OWYiLCJwIjoiaiJ9

@frodehk frodehk self-assigned this May 15, 2024
@frodehk frodehk requested a review from a team as a code owner May 15, 2024 07:27
Copy link
Collaborator

@TeeeJay TeeeJay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! please also make a pathc for 8.15 release :) and make sure you use conventional commit syntax as well as referring correctly to jira issue in commit message :)

@frodehk frodehk merged commit ab2877e into main May 15, 2024
6 checks passed
@frodehk frodehk deleted the ECALC-965-fix-use-custom-type-pydantic-class-to-wrap-ndarray branch May 15, 2024 09:16
frodehk added a commit that referenced this pull request May 15, 2024
…ion problem (#487)

* fix: use custom type pydantic class to wrap ndarray and avoid validation problems

ECALC-965

(cherry picked from commit ab2877e)
frodehk added a commit that referenced this pull request May 15, 2024
…ion problem (#487) (#488)

* fix: use custom type pydantic class to wrap ndarray and avoid validation problems

ECALC-965

(cherry picked from commit ab2877e)
equinor-schen pushed a commit that referenced this pull request Aug 23, 2024
…ion problem (#487)

* fix: use custom type pydantic class to wrap ndarray and avoid validation problems

ECALC-965
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pydantic warnings
2 participants