def basemapper():

    t = time.time()

    layout_map = tiles.QuadtreeTiles()
    fig = plt.figure(figsize=(12, 9))
    # Create a GeoAxes in the tile's projection.
    ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
    # Limit the extent of the map to a small longitude/latitude range.
    ax.set_extent([bbox[0], bbox[2], bbox[1], bbox[3]], crs=ccrs.PlateCarree())
    # Add the Stamen data at zoom level 8.
    ax.add_image(layout_map, 10)

    gl = ax.gridlines(crs=ccrs.PlateCarree(),
                      draw_labels=True,
                      linewidth=2,
                      color='gray',
                      alpha=1,
                      linestyle='--')
    gl.xlabels_top = False
    gl.ylabels_right = False
    gl.xformatter = LONGITUDE_FORMATTER
    gl.yformatter = LATITUDE_FORMATTER

    if str_switch:
        print("Basemapper plotter elapsed time: %.2f s" % (time.time() - t))

    return fig, ax
Ejemplo n.º 2
0
def test_web_tiles():
    extent = [-15, 0.1, 50, 60]
    target_domain = sgeom.Polygon([[extent[0], extent[1]],
                                   [extent[2], extent[1]],
                                   [extent[2], extent[3]],
                                   [extent[0], extent[3]],
                                   [extent[0], extent[1]]])
    map_prj = cimgt.GoogleTiles().crs

    ax = plt.subplot(3, 2, 1, projection=map_prj)
    gt = cimgt.GoogleTiles()
    gt._image_url = types.MethodType(ctest_tiles.GOOGLE_IMAGE_URL_REPLACEMENT,
                                     gt)
    img, extent, origin = gt.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=gt.crs,
              interpolation='bilinear',
              origin=origin)
    ax.coastlines(color='white')

    ax = plt.subplot(3, 2, 2, projection=map_prj)
    qt = cimgt.QuadtreeTiles()
    img, extent, origin = qt.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=qt.crs,
              interpolation='bilinear',
              origin=origin)
    ax.coastlines(color='white')

    ax = plt.subplot(3, 2, 3, projection=map_prj)
    mq_osm = cimgt.MapQuestOSM()
    img, extent, origin = mq_osm.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=mq_osm.crs,
              interpolation='bilinear',
              origin=origin)
    ax.coastlines()

    ax = plt.subplot(3, 2, 4, projection=map_prj)
    mq_oa = cimgt.MapQuestOpenAerial()
    img, extent, origin = mq_oa.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=mq_oa.crs,
              interpolation='bilinear',
              origin=origin)
    ax.coastlines()

    ax = plt.subplot(3, 2, 5, projection=map_prj)
    osm = cimgt.OSM()
    img, extent, origin = osm.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=osm.crs,
              interpolation='bilinear',
              origin=origin)
    ax.coastlines()
Ejemplo n.º 3
0
def basemapper(crd, res):

    bbox = g16.site_info(crd, res)

    layout_map = tiles.QuadtreeTiles()
    fig = plt.figure(figsize=(12, 9))
    # Create a GeoAxes in the tile's projection.
    ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
    # Limit the extent of the map to a small longitude/latitude range.
    ax.set_extent([bbox[0], bbox[2], bbox[1], bbox[3]], crs=ccrs.PlateCarree())

    # # Add the satellite background data at zoom level 12.
    ax.add_image(sat_img, 12)

    gl = ax.gridlines(crs=ccrs.PlateCarree(),
                      draw_labels=True,
                      linewidth=0,
                      color='gray',
                      alpha=1,
                      linestyle='--')
    gl.xlabels_top = False
    gl.ylabels_right = False
    # gl.xformatter = LONGITUDE_FORMATTER
    # gl.yformatter = LATITUDE_FORMATTER

    return fig, ax
