#671 Merged at 46de2b4
  1. Anveshan Lal
  • wms shows img properly now
  • coastlines and ocean color features fixed
  • minor fix and Flake8 errors resolved

Comments (4)

  1. Joern Ungermann

    Cool, WMS maps now work in cylindrical coordinates.

    Some things that need some improvements:

    • The plots are seemingly missing in stereographic projections.
    • unticking “coastlines” in the optios dialogue sometimes still retains country borders and coastlines. E.g. after pressing the “redraw” button. It seems as if only the last of potentially several sets of coastlines is being enabled/disabled?
    • unticking the “draw graticule” in options gives the error
      File "/home/icg173/src/mss/mslib/msui/topview.py", line 297, in settings_dialogue
      File "/home/icg173/src/mss/mslib/msui/mpl_qtwidget.py", line 1153, in set_map_appearance
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 221, in set_graticule_visible
        grid.xlines = False
    UnboundLocalError: local variable 'grid' referenced before assignment
    • Trying out the satellite dockwidget with the test file docs/samples/satellite_tracks/satellite_predictor.txt gives the error
      File "/home/icg173/src/mss/mslib/msui/satellite_dockwidget.py", line 182, in plot_overpass_track
      File "/home/icg173/src/mss/mslib/msui/mpl_qtwidget.py", line 1116, in plot_satellite_overpass
        self.satoverpasspatch = mpl_map.SatelliteOverpassPatch(self.map, segment)
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 697, in __init__
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 705, in draw
        sat[:, 0], sat[:, 1])
    ValueError: too many values to unpack (expected 2)
    • Trying to load the KML sample file gives the error
    2019-07-22 15:20:12,486 (mss_qt.excepthook:175): Fatal error: Traceback (most recent call last):
      File "/home/icg173/src/mss/mslib/msui/kmloverlay_dockwidget.py", line 141, in load_file
        self.cbManualStyle.isChecked(), self.get_color(), self.dsbLineWidth.value())
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 786, in __init__
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 888, in draw
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 854, in parse_placemarks
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 850, in parse_placemarks
        self.parse_geometries(placemark, style, name)
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 843, in parse_geometries
        method(attr, style, name)
      File "/home/icg173/src/mss/mslib/msui/mpl_map.py", line 803, in add_polygon
        x, y = self.compute_xy(getattr(polygon, boundary).LinearRing.coordinates)
    ValueError: too many values to unpack (expected 2)
  2. Joern Ungermann

    With these changes even the countries/coaslines work:

    diff --git a/mslib/msui/mpl_map.py b/mslib/msui/mpl_map.py
    index 4424f88..147820d 100644
    --- a/mslib/msui/mpl_map.py
    +++ b/mslib/msui/mpl_map.py
    @@ -260,7 +260,7 @@ class MapCanvas():
             if visible:
    -            self.map_countries = self.ax.add_feature(cfeature.BORDERS, linestyle='--', alpha=0.5)
    +            #self.map_countries = self.ax.add_feature(cfeature.BORDERS, linestyle='--', alpha=0.5)
             elif not visible:
    @@ -330,7 +330,6 @@ class MapCanvas():
                 ax = self.fig.add_subplot(1, 1, 1, projection=self.kwargs["projection"])
                 self.ax = ax
    -            ax.coastlines()

    The WMS on stereographic doesn’t seem to work, still?

    1. Anveshan Lal author

      Thank you It is working properly now, regarding stereographic projections,I am still working on it, It is returning this error:

      A LinearRing must have at least 3 coordinate tuples

      It is raising the error without traceback to the line it stems from. Can you tell me what would be the way to tackle these type of issues? it stems from shapely module but I don’t see it being imported anyhwere in ui

      1. Joern Ungermann

        That is certainly an internal error of cartopy, which uses shapely. Unless the whole process crashes, there should be more information?

        shapely is certainly imported by cartopy. It uses to my knowledge c-compiled code, which is more difficult to debug. In this case I would investigate the calling code, which can be done in a python debugger like pdb or better in an IDE such as PyCharmed or MSVS Code.

        There was at least one issue with a similar error message that I came up with on google.

        In case that on needs to go deeper, one can attach an actual debugger to python to see what code is being executed on the processor, but this goes beyond your tasks.

        How did you provoke the error? The latest PR “just” doesn’t show an image.

        With respect to the image not being show: I would suspect that the extent is in the wrong coordinates. This seems to work better:

        diff --git a/mslib/msui/mpl_map.py b/mslib/msui/mpl_map.py
        index 4424f88..eb0891f 100644
        @@ -342,7 +341,7 @@ class MapCanvas():
                 ax = self.ax
                 if self.image is not None:
        -        self.image = self.ax.imshow(X, transform=ccrs.PlateCarree(), extent=ax.get_extent(), zorder=2, **kwargs)
        +        self.image = self.ax.imshow(X, transform=ax.projection, extent=ax.get_extent(), zorder=2, **kwargs)
                 return self.image

        But the displayed image doesn’t fit the shown map, i.e. the coastlines disagree.

        One would need to check if the “proper” area and projection is requested.

        I also checked cartopy-MSS with a basemap-MSWMS. However, that must work as well!