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

Add workaround for broken aggdraw.Font usage in satpy/pycoast #68

Merged
merged 4 commits into from
Jun 3, 2020

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented May 26, 2020

This addresses the pytroll/pycoast#43 issue. In summary, Satpy tried to delay calls to pycoast by using the apply_pil method on trollimage's XRImage class. In some use cases this could involve passing an aggdraw Font object to the dask Delayed function. As part of the tokenization of the arguments dask calls type(obj) on the Font object which causes a segmentation fault because aggdraw.Font objects are not normal python types.

The solution in this PR is a complete hack, but works. The long term solution is to fix aggdraws classes but that is a huge problem to solve. Another solution would be to update pycoast to pass the individual components of a font (path, color, size, opacity) but that is also a pretty huge task (easier than aggdraw) if it is done right. This solution, essentially an if statement, should be removed when a better version of aggdraw is available.

  • Tests added (for all bug fixes or enhancements)
  • Tests passed (for all non-documentation changes)
  • Passes git diff origin/master **/*py | flake8 --diff (remove if you did not edit any Python files)

CC @peters77

@djhoese djhoese added the bug label May 26, 2020
@djhoese djhoese requested a review from mraspaud May 26, 2020 21:24
@djhoese djhoese self-assigned this May 26, 2020
@coveralls
Copy link

coveralls commented May 26, 2020

Coverage Status

Coverage increased (+0.09%) to 90.83% when pulling 120d5ce on djhoese:bugfix-aggdraw-font into 50d3262 on pytroll:master.

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

Successfully merging this pull request may close these issues.

None yet

2 participants