Ejemplo n.º 4
0
def test_web_tiles():
    extent = [-15, 0.1, 50, 60]
    target_domain = shapely.geometry.Polygon([[extent[0], extent[1]],
                                              [extent[2], extent[1]],
                                              [extent[2], extent[3]],
                                              [extent[0], extent[3]],
                                              [extent[0], extent[1]]])

    ax = plt.subplot(3, 2, 1, projection=ccrs.Mercator())
    gt = cimgt.GoogleTiles()
    img, extent, origin = gt.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=ccrs.Mercator(),
              interpolation='bilinear',
              origin=origin)
    ax.coastlines(color='white')

    ax = plt.subplot(3, 2, 2, projection=ccrs.Mercator())
    qt = cimgt.QuadtreeTiles()
    img, extent, origin = qt.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=ccrs.Mercator(),
              interpolation='bilinear',
              origin=origin)
    ax.coastlines(color='white')

    ax = plt.subplot(3, 2, 3, projection=ccrs.Mercator())
    mq_osm = cimgt.MapQuestOSM()
    img, extent, origin = mq_osm.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=ccrs.Mercator(),
              interpolation='bilinear',
              origin=origin)
    ax.coastlines()

    ax = plt.subplot(3, 2, 4, projection=ccrs.Mercator())
    mq_oa = cimgt.MapQuestOpenAerial()
    img, extent, origin = mq_oa.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=ccrs.Mercator(),
              interpolation='bilinear',
              origin=origin)
    ax.coastlines()

    ax = plt.subplot(3, 2, 5, projection=ccrs.Mercator())
    osm = cimgt.OSM()
    img, extent, origin = osm.image_for_domain(target_domain, 1)
    ax.imshow(np.array(img),
              extent=extent,
              transform=ccrs.Mercator(),
              interpolation='bilinear',
              origin=origin)
    ax.coastlines()
Ejemplo n.º 5
0
    def makeMap(self):
        pl.figure(figsize=(16.53, 11.69))

        x = numpy.asarray([m[0] for m in self.coords if m])
        y = numpy.asarray([m[1] for m in self.coords if m])

        # request = cimgt.GoogleTiles(style='street')
        # request = cimgt.Stamen('watercolor')
        request = cimgt.QuadtreeTiles()

        ax = pl.axes(projection=request.crs)
        ax.add_image(request, self.tiledepth)

        xynps = ax.projection.transform_points(ccrs.Geodetic(), x, y)
        m = ax.hist2d(
            xynps[:, 0],
            xynps[:, 1],
            bins=[self.xbins, self.ybins],
            alpha=0.5,
            cmap=pl.cm.jet,
            cmin=1,
        )
        cbar = pl.colorbar(m[3], ax=ax, shrink=0.4, format="%.1f")
        # pl.scatter(xynps[:,0], xynps[:,1], s=50, c="yellow", marker='o')

        units = self.getUnits()
        unps = ax.projection.transform_points(ccrs.Geodetic(),
                                              units[:, 1].astype(float),
                                              units[:, 0].astype(float))
        pl.scatter(unps[:, 0], unps[:, 1], s=30, c=units[:, 2], marker='D')
        # pl.scatter(unps[:, 0], unps[:, 1], s=100, c="purple", marker="D")

        # ax.set_extent([51.526760, 51.454065, -2.698467, -2.564378])
        pl.margins(0.5)

        # pl.show()
        pl.savefig(
            "figure.pdf",
            orientation="landscape",
            # papertype="a3",
            format="pdf",
            dpi=600,
            bbox_inches="tight",
        )
Ejemplo n.º 6
0
def test_quadtree_wts():
    qt = cimgt.QuadtreeTiles()

    extent = [-15, 0.1, 50, 60]
    target_domain = shapely.geometry.Polygon([[extent[0], extent[1]],
                                              [extent[2], extent[1]],
                                              [extent[2], extent[3]],
                                              [extent[0], extent[3]],
                                              [extent[0], extent[1]]])

    with assert_raises(ValueError):
        list(qt.find_images(target_domain, 0))

    assert_equal(qt.tms_to_quadkey((1, 1, 1)), '1')
    assert_equal(qt.quadkey_to_tms('1'), (1, 1, 1))

    assert_equal(qt.tms_to_quadkey((8, 9, 4)), '1220')
    assert_equal(qt.quadkey_to_tms('1220'), (8, 9, 4))

    assert_equal(tuple(qt.find_images(target_domain, 1)), ('0', '1'))
    assert_equal(tuple(qt.find_images(target_domain, 2)), ('03', '12'))

    assert_equal(list(qt.subtiles('0')), ['00', '01', '02', '03'])
    assert_equal(list(qt.subtiles('11')), ['110', '111', '112', '113'])

    with assert_raises(ValueError):
        qt.tileextent('4')

    assert_arr_almost(qt.tileextent(''),
                      (-180.0, 180.0, 179.02740096, -179.02740096))
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((2, 0, 2), google=True)),
                      (0.0, 90.0, 179.02740096, 89.51370048))
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((0, 2, 2), google=True)),
                      (-180.0, -90.0, 5.68434189e-14, -8.95137005e+01))
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((0, 1, 2), google=True)),
                      (-180.0, -90.0, 8.95137005e+01, 5.68434189e-14))
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((2, 2, 2), google=True)),
                      (0.0, 90.0, 5.68434189e-14, -8.95137005e+01))
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((8, 9, 4), google=True)),
                      (0.0, 22.5, -22.37842512, -44.75685024))
