calum-chamberlain / ESCI451-Python

Introduction to Python for VUW ESCI 451 course.
GNU General Public License v3.0
11 stars 5 forks source link

Maps on windows don't always use the same region #20

Closed calum-chamberlain closed 1 year ago

calum-chamberlain commented 2 years ago

On my main windows machine today it looks like GMT maps in module 4A are not always using the region defined by the grid when plotting topography.

The plot here:

image

Should look like this:

image

To do this I had to change the code from:

DEM = pygmt.datasets.load_earth_relief(
    resolution='01s', region=[174.5, 175, -41.5, -41])

fig = pygmt.Figure()
pygmt.config(MAP_FRAME_TYPE='plain', FORMAT_GEO_MAP='ddd.xx')
fig.grdimage(grid=DEM,
             projection='M10c',
             frame=['WSne', 'xa0.2f0.1', 'ya0.2f0.1']
             cmap='geo')
fig.coast(shorelines=True)
fig.colorbar(frame=["a200f100", "x+lElevation", "y+lm"],
             position='JRM')
fig.show()

to:

DEM = pygmt.datasets.load_earth_relief(
    resolution='01s', region=[174.5, 175, -41.5, -41])

fig = pygmt.Figure()
fig.basemap(
    region=[174.5, 175, -41.5, -41],
    projection='M10c',
    frame=['WSne', 'xa0.2f0.1', 'ya0.2f0.1'])
pygmt.config(MAP_FRAME_TYPE='plain', FORMAT_GEO_MAP='ddd.xx')
fig.grdimage(grid=DEM,
             cmap='geo')
fig.coast(shorelines=True)
fig.colorbar(frame=["a200f100", "x+lElevation", "y+lm"],
             position='JRM')
fig.show()

e.g. adding in a basemap to set the region to start with. It looks like the basemap region is being remembered from a previous NZ-wide plot.

calum-chamberlain commented 1 year ago

Fixed in master.