Add workaround for broken aggdraw.Font usage in satpy/pycoast #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 aggdrawFont
object to the dask Delayed function. As part of the tokenization of the arguments dask callstype(obj)
on theFont
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.
git diff origin/master **/*py | flake8 --diff
(remove if you did not edit any Python files)CC @peters77