Ejemplo n.º 7
0
def plot_map(longitude_lim, latitude_lim, map_quality=11):
    """
    Plot map.

    Parameters
    ----------
    longitude_lim : list(2)

    latitude_lim : list(2)

    map_quality : int
        Map rendering quality.
        6 is very bad, 10 is ok, 12 is good, 13 is very good, 14 excellent.

    """
    # Map extent
    eps = 0*0.01
    extent = [longitude_lim[0] - eps, longitude_lim[1] + eps,
              latitude_lim[0] - eps, latitude_lim[1] + eps]
    # Plot map of Stockholm
    map_design = 'StamenTerrain'
    if map_design == 'GoogleTiles':
        request = cimgt.GoogleTiles()
    elif map_design == 'QuadtreeTiles':
        request = cimgt.QuadtreeTiles()
    elif map_design == 'StamenTerrain':
        request = cimgt.Stamen('terrain-background')
    else:
        # Map designs 'OSM' and 'MapboxTiles' do not work
        raise Exception('Untested map design')
    ax = plt.axes(projection=request.crs)
    gl = ax.gridlines(draw_labels=True, alpha=0., linewidth=0, linestyle='-')
    gl.top_labels = False
    gl.right_labels = False
    gl.xformatter = LONGITUDE_FORMATTER
    gl.yformatter = LATITUDE_FORMATTER
    gl.xlabel_style = {'size': 10, 'color': 'black'}
    gl.ylabel_style = {'size': 10, 'color': 'black', 'weight': 'normal'}
    ax.set_extent(extent)
    ax.add_image(request, map_quality)
Ejemplo n.º 8
0
def test_quadtree_wts():
    qt = cimgt.QuadtreeTiles()

    extent = [-15, 00, 50, 60]
    target_domain = shapely.geometry.Polygon([[extent[0], extent[1]],
                                              [extent[2], extent[1]],
                                              [extent[2], extent[3]],
                                              [extent[0], extent[3]],
                                              [extent[0], extent[1]]])

    with assert_raises(ValueError):
        list(qt.find_images(target_domain, 0))

    assert_equal(qt.tms_to_quadkey((1, 1, 1)), '1')
    assert_equal(qt.quadkey_to_tms('1'), (1, 1, 1))

    assert_equal(qt.tms_to_quadkey((8, 9, 4)), '1220')
    assert_equal(qt.quadkey_to_tms('1220'), (8, 9, 4))

    assert_equal(tuple(qt.find_images(target_domain, 1)), ('0', '1'))
    assert_equal(tuple(qt.find_images(target_domain, 2)), ('03', '12'))

    assert_equal(list(qt.subtiles('0')), ['00', '01', '02', '03'])
    assert_equal(list(qt.subtiles('11')), ['110', '111', '112', '113'])

    with assert_raises(ValueError):
        qt.tileextent('4')

    assert_equal(qt.tileextent(''),
                 (-180.0, 180.0, 179.4103506767748, -179.41035067677487))
    assert_equal(qt.tileextent(qt.tms_to_quadkey((2, 0, 2), google=True)),
                 (0.0, 90.0, 179.41035067677481, 89.705175338387392))
    assert_equal(qt.tileextent(qt.tms_to_quadkey((0, 2, 2), google=True)),
                 (-180.0, -90.0, -2.8421709430404007e-14, -89.70517533838742))
    assert_equal(qt.tileextent(qt.tms_to_quadkey((2, 2, 2), google=True)),
                 (0.0, 90.0, -2.8421709430404007e-14, -89.70517533838742))
    assert_equal(qt.tileextent(qt.tms_to_quadkey((8, 9, 4), google=True)),
                 (0.0, 22.5, -22.426293834596891, -44.852587669193753))
