Ireland has no coast in omerc_bb

Skip to first unread message

Nov 27, 2020, 3:30:01 AM11/27/20
to pytroll
Dear All

Using omerc_bb I image NOAA-20, Suomi-NPP and FY-3D passes over the U.K. and
every then and when the coast of Ireland is missing. If have never seen that
with other areas like eurol or my custom made areas westminster and isleofman.
If Ireland has no coast then England and Scotland shows no borders and rivers
and Orkney Islands are missing as well. I also have seen an example where I
can make reappear the Irish coast if I image the pass shorter with the same
data (scaled down images attached). This happens here with the latest (coast,
borders, rivers) interface and Satpy 0.22 and 0.24. Christian Peters has shown
that it also occurs with the older interface (coastlines only) and Satpy 0.18.

Devuan GNU/Linux 3.0.0 (Beowulf) on a PC with XEON and 16GB RAM. Any ideas?

Best Regards


Raspaud Martin

Nov 27, 2020, 3:51:38 AM11/27/20
to pytroll
Dear Ernst,

This sounds like a problem in pycoast, as satpy itself can't choose which polygons to draw.

Can you see a relation between the distance from the edge of the area and ireland and the drawing of the coastline? I seem to remember that pycoast doesn't always like map edges...

Best regards,
From: <> on behalf of <>
Sent: 27 November 2020 09:30:01
To: pytroll
Subject: [pytroll] Ireland has no coast in omerc_bb
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<>.
To view this discussion on the web, visit<>.

Nov 28, 2020, 2:03:12 PM11/28/20
to pytroll
Hi Martin,

I had a closer look at a couple of images that have this kind of problem. Apparently pycoast tries to find west and east limits of longitude of the area depicted as well as north and south. These limits are also used to plot the lat/lon grid. As you can see on my image above pycoast sometimes fails on the western side. All coastlines west of the first meridian are not plotted. Coast lines, borders and rivers are shape files that have their lat/lon bounding boxes. If such a bounding box is all west of the first meridian in the grid, no line is plotted. This explains how Ireland, Iceland, Orkney Islands but also rivers in England and Scotland are missing. The problem of finding the longitude limits might be kind of special for area omerc_bb.

Best regards

Nov 30, 2020, 4:41:30 AM11/30/20
to pytroll
Martin and Developers,

An even closer look at the Python code (as far as I understand it) makes me think that the problem is with ".../pycoast/" in the function "def  _get_lon_lat_bounding_box(area_extent, x-size, y_size,  prj)".
It seems to me that this function sometimes fails with omerc_bb. One other hint might be that in the case of failure the first meridian (western border) is always 0°. No coasts, borders, rivers that have bounding boxes
with all negative longitude are then drawn (Ireland, rivers and borders in England and Scotland, Orkney Islands, Iceland, Greenland, ...). That's at least what I see in a dozen examples NOAA-20, Suomi-NPP,  FY-3D here.

Best regards

Dec 1, 2020, 3:05:19 PM12/1/20
to pytroll
Martin and Developers,

here is one more example of Suomi-NPP over the UK. When I make an image with search range 30° (around the POI) I get 12 segment files. With 25° I get 10 and with 20° I get 8 files.
The longer passes with 12 and 10 files have the problem of minimal longitude = 0° for grid and coastlines/borders/rivers. The shorter pass taking only 8 files is O.K.. I also
attach the a link that goes directly to my receiver PC where you'll find the original satellite data and the DEBUG output for all 3 images. It seems the reader wants to read
from longitude_m and latitude_m datasets that do not exist in the compact VIIRS format. In the compact format there are only some lon/lat at tie points (probably named
G-Ring_Longitude or G-Ring_Latitude, that's what I found with h5dump ??!! ). Looking at the compact reader source it seems to me that this should be taken care of??!!

Please have a look at the satellite data and/or tell me what further experiments I should do to help nailing down the cause of this nasty problem.

Best regards,

Mar 17, 2022, 10:27:18 AMMar 17
to pytroll
Dear Martin,
Dear All,

I further nailed down the problem of omerc_bb sometimes not showing the coastlines of Ireland and no grid lines for lon < 0°. As I suspected long ago it's pycoast function  _get_lon_lat_bounding_box()  where the trouble starts. As a matter of fact the problem has nothing to do with omerc_bb but shows up in other projections as well. Here is the explanation:

For area_extents not including a pole  _get_lon_lat_bounding_box()  tries to detect, whether the left or right side of the area_extent crosses the dateline lon=+/-180°. Unfortunately the 0° meridian is also wrongly identified as dateline. This has the simple effect that if the 0° meridian crosses the left side of the area_extent, then shapes west of 0° are essentially suppressed (considered "irrelevant"). For the same reason if the 0° meridian crosses the right side of the area_extent then shapes (entirely) east of 0° are suppresses. The Eurasia polygon is not affected as it's bounding box spans over the 0° meridian. If you image LEOs passing over London with omerc_bb then every then and when in the birds repeat cicle (also depending on the number of data segments you plot) the problem will show up at the left side of the area_extent and Ireland and Iceland have no coastlines and no grid lines.

I attach a simple test script that works with eight critical tmerc and stere areas in lon2.yaml. I also attach a Git patch that fixes the problem. Maybe there are more elegant or robust ways to differentiate between 0° meridian and dateline. But so far the patch works for me.

Best Regards,
Reply all
Reply to author
0 new messages