home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 650044968

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
650044968 MDExOlB1bGxSZXF1ZXN0NDQzNjEwOTI2 4193 Fix polyfit fail on deficient rank 20629530 closed 0     5 2020-07-02T16:00:21Z 2020-08-20T14:20:43Z 2020-08-20T08:34:45Z CONTRIBUTOR   0 pydata/xarray/pulls/4193
  • [x] Closes #4190
  • [x] Tests added
  • [x] Passes isort -rc . && black . && mypy . && flake8
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [ ] New functions/methods are listed in api.rst

Fixes #4190. In cases where the input matrix had a deficient rank (matrix rank != order) because of the number of NaN values, polyfit would fail, simply because numpy's lstsq returned an empty array for the residuals (instead of a size 1 array). This fixes the problem by catching the case and returning np.nan instead.

The other point in the issue was that RankWarning is also not raised in that case. That was due to the fact that da.polyfit was computing the rank from the coordinate (Vandermonde) matrix, instead of the masked data. Thus, is a given line has too many NaN values, its deficient rank was not detected. I added a test and warning at all places where a rank is computed (5 different lines). Also, to match np.polyfit behaviour of no warning when full=True, I changed the warning filters using a context manager, ignoring the RankWarning in that case. Overall, it feels a bi ugly because of the duplicated code and it will print the warning for every line of an array that has a deficient rank, which can be a lot...

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4193/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 5 rows from issue in issue_comments
Powered by Datasette · Queries took 1.316ms · About: xarray-datasette