Ejemplo n.º 9
0
def test_quadtree_wts():
    qt = cimgt.QuadtreeTiles()

    ll_target_domain = sgeom.box(-15, 50, 0, 60)
    multi_poly = qt.crs.project_geometry(ll_target_domain, ccrs.PlateCarree())
    target_domain = multi_poly.geoms[0]

    with pytest.raises(ValueError):
        list(qt.find_images(target_domain, 0))

    assert qt.tms_to_quadkey((1, 1, 1)) == '1'
    assert qt.quadkey_to_tms('1') == (1, 1, 1)

    assert qt.tms_to_quadkey((8, 9, 4)) == '1220'
    assert qt.quadkey_to_tms('1220') == (8, 9, 4)

    assert tuple(qt.find_images(target_domain, 1)) == ('0', '1')
    assert tuple(qt.find_images(target_domain, 2)) == ('03', '12')

    assert list(qt.subtiles('0')) == ['00', '01', '02', '03']
    assert list(qt.subtiles('11')) == ['110', '111', '112', '113']

    with pytest.raises(ValueError):
        qt.tileextent('4')

    assert_arr_almost(qt.tileextent(''), KNOWN_EXTENTS[(0, 0, 0)])
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((2, 0, 2), google=True)),
                      KNOWN_EXTENTS[(2, 0, 2)])
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((0, 2, 2), google=True)),
                      KNOWN_EXTENTS[(0, 2, 2)])
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((2, 0, 2), google=True)),
                      KNOWN_EXTENTS[(2, 0, 2)])
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((2, 2, 2), google=True)),
                      KNOWN_EXTENTS[(2, 2, 2)])
    assert_arr_almost(qt.tileextent(qt.tms_to_quadkey((8, 9, 4), google=True)),
                      KNOWN_EXTENTS[(8, 9, 4)])
    plt.show()
    if title:
        plt.savefig(title + '.png')


for provider in [
    {
        'tiler': cimgt.OSM(),
        'title': 'OSM'
    },
    {
        'tiler': cimgt.GoogleTiles(),
        'title': 'GoogleTiles'
    },
    {
        'tiler': cimgt.MapQuestOpenAerial(),
        'title': 'MapQuestOpenAerial'
    },
        #this last one raises an errot which is managed
    {
        'tiler': cimgt.Stamen(),
        'title': 'Stamen'
    },
    {
        'tiler': cimgt.QuadtreeTiles(),
        'title': 'QuadtreeTiles'
    },
]:
    print(provider['title'])
    plot_track_with_tiles(provider['tiler'], title=provider['title'], lw=3)
