Manipulating geographic regions#
There are a few operations you can perform on the geographic regions to manipulate them, as demonstrated here.
[2]:
from polartoolkit import fetch, maps, regions
Combining regions#
[3]:
# define two regions
RIS = regions.ross_ice_shelf
MBL = regions.marie_byrd_land
# get the bounding region of both
combined = regions.combine_regions(RIS, MBL)
# make a basemap
fig = maps.plot_grd(
fetch.bedmap2(layer="bed"),
region=regions.antarctica,
colorbar=False,
title="Combining regions",
)
# plot the three regions
maps.add_box(fig, combined, pen="6p,red")
maps.add_box(fig, RIS)
maps.add_box(fig, MBL)
fig.show(dpi=200)
Alter region#
You can use the regions.alter_region function to zoom in or out, or shift the region north, south, east or west.
[4]:
# define a starting region
reg = regions.minna_bluff
# zoom in 20km and shift 25km north and 5km east
new_reg = regions.alter_region(reg, zoom=20e3, n_shift=25e3, w_shift=-5e3)
# zoom out 15km and shift 12km south
new_reg2 = regions.alter_region(
reg,
zoom=-15e3,
n_shift=-12e3,
)
# make a basemap
fig = maps.plot_grd(
fetch.bedmap2(layer="bed"),
region=regions.alter_region(reg, zoom=-50e3),
colorbar=False,
title="Altering regions",
)
# plot the three regions
maps.add_box(fig, reg, pen="6p,red")
maps.add_box(fig, new_reg, pen="2p,blue")
maps.add_box(fig, new_reg2, pen="2p,green")
fig.show(dpi=200)
[ ]: