-
Notifications
You must be signed in to change notification settings - Fork 13
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 model validator for pyaro config and ColocatedData #1358
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main-dev #1358 +/- ##
=========================================
Coverage 78.83% 78.84%
=========================================
Files 136 136
Lines 20788 20790 +2
=========================================
+ Hits 16389 16392 +3
+ Misses 4399 4398 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
"Invalid data filepath str, must point to a .nc file" | ||
) | ||
if not self.data.endswith("nc"): | ||
raise ValueError("Invalid data filepath str, must point to a .nc file") | ||
self.open(self.data) | ||
elif isinstance(self.data, xr.DataArray): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these can be flipped to reduce nesting: if isinstance(ndarray) -> make_DataArray; then ensure_correct_dimensions.
This would also simplify ensure_correct_dimensions to not have to handle ndarray
"Invalid data filepath str, must point to a .nc file" | ||
) | ||
if not self.data.endswith("nc"): | ||
raise ValueError("Invalid data filepath str, must point to a .nc file") | ||
self.open(self.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is currently not clear that read files are dimension validated without going two function calls deep, which makes this look like a bug without being one. Maybe it can be made clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Change Summary
Fix the pyaro config model validator, which had been raising warning and was never really implemented correctly before. Also fix the
ColocatedData
model_validatorRelated issue number
Close #1349
Checklist