Ejemplo n.º 11
0
def plot_point_dataset(netcdf_point_utils,
                       variable_to_map,
                       utm_bbox=None,
                       plot_title=None,
                       colour_scheme='binary',
                       point_size=10,
                       point_step=1):
    '''
    Function to plot data points on a map
    @param netcdf_point_utils: NetCDFPointUtils object wrapping a netCDF dataset
    @param variable_to_map: String specifying variable name for colour map
    @param utm_bbox: UTM Bounding box of form [xmin, ymin, xmax, ymax] or None for all points. Default=None
    @param plot_title: String to prefix before dataset title. Default=None for dataset title or dataset basename
    @param colour_scheme: String specifying colour scheme for data points. Default='binary'
    @param point_size: Point size for data points. Default=10
    @param point_step: Point step between plotted points - used to skip points in dense datasets. Default=1 
    '''
    def rescale_array(input_np_array, new_range_min=0, new_range_max=1):
        old_min = input_np_array.min()
        old_range = input_np_array.max() - old_min
        new_range = new_range_max - new_range_min

        scaled_np_array = (
            (input_np_array - old_min) / old_range * new_range) + new_range_min

        return scaled_np_array

    if plot_title is None:
        if hasattr(netcdf_point_utils.netcdf_dataset, 'title'):
            plot_title = netcdf_point_utils.netcdf_dataset.title
        else:
            plot_title = netcdf_point_utils.netcdf_dataset.filepath()

    utm_wkt, utm_coords = netcdf_point_utils.utm_coords(
        netcdf_point_utils.xycoords)

    utm_zone = get_spatial_ref_from_wkt(
        utm_wkt).GetUTMZone()  # -ve for Southern Hemisphere
    southern_hemisphere = (utm_zone < 0)
    utm_zone = abs(utm_zone)
    projection = ccrs.UTM(zone=utm_zone,
                          southern_hemisphere=southern_hemisphere)
    print('utm_zone = {}'.format(utm_zone))
    #print(utm_coords)

    variable = netcdf_point_utils.netcdf_dataset.variables[variable_to_map]

    # Set geographic range of plot
    if utm_bbox is None:
        utm_bbox = [
            np.min(utm_coords[:, 0]),
            np.min(utm_coords[:, 1]),
            np.max(utm_coords[:, 0]),
            np.max(utm_coords[:, 1])
        ]
        spatial_mask = np.ones(shape=variable.shape, dtype='Bool')
    else:
        spatial_mask = np.logical_and(
            np.logical_and((utm_bbox[0] <= utm_coords[:, 0]),
                           (utm_coords[:, 0] <= utm_bbox[2])),
            np.logical_and((utm_bbox[1] <= utm_coords[:, 1]),
                           (utm_coords[:, 1] <= utm_bbox[3])))
        utm_coords = utm_coords[spatial_mask]

    print('{} points in UTM bounding box: {}'.format(
        np.count_nonzero(spatial_mask), utm_bbox))
    #print(utm_coords)

    colour_array = rescale_array(variable[spatial_mask], 0, 1)

    fig = plt.figure(figsize=(30, 30))

    ax = fig.add_subplot(1, 1, 1, projection=projection)

    ax.set_title(plot_title)

    #map_image = cimgt.OSM() # https://www.openstreetmap.org/about
    #map_image = cimgt.StamenTerrain() # http://maps.stamen.com/
    map_image = cimgt.QuadtreeTiles()
    #print(map_image.__dict__)
    ax.add_image(map_image, 10)

    # Compute and set regular tick spacing
    range_x = utm_bbox[2] - utm_bbox[0]
    range_y = utm_bbox[3] - utm_bbox[1]
    x_increment = pow(10.0, floor(log10(range_x))) / 2
    y_increment = pow(10.0, floor(log10(range_y))) / 2
    x_ticks = np.arange((utm_bbox[0] // x_increment + 1) * x_increment,
                        utm_bbox[2], x_increment)
    y_ticks = np.arange((utm_bbox[1] // y_increment + 1) * y_increment,
                        utm_bbox[3], y_increment)
    plt.xticks(x_ticks, rotation=45)
    plt.yticks(y_ticks)

    # set the x and y axis labels
    plt.xlabel("Eastings (m)", rotation=0, labelpad=20)
    plt.ylabel("Northings (m)", rotation=90, labelpad=20)

    # See link for possible colourmap schemes: https://matplotlib.org/examples/color/colormaps_reference.html
    cm = plt.cm.get_cmap(colour_scheme)

    # build a scatter plot of the specified data, define marker, spatial reference system, and the chosen colour map type
    sc = ax.scatter(utm_coords[::point_step, 0],
                    utm_coords[::point_step, 1],
                    marker='o',
                    c=colour_array[::point_step],
                    s=point_size,
                    alpha=0.9,
                    transform=projection,
                    cmap=cm)

    # set the colour bar ticks and labels
    try:  # not all variables have units. These will fail on the try and produce the map without tick labels.
        cb = plt.colorbar(sc, ticks=[0, 1])
        cb.ax.set_yticklabels([
            str(np.min(variable[spatial_mask])),
            str(np.max(variable[spatial_mask]))
        ])  # vertically oriented colorbar

        cb.set_label("{} {}".format(variable.long_name, variable.units))
    except:
        pass

    plt.show()
Ejemplo n.º 12
0
def plot_survey_points(
        netcdf_point_utils,  # NetCDFPointUtils object wrapping a netCDF dataset
        variable_to_map,  # String specifying variable name for colour map
        utm_bbox=None,  # utm_bbox is of form [xmin, ymin, xmax, ymax]
        colour_scheme='binary',  # Colour map
        point_size=10  # Size of point in plot
):

    utm_wkt, utm_coords = netcdf_point_utils.utm_coords(
        netcdf_point_utils.xycoords[:])

    utm_zone = get_spatial_ref_from_wkt(
        utm_wkt).GetUTMZone()  # -ve for Southern Hemisphere
    southern_hemisphere = (utm_zone < 0)
    utm_zone = abs(utm_zone)
    projection = ccrs.UTM(zone=utm_zone,
                          southern_hemisphere=southern_hemisphere)
    print('utm_zone = {}'.format(utm_zone))
    # print(utm_coords)

    variable = netcdf_point_utils.netcdf_dataset.variables[variable_to_map]

    # Set geographic range of plot
    if utm_bbox is None:
        utm_bbox = [
            np.min(utm_coords[:, 0]),
            np.min(utm_coords[:, 1]),
            np.max(utm_coords[:, 0]),
            np.max(utm_coords[:, 1])
        ]
        spatial_mask = np.ones(shape=variable.shape, dtype='Bool')
    else:
        spatial_mask = np.logical_and(
            np.logical_and((utm_bbox[0] <= utm_coords[:, 0]),
                           (utm_coords[:, 0] <= utm_bbox[2])),
            np.logical_and((utm_bbox[1] <= utm_coords[:, 1]),
                           (utm_coords[:, 1] <= utm_bbox[3])))
        utm_coords = utm_coords[spatial_mask]

    print('UTM bounding box: {}'.format(utm_bbox))
    # print(utm_coords)
    print(netcdf_point_utils.dimensions['point'])
    colour_array = rescale_array(variable[spatial_mask], 0, 1)

    # map_image = cimgt.OSM() # https://www.openstreetmap.org/about
    # map_image = cimgt.StamenTerrain() # http://maps.stamen.com/
    map_image = cimgt.QuadtreeTiles()
    fig = plt.figure(figsize=(30, 30))

    ax = fig.add_subplot(1, 1, 1, projection=projection)

    ax.set_title("Point Gravity Survey - " +
                 str(netcdf_point_utils.netcdf_dataset.getncattr('title')))

    ax.add_image(map_image, 10)
    print(utm_bbox)
    # Compute and set regular tick spacing
    range_x = utm_bbox[2] - utm_bbox[0]
    range_y = utm_bbox[3] - utm_bbox[1]
    print("range_x: ".format(range_x))
    x_increment = pow(10.0, floor(log10(range_x))) / 2
    y_increment = pow(10.0, floor(log10(range_y))) / 2
    x_ticks = np.arange((utm_bbox[0] // x_increment + 1) * x_increment,
                        utm_bbox[2], x_increment)
    y_ticks = np.arange((utm_bbox[1] // y_increment + 1) * y_increment,
                        utm_bbox[3], y_increment)
    ax.set_xticks(x_ticks)
    ax.set_yticks(y_ticks)

    # set the x and y axis labels
    ax.set_xlabel("Eastings (m)", rotation=0, labelpad=20)
    ax.set_ylabel("Northings (m)", rotation=90, labelpad=20)

    # See link for possible colourmap schemes: https://matplotlib.org/examples/color/colormaps_reference.html
    cm = plt.cm.get_cmap(colour_scheme)

    # build a scatter plot of the specified data, define marker, spatial reference system, and the chosen colour map type
    sc = ax.scatter(utm_coords[:, 0],
                    utm_coords[:, 1],
                    marker='o',
                    c=colour_array,
                    s=point_size,
                    alpha=0.9,
                    transform=projection,
                    cmap=cm)

    # set the colour bar ticks and labels
    cb = plt.colorbar(sc, ticks=[0, 1])
    cb.ax.set_yticklabels([str(np.min(variable)),
                           str(np.max(variable))
                           ])  # vertically oriented colorbar
    cb.set_label("{} {}".format(variable.long_name, variable.units))

    #plt.show()
    plt.savefig("C:\\Users\\u62231\\Desktop\\GravityWork\\maps\\{}".format(
        netcdf_point_utils.netcdf_dataset.getncattr('title')))