What settings were you using to make the partial failed case in your previous email? And what were you using in this one? I suppose you could print the area definition out and just paste the result here.
I think a future PR could still improve all of these cases, but yeah you make a good point that the poles would definitely have to be a special case (either move the labels further away or don't label -90/90 at all).
Dave
On 11/6/22 15:12,
lobsiger...@gmail.com wrote:
> Dave,
>
> I found a satpy 0.36.0 with pycoast 1.5.0 on one of my servers that I rarely touch.
> I attach the old behavior which I find is perfect. The image shows that your idea
> of putting labels at the end of lines will not work in many cases (e.g. N-pole).
> I think PR70 should just restore the behavior we had before with refactored code.
>
> Cheers,
> Ernst
>
>
>
dho...@gmail.com schrieb am Sonntag, 6. November 2022 um 19:42:02 UTC+1:
>
> Thanks Ernst,
>
> I came to the same conclusion. You can see my comment in the related PR for the original issue:
>
>
https://github.com/pytroll/pycoast/pull/70 <
https://github.com/pytroll/pycoast/pull/70>
>
> I don't think it would be impossible to fix this, but it should be done in a separate PR, probably after this fix is released.
>
> Dave
>
> On 11/6/22 08:31,
lobsiger...@gmail.com wrote:
> > Dave,
> >
> > without looking at the code (that I probably don't understand anyway) it seems that PyCoast grid labels fail if the
> > defined area_extent[] is not "filled". This will be a problem for a couple of projections like geos, ortho, moll, etc.
> >
> > Thanks for your time to look into this issue.
> >
> > Ernst
> >
> > Attached "partial" image fails with labels, "full" image works.
> >
> >
> >
> >
> >
dho...@gmail.com schrieb am Sonntag, 6. November 2022 um 14:15:46 UTC+1:
> >
> > Nevermind, turns out the existing test_grid_geos test fails in the same way, but it has `write_text=False` in it. I should be able to tweak this and get this fixed and released with minimal time. Still time I don't have, but let me see what I can do.
> >
> > Dave
> >
> > On 11/6/22 06:51, David Hoese wrote:
> > > Hi Ernst,
> > >
> > > Thanks for this. This would be a good thing to have as a bug report, but it may be a simple enough fix that it isn't needed (depending on who gets to fixing it first).
> > >
> > > Here is the old block of code:
> > >
> > >
https://github.com/pytroll/pycoast/blob/42ba82e32251fe48d62af1ebf0ad81d0577d74e4/pycoast/cw_base.py#L360-L386 <
https://github.com/pytroll/pycoast/blob/42ba82e32251fe48d62af1ebf0ad81d0577d74e4/pycoast/cw_base.py#L360-L386> <
https://github.com/pytroll/pycoast/blob/42ba82e32251fe48d62af1ebf0ad81d0577d74e4/pycoast/cw_base.py#L360-L386 <
https://github.com/pytroll/pycoast/blob/42ba82e32251fe48d62af1ebf0ad81d0577d74e4/pycoast/cw_base.py#L360-L386>>
> > >
> > > And the new block of code for the same functionality:
> > >
> > >
https://github.com/pytroll/pycoast/blob/11303e63413d2d3ff2165a076efd4800bb835032/pycoast/cw_base.py#L1650-L1672 <
https://github.com/pytroll/pycoast/blob/11303e63413d2d3ff2165a076efd4800bb835032/pycoast/cw_base.py#L1650-L1672> <
https://github.com/pytroll/pycoast/blob/11303e63413d2d3ff2165a076efd4800bb835032/pycoast/cw_base.py#L1650-L1672 <
https://github.com/pytroll/pycoast/blob/11303e63413d2d3ff2165a076efd4800bb835032/pycoast/cw_base.py#L1650-L1672>>
> > >
> > > My guess is the new code is missing the "continue" check on the index_arrays. I bet that when I was refactoring this I either did this by accident or I thought that the index_arrays length check wasn't needed because the for loop would just not loop if it was empty. The problem, as you have discovered, is that the next portion of code uses the last iteration `index_array` of that for loop. I'm not sure this week is the best week for me to find time for this but the Pytroll Contributor week is coming up so I'll have a much better excuse then. The hard part won't be fixing the bug, but rather creating a unit test that boils the issue down to as simple a case as possible. Your script is pretty close, but it'd be nice if we could go even smaller.
> > >
> > > Dave
> > >
> > > On 11/6/22 04:38,
lobsiger...@gmail.com wrote:
> > >> Hi,
> > >>
> > >> I attach a small script that reproduces the PyCoast 1.6.0 bug. It takes the PIL writer because this has a hard coded default font.
> > >>
> > >> Cheers,
> > >> Ernst
> > >>
> > >>
> > >>
> > >>
lobsiger...@gmail.com schrieb am Samstag, 5. November 2022 um 20:43:51 UTC+1:
> > >>
> > >> Dear Developers,
> > >>
> > >> there is a new problem/bug we didn't have in PyCoast 1.5.0.
> > >> This probably has been caused by PyCoast PR 60 or PR 63.
> > >>
> > >> [PR 60](
https://github.com/pytroll/pycoast/pull/60 <
https://github.com/pytroll/pycoast/pull/60> <
https://github.com/pytroll/pycoast/pull/60 <
https://github.com/pytroll/pycoast/pull/60>> <
https://github.com/pytroll/pycoast/pull/60 <
https://github.com/pytroll/pycoast/pull/60> <
https://github.com/pytroll/pycoast/pull/60 <
https://github.com/pytroll/pycoast/pull/60>>>) - Fix major/minor grid line parameters not working in add_overlay_from_dict
> > >> [PR 63](
https://github.com/pytroll/pycoast/pull/63 <
https://github.com/pytroll/pycoast/pull/63> <
https://github.com/pytroll/pycoast/pull/63 <
https://github.com/pytroll/pycoast/pull/63>> <
https://github.com/pytroll/pycoast/pull/63 <
https://github.com/pytroll/pycoast/pull/63> <
https://github.com/pytroll/pycoast/pull/63 <
https://github.com/pytroll/pycoast/pull/63>>>) - Rewrite and refactor all of pycoast to meet minimum modern standards
> > >>
> > >> My bet it's rather [PR 63], maybe somewhere here:
> > >>
https://github.com/pytroll/pycoast/pull/63/commits/3c6408c7f37eec03b939dd072cda31ef911f64f0 <
https://github.com/pytroll/pycoast/pull/63/commits/3c6408c7f37eec03b939dd072cda31ef911f64f0> <
https://github.com/pytroll/pycoast/pull/63/commits/3c6408c7f37eec03b939dd072cda31ef911f64f0 <
https://github.com/pytroll/pycoast/pull/63/commits/3c6408c7f37eec03b939dd072cda31ef911f64f0>> <
https://github.com/pytroll/pycoast/pull/63/commits/3c6408c7f37eec03b939dd072cda31ef911f64f0 <
https://github.com/pytroll/pycoast/pull/63/commits/3c6408c7f37eec03b939dd072cda31ef911f64f0> <
https://github.com/pytroll/pycoast/pull/63/commits/3c6408c7f37eec03b939dd072cda31ef911f64f0 <
https://github.com/pytroll/pycoast/pull/63/commits/3c6408c7f37eec03b939dd072cda31ef911f64f0>>>
> > >>
> > >>
> > >> If you define a grid with lon/lat labels on a GEO satellite full disc image:
> > >>
> > >> IIRC the old behavior was that you normally just got 0° lat labels left and right
> > >> The new behavior is that such a script ends in error with the following message:
> > >>
> > >> <cite>
> > >> File "c:\Users\nobody\miniconda3\envs\pytroll\lib\site-packages\pycoast\cw_base.py", line 1660, in _draw_major_lines
> > >> index_array,
> > >> UnboundLocalError: local variable 'index_array' referenced before assignment
> > >> </cite>
> > >>
> > >> A current workaround is to set "... , 'write_text': False, ..." in the grid definition dict.
> > >> Label placement with 'lrtb' on full disc images doesn't make too much sense anyway.
> > >>
> > >> See also this thread:
> > >>
> > >>
https://groups.io/g/MSG-1/topic/94599457#33511 <
https://groups.io/g/MSG-1/topic/94599457#33511> <
https://groups.io/g/MSG-1/topic/94599457#33511 <
https://groups.io/g/MSG-1/topic/94599457#33511>> <
https://groups.io/g/MSG-1/topic/94599457#33511 <
https://groups.io/g/MSG-1/topic/94599457#33511> <
https://groups.io/g/MSG-1/topic/94599457#33511 <
https://groups.io/g/MSG-1/topic/94599457#33511>>>
> > >>
> > >>
> > >> Best regards,
> > >> Ernst
> > >>
> > >>
> > >> --
> > >> You received this message because you are subscribed to the Google Groups "pytroll" group.
> > >> To unsubscribe from this group and stop receiving emails from it, send an email to
pytroll+u...@googlegroups.com <mailto:
pytroll+u...@googlegroups.com>.
> > >> To view this discussion on the web, visit
https://groups.google.com/d/msgid/pytroll/d3faf8e9-be5f-4908-a597-8f02b0daaee5n%40googlegroups.com <
https://groups.google.com/d/msgid/pytroll/d3faf8e9-be5f-4908-a597-8f02b0daaee5n%40googlegroups.com> <
https://groups.google.com/d/msgid/pytroll/d3faf8e9-be5f-4908-a597-8f02b0daaee5n%40googlegroups.com <
https://groups.google.com/d/msgid/pytroll/d3faf8e9-be5f-4908-a597-8f02b0daaee5n%40googlegroups.com>> <
https://groups.google.com/d/msgid/pytroll/d3faf8e9-be5f-4908-a597-8f02b0daaee5n%40googlegroups.com?utm_medium=email&utm_source=footer <
https://groups.google.com/d/msgid/pytroll/d3faf8e9-be5f-4908-a597-8f02b0daaee5n%40googlegroups.com?utm_medium=email&utm_source=footer> <
https://groups.google.com/d/msgid/pytroll/d3faf8e9-be5f-4908-a597-8f02b0daaee5n%40googlegroups.com?utm_medium=email&utm_source=footer
> > To view this discussion on the web, visit
https://groups.google.com/d/msgid/pytroll/812db171-8eae-4d8e-8e1b-46a2b87072cdn%40googlegroups.com <
https://groups.google.com/d/msgid/pytroll/812db171-8eae-4d8e-8e1b-46a2b87072cdn%40googlegroups.com> <
https://groups.google.com/d/msgid/pytroll/812db171-8eae-4d8e-8e1b-46a2b87072cdn%40googlegroups.com?utm_medium=email&utm_source=footer <
https://groups.google.com/d/msgid/pytroll/812db171-8eae-4d8e-8e1b-46a2b87072cdn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> To view this discussion on the web, visit
https://groups.google.com/d/msgid/pytroll/f3b6f0a4-2e1b-41e4-a346-0c6e3d4b490bn%40googlegroups.com <
https://groups.google.com/d/msgid/pytroll/f3b6f0a4-2e1b-41e4-a346-0c6e3d4b490bn%40googlegroups.com?utm_medium=email&utm_source=footer>.