Defining geographic regions#

PolarToolkit uses geographic regions for downloading subsets of data and defining plot boundaries. These geographic regions are in the form of (x_min, x_max, y_min, y_min) where x and y refer to meters east and north of the pole, respectively. These are in polar stereographic projects EPSG 3031 and 3413 for the north and south poles, respectively. There several ways you can define a geographic region, which we show here.

[1]:
from statistics import mean

import verde as vd

import polartoolkit as ptk

Pre defined#

PolarToolkit provides many pre-defined regions which you can access with the regions module of polartoolkit.

import polartoolkit as ptk

ptk.regions.<<name of region you want>>

Below is a list of all available regions.

[2]:
# Add all region strings to dictionary
region_dict = ptk.regions.get_regions()

# extract antarctic and greenland strings
antarctic_strings = []
for x in list(region_dict.keys()):
    if x == "greenland":
        break
    else:
        antarctic_strings.append(x)

greenland_strings = [x for x in list(region_dict.keys()) if x not in antarctic_strings]

# subset dict for antarctica and greenland
antarctic_regions = {k: region_dict[k] for k in antarctic_strings}
greenland_regions = {k: region_dict[k] for k in greenland_strings}

antarctic_regions, greenland_regions
[2]:
({'antarctica': (-2800000.0, 2800000.0, -2800000.0, 2800000.0),
  'west_antarctica': (-2740000.0, 570000.0, -2150000.0, 1670000.0),
  'east_antarctica': (-840000.0, 2880000.0, -2400000.0, 2600000.0),
  'antarctic_peninsula': (-2600000.0, -1200000.0, 170000.0, 1800000.0),
  'marie_byrd_land': (-1500000.0, -500000.0, -1350000.0, -800000.0),
  'victoria_land': (100000.0, 1000000.0, -2200000.0, -1000000.0),
  'saunders_coast': (-980000.0, -600000.0, -1350000.0, -1100000.0),
  'roosevelt_island': (-480000.0, -240000.0, -1220000.0, -980000.0),
  'ross_island': (210000.0, 360000.0, -1400000.0, -1250000.0),
  'minna_bluff': (210000.0, 390000.0, -1310000.0, -1120000.0),
  'mcmurdo_dry_valleys': (320000.0, 480000.0, -1400000.0, -1220000.0),
  'siple_coast': (-700000.0, 30000.0, -1110000.0, -450000.0),
  'crary_ice_rise': (-330000.0, -40000.0, -830000.0, -480000.0),
  'siple_dome': (-630000.0, -270000.0, -970000.0, -630000.0),
  'ross_ice_shelf': (-680000.0, 470000.0, -1420000.0, -310000.0),
  'nickerson_ice_shelf': (-980000.0, -787000.0, -1327000.0, -1210000.0),
  'getz_ice_shelf': (-1624000.0, -1130000.0, -1234000.0, -664000.0),
  'george_vi_ice_shelf': (-2150000.0, -1690000.0, 540000.0, 860000.0),
  'larsen_ice_shelf': (-2430000.0, -1920000.0, 900000.0, 1400000.0),
  'ronne_filchner_ice_shelf': (-1550000.0, -500000.0, 80000.0, 1100000.0),
  'ronne_ice_shelf': (-1550000.0, -725000.0, 45000.0, 970000.0),
  'abbot_ice_shelf': (-1989000.0, -1792000.0, -471000.0, 51000.0),
  'ainsworth_ice_shelf': (1310000.0, 1365000.0, -2051000.0, -2000000.0),
  'alison_ice_shelf': (-1775000.0, -1726000.0, 217000.0, 278000.0),
  'amery_ice_shelf': (1530000.0, 2460000.0, 430000.0, 1000000.0),
  'andreyev_ice_shelf': (931000.0, 984000.0, -2123000.0, -2071000.0),
  'arneb_ice_shelf': (313000.0, 356000.0, -1918000.0, -1874000.0),
  'astrolabe_ice_shelf': (1624000.0, 1672000.0, -1991000.0, -1936000.0),
  'atka_ice_shelf': (-305000.0, -201000.0, 2060000.0, 2155000.0),
  'aviator_ice_shelf': (393000.0, 486000.0, -1749000.0, -1669000.0),
  'bach_ice_shelf': (-1940000.0, -1800000.0, 533000.0, 680000.0),
  'barber_ice_shelf': (610000.0, 657000.0, -2075000.0, -2029000.0),
  'baudouin_ice_shelf': (855000.0, 1250000.0, 1790000.0, 2080000.0),
  'borchgrevink_ice_shelf': (587000.0, 894000.0, 1917000.0, 2153000.0),
  'brahms_ice_shelf': (-1980000.0, -1912000.0, 540000.0, 600000.0),
  'britten_ice_shelf': (-1843000.0, -1796000.0, 549000.0, 596000.0),
  'brunt_stancomb_ice_shelf': (-775000.0, -484000.0, 1342000.0, 1639000.0),
  'campbell_ice_shelf': (426000.0, 478000.0, -1645000.0, -1594000.0),
  'capewashington_ice_shelf': (410000.0, 456000.0, -1654000.0, -1610000.0),
  'cheetham_ice_shelf': (434000.0, 490000.0, -1512000.0, -1463000.0),
  'chugunov_ice_shelf': (587000.0, 635000.0, -2054000.0, -2009000.0),
  'cirque_fjord_ice_shelf': (2112000.0, 2159000.0, 1268000.0, 1322000.0),
  'clarkebay_ice_shelf': (-1512000.0, -1468000.0, 805000.0, 850000.0),
  'commandant_charcot_ice_shelf': (1760000.0,
   1807000.0,
   -1912000.0,
   -1863000.0),
  'conger_glenzer_ice_shelf': (2549000.0, 2654000.0, -660000.0, -575000.0),
  'cook_ice_shelf': (1010000.0, 1159000.0, -2153000.0, -2038000.0),
  'cosgrove_ice_shelf': (-1816000.0, -1721000.0, -390000.0, -257000.0),
  'crosson_ice_shelf': (-1595000.0, -1466000.0, -646000.0, -509000.0),
  'dalk_ice_shelf': (2169000.0, 2220000.0, 507000.0, 552000.0),
  'dawson_lambton_ice_shelf': (-705000.0, -660000.0, 1330000.0, 1376000.0),
  'deakin_ice_shelf': (1139000.0, 1193000.0, -2090000.0, -2038000.0),
  'dennistoun_ice_shelf': (401000.0, 455000.0, -2044000.0, -1994000.0),
  'dibble_ice_shelf': (1820000.0, 1903000.0, -1894000.0, -1791000.0),
  'dotson_ice_shelf': (-1620000.0, -1465000.0, -715000.0, -584000.0),
  'drury_ice_shelf': (875000.0, 927000.0, -2132000.0, -2081000.0),
  'drygalski_ice_shelf': (380000.0, 547000.0, -1567000.0, -1488000.0),
  'edward_viii_ice_shelf': (2103000.0, 2165000.0, 1379000.0, 1456000.0),
  'ekstrom_ice_shelf': (-382000.0, -248000.0, 1959000.0, 2136000.0),
  'eltanin_bay_ice_shelf': (-1786000.0, -1741000.0, 254000.0, 297000.0),
  'erebus_ice_shelf': (283000.0, 334000.0, -1328000.0, -1283000.0),
  'falkner_ice_shelf': (402000.0, 446000.0, -1747000.0, -1703000.0),
  'ferrigno_ice_shelf': (-1807000.0, -1746000.0, 173000.0, 234000.0),
  'fimbul_ice_shelf': (-260000.0, 430000.0, 1900000.0, 2350000.0),
  'fisher_ice_shelf': (1367000.0, 1421000.0, -2065000.0, -2008000.0),
  'fitzgerald_ice_shelf': (386000.0, 450000.0, -1769000.0, -1702000.0),
  'flatnes_ice_shelf': (2184000.0, 2239000.0, 496000.0, 546000.0),
  'fox_east_ice_shelf': (2360000.0, 2405000.0, -1108000.0, -1060000.0),
  'fox_west_ice_shelf': (-1829000.0, -1782000.0, 123000.0, 169000.0),
  'francais_ice_shelf': (1697000.0, 1749000.0, -1953000.0, -1899000.0),
  'frost_ice_shelf': (1935000.0, 2010000.0, -1636000.0, -1538000.0),
  'gannutz_ice_shelf': (637000.0, 684000.0, -2076000.0, -2028000.0),
  'garfield_ice_shelf': (-1146000.0, -1095000.0, -1218000.0, -1172000.0),
  'geikieinlet_ice_shelf': (442000.0, 500000.0, -1539000.0, -1471000.0),
  'gillet_ice_shelf': (749000.0, 809000.0, -2132000.0, -2079000.0),
  'hamilton_ice_shelf': (-540000.0, -483000.0, -1294000.0, -1232000.0),
  'hamilton_piedmont_ice_shelf': (-1613000.0,
   -1569000.0,
   -605000.0,
   -562000.0),
  'hannan_ice_shelf': (1787000.0, 1851000.0, 1626000.0, 1707000.0),
  'harbordglacier_ice_shelf': (427000.0, 482000.0, -1492000.0, -1444000.0),
  'harmon_bay_ice_shelf': (-1629000.0, -1582000.0, -632000.0, -587000.0),
  'hayes_coats_coast_ice_shelf': (-722000.0, -678000.0, 1306000.0, 1352000.0),
  'helen_ice_shelf': (2535000.0, 2599000.0, -207000.0, -142000.0),
  'holmes_ice_shelf': (1977000.0, 2133000.0, -1594000.0, -1504000.0),
  'holt_ice_shelf': (-1600000.0, -1548000.0, -607000.0, -555000.0),
  'hornbluff_ice_shelf': (1177000.0, 1232000.0, -2076000.0, -2024000.0),
  'hoseason_ice_shelf': (2106000.0, 2169000.0, 1303000.0, 1355000.0),
  'hovde_ice_shelf': (2196000.0, 2242000.0, 493000.0, 537000.0),
  'hull_ice_shelf': (-1136000.0, -1079000.0, -1226000.0, -1164000.0),
  'hummer_point_ice_shelf': (-1623000.0, -1576000.0, -615000.0, -567000.0),
  'ironside_ice_shelf': (319000.0, 372000.0, -1950000.0, -1896000.0),
  'jackson_ice_shelf': (-1190000.0, -1141000.0, -1222000.0, -1173000.0),
  'jelbart_ice_shelf': (-243000.0, -79000.0, 2006000.0, 2169000.0),
  'kirkby_ice_shelf': (490000.0, 537000.0, -2079000.0, -2035000.0),
  'land_ice_shelf': (-1018000.0, -948000.0, -1273000.0, -1186000.0),
  'larsen_a_ice_shelf': (-2441000.0, -2340000.0, 1312000.0, 1401000.0),
  'larsen_b_ice_shelf': (-2398000.0, -2294000.0, 1206000.0, 1307000.0),
  'larsen_c_ice_shelf': (-2359000.0, -2024000.0, 962000.0, 1315000.0),
  'larsen_d_ice_shelf': (-2135000.0, -1591000.0, 886000.0, 1158000.0),
  'larsen_e_ice_shelf': (-1649000.0, -1536000.0, 835000.0, 923000.0),
  'larsen_f_ice_shelf': (-1572000.0, -1482000.0, 796000.0, 875000.0),
  'larsen_g_ice_shelf': (-1521000.0, -1446000.0, 767000.0, 829000.0),
  'lauritzen_ice_shelf': (888000.0, 960000.0, -2139000.0, -2073000.0),
  'lazarev_ice_shelf': (469000.0, 627000.0, 2054000.0, 2203000.0),
  'lillie_ice_shelf': (540000.0, 623000.0, -2076000.0, -1976000.0),
  'liotard_ice_shelf': (1650000.0, 1695000.0, -1983000.0, -1936000.0),
  'mandible_cirque_ice_shelf': (319000.0, 366000.0, -1838000.0, -1791000.0),
  'manhaul_ice_shelf': (318000.0, 363000.0, -1919000.0, -1875000.0),
  'marin_ice_shelf': (435000.0, 482000.0, -1471000.0, -1425000.0),
  'mariner_ice_shelf': (319000.0, 446000.0, -1841000.0, -1736000.0),
  'marret_ice_shelf': (1720000.0, 1772000.0, -1946000.0, -1901000.0),
  'matusevitch_ice_shelf': (849000.0, 912000.0, -2141000.0, -2073000.0),
  'may_glacier_ice_shelf': (1970000.0, 2029000.0, -1733000.0, -1663000.0),
  'mcleod_ice_shelf': (811000.0, 856000.0, -2133000.0, -2087000.0),
  'mendelssohn_ice_shelf': (-1995000.0, -1923000.0, 566000.0, 646000.0),
  'mertz_ice_shelf': (1377000.0, 1486000.0, -2159000.0, -1956000.0),
  'morse_ice_shelf': (1975000.0, 2020000.0, -1703000.0, -1652000.0),
  'moscow_university_ice_shelf': (2132000.0,
   2273000.0,
   -1391000.0,
   -1135000.0),
  'moubray_ice_shelf': (304000.0, 357000.0, -1979000.0, -1921000.0),
  'mulebreen_ice_shelf': (2102000.0, 2162000.0, 1227000.0, 1297000.0),
  'myers_ice_shelf': (1886000.0, 1947000.0, 1592000.0, 1642000.0),
  'nansen_ice_shelf': (438000.0, 518000.0, -1654000.0, -1526000.0),
  'ninnis_ice_shelf': (1212000.0, 1345000.0, -2059000.0, -1973000.0),
  'nivl_ice_shelf': (336000.0, 510000.0, 2046000.0, 2190000.0),
  'noll_ice_shelf': (784000.0, 835000.0, -2141000.0, -2085000.0),
  'nordenskjold_ice_shelf': (419000.0, 484000.0, -1467000.0, -1407000.0),
  'parker_ice_shelf': (403000.0, 461000.0, -1737000.0, -1688000.0),
  'paternostro_ice_shelf': (804000.0, 848000.0, -2136000.0, -2093000.0),
  'perkins_ice_shelf': (-1151000.0, -1107000.0, -1221000.0, -1177000.0),
  'philbin_inlet_ice_shelf': (-1623000.0, -1565000.0, -737000.0, -686000.0),
  'pine_island_ice_shelf': (-1705000.0, -1541000.0, -384000.0, -236000.0),
  'porter_ice_shelf': (1896000.0, 1945000.0, 1624000.0, 1675000.0),
  'pourquoipas_ice_shelf': (1799000.0, 1862000.0, -1904000.0, -1847000.0),
  'prince_harald_ice_shelf': (1257000.0, 1425000.0, 1734000.0, 1942000.0),
  'publications_ice_shelf': (2101000.0, 2197000.0, 521000.0, 625000.0),
  'quar_ice_shelf': (-435000.0, -340000.0, 1962000.0, 2070000.0),
  'quatermain_point_ice_shelf': (315000.0, 360000.0, -1960000.0, -1915000.0),
  'rayner_thyer_ice_shelf': (1793000.0, 1873000.0, 1586000.0, 1664000.0),
  'rennick_ice_shelf': (593000.0, 725000.0, -2088000.0, -1920000.0),
  'richter_ice_shelf': (-608000.0, -559000.0, -1312000.0, -1251000.0),
  'riiser_larsen_ice_shelf': (-658000.0, -353000.0, 1572000.0, 1984000.0),
  'rose_point_ice_shelf': (-1168000.0, -1122000.0, -1232000.0, -1188000.0),
  'rund_bay_ice_shelf': (2099000.0, 2155000.0, 1337000.0, 1397000.0),
  'rydberg_ice_shelf': (-1840000.0, -1775000.0, 313000.0, 368000.0),
  'sandford_ice_shelf': (1950000.0, 2000000.0, -1653000.0, -1605000.0),
  'shackleton_ice_shelf': (2506000.0, 2765000.0, -513000.0, -199000.0),
  'shirase_ice_shelf': (1340000.0, 1411000.0, 1668000.0, 1763000.0),
  'skallen_ice_shelf': (1399000.0, 1448000.0, 1695000.0, 1746000.0),
  'slava_ice_shelf': (950000.0, 1030000.0, -2145000.0, -2083000.0),
  'smithinlet_ice_shelf': (420000.0, 477000.0, -2062000.0, -2011000.0),
  'sorsdal_ice_shelf': (2264000.0, 2317000.0, 453000.0, 513000.0),
  'stange_ice_shelf': (-1881000.0, -1696000.0, 326000.0, 499000.0),
  'sulzberger_ice_shelf': (-839000.0, -623000.0, -1302000.0, -1101000.0),
  'suter_ice_shelf': (374000.0, 424000.0, -1782000.0, -1730000.0),
  'suvorov_ice_shelf': (703000.0, 770000.0, -2102000.0, -2040000.0),
  'swinburne_ice_shelf': (-667000.0, -588000.0, -1286000.0, -1188000.0),
  'telen_ice_shelf': (1406000.0, 1451000.0, 1696000.0, 1744000.0),
  'thomson_ice_shelf': (-1823000.0, -1768000.0, 277000.0, 329000.0),
  'thwaites_ice_shelf': (-1627000.0, -1496000.0, -535000.0, -361000.0),
  'tinker_ice_shelf': (424000.0, 479000.0, -1710000.0, -1652000.0),
  'totten_ice_shelf': (2218000.0, 2341000.0, -1185000.0, -984000.0),
  'tracy_tremenchus_ice_shelf': (2564000.0, 2664000.0, -596000.0, -446000.0),
  'tucker_ice_shelf': (304000.0, 376000.0, -1902000.0, -1832000.0),
  'underwood_ice_shelf': (2414000.0, 2473000.0, -821000.0, -759000.0),
  'utsikkar_ice_shelf': (2142000.0, 2196000.0, 1162000.0, 1214000.0),
  'venable_ice_shelf': (-1898000.0, -1794000.0, 21000.0, 156000.0),
  'verdi_ice_shelf': (-1967000.0, -1913000.0, 511000.0, 565000.0),
  'vigrid_ice_shelf': (270000.0, 365000.0, 2096000.0, 2201000.0),
  'vincennes_bay_ice_shelf': (2377000.0, 2447000.0, -932000.0, -802000.0),
  'voyeykov_ice_shelf': (2082000.0, 2160000.0, -1505000.0, -1422000.0),
  'walgreen_ice_shelf': (-1769000.0, -1691000.0, -386000.0, -331000.0),
  'wattbay_ice_shelf': (1454000.0, 1507000.0, -2068000.0, -2013000.0),
  'west_ice_shelf': (2395000.0, 2627000.0, 34000.0, 392000.0),
  'whittle_ice_shelf': (2343000.0, 2399000.0, -1100000.0, -1053000.0),
  'wilkins_ice_shelf': (-2147000.0, -1922000.0, 554000.0, 769000.0),
  'williamson_ice_shelf': (2330000.0, 2384000.0, -1126000.0, -1052000.0),
  'wilmarobertdowner_ice_shelf': (2051000.0, 2152000.0, 1356000.0, 1436000.0),
  'withrow_ice_shelf': (-577000.0, -513000.0, -1333000.0, -1249000.0),
  'wordie_ice_shelf': (-2151000.0, -2058000.0, 826000.0, 928000.0),
  'wylde_ice_shelf': (381000.0, 436000.0, -1773000.0, -1719000.0),
  'zelee_ice_shelf': (1572000.0, 1627000.0, -2012000.0, -1967000.0),
  'zubchatyy_ice_shelf': (1861000.0, 1925000.0, 1610000.0, 1671000.0),
  'pine_island_glacier': (-1720000.0, -1480000.0, -380000.0, -70000.0),
  'thwaites_glacier': (-1650000.0, -1200000.0, -600000.0, -300000.0),
  'kamb_ice_stream': (-620000.0, -220000.0, -800000.0, -400000.0),
  'ross_sea': (-500000.0, 450000.0, -2100000.0, -1300000.0),
  'lake_vostok': (1100000.0, 1535000.0, -470000.0, -230000.0)},
 {'greenland': (-700000.0, 900000.0, -3400000.0, -600000.0),
  'north_greenland': (-500000.0, 600000.0, -1200000.0, -650000.0),
  'kangerlussuaq_glacier': (380000.0, 550000.0, -2340000.0, -2140000.0)})

And here are some maps showing these available regions.

[3]:
fig = ptk.basemap(
    modis_basemap=True,
    frame="+gblack",
    hemisphere="south",
    region=ptk.regions.antarctica,
)
[4]:
# remove large regions to not crowd plot
remove = ["antarctica", "west_antarctica", "east_antarctica"]
[antarctic_regions.pop(key, None) for key in remove]

for _k, v in antarctic_regions.items():
    fig.add_box(v, pen=".6p,magenta")

fig.show(dpi=200)
../_images/how_to_defining_regions_6_0.png
[5]:
fig = ptk.basemap(
    modis_basemap=True,
    frame="+gblack",
    hemisphere="north",
    region=ptk.regions.greenland,
)

# remove large regions to not crowd plot
remove = ["greenland"]
[greenland_regions.pop(key, None) for key in remove]

for k, v in greenland_regions.items():
    fig.add_box(v, pen=".6p,magenta")
    fig.text(
        x=mean([v[1], v[0]]),
        y=v[3],
        text=k,
        justify="CB",
        offset="0/.1",
        no_clip=True,
        font="6p,Helvetica,black",
        fill="white",
    )

fig.show(dpi=200)
../_images/how_to_defining_regions_7_0.png

Manually defined#

You can simple enter your own values for a geographic region. It should be in the form of a tuple, for example

region = (-3500, 50000, -200100, -180000)

This is in the form (easting_min, easting_max, northing_min, northing_max)

You can use the below maps to read of the approximate values you need for your region boundaries.

[6]:
# Antarctic basemap
fig = ptk.basemap(
    region=ptk.regions.antarctica,
    hemisphere="south",
    fig_height=9,  # cm
    simple_basemap=True,
    simple_basemap_version="gmt",
)
# add EPSG grid lines
fig.basemap(
    frame=[
        "sxa1000000g1000000+a30+leasting (m)",
        "pxg500000",
        "sya1000000g1000000+lnorthing (m)",
        "pyg500000",
    ],
    region=fig.reg,
    projection=fig.proj,
)

# Arctic basemap
fig = ptk.basemap(
    fig=fig,
    origin_shift="x",
    xshift_amount=1.3,
    region=(-3500e3, 3500e3, -3500e3, 3500e3),
    hemisphere="north",
    fig_height=fig.height,
    simple_basemap=True,
    simple_basemap_version="gmt",
)
# add EPSG grid lines
fig.basemap(
    frame=[
        "sxa1000000g1000000+a30+leasting (m)",
        "pxg500000",
        "sya1000000g1000000+lnorthing (m)",
        "pyg500000",
    ],
    region=fig.reg,
    projection=fig.proj,
)

# Greenland basemap
fig = ptk.basemap(
    fig=fig,
    origin_shift="x",
    xshift_amount=1.3,
    region=ptk.regions.greenland,
    hemisphere="north",
    fig_height=fig.height,
    simple_basemap=True,
    simple_basemap_version="gmt",
)
# add EPSG grid lines
fig.basemap(
    frame=[
        "sxa500000g500000+a30+leasting (m)",
        "pxg250000",
        "sya500000g500000+lnorthing (m)",
        "pyg250000",
    ],
    region=fig.reg,
    projection=fig.proj,
)

fig.show(dpi=200)
../_images/how_to_defining_regions_9_0.png

If you install ipyleaflet with mamba install ipyleaflet, the below code will show an interactive map and clicking will give coordinates in polar stereographic, which you can copy and paste to create a region.

[7]:
ptk.interactive_map(hemisphere="south")
# unfortunately the interactive map does not display for the online documentation
[7]:

Interactively defined#

You can use the function regions.draw_region to interactively draw a polygon and return the bounding region for it.

[8]:
polygon = ptk.draw_region(hemisphere="north")
# unfortunately the interactive map does not display for the online documentation
[10]:
region = ptk.polygon_to_region(polygon, hemisphere="north")
region
[10]:
(np.float64(-32767.993375262315),
 np.float64(335872.00572132727),
 np.float64(-2375679.990434366),
 np.float64(-1466368.0397862527))

Defined by extent of data#

You can use a dataset, either gridded or point data, to define a region by the extent of the data.

[11]:
grid = ptk.fetch.sediment_thickness(version="tankersley-2022")

info = ptk.get_grid_info(grid)

# the 2nd object is the region
region = info[1]

region
[11]:
(-3330000.0, 1900000.0, -3330000.0, 1850000.0)
[12]:
df = ptk.fetch.ghf(version="burton-johnson-2020", points=True)

region = vd.get_region((df.x, df.y))

region
[12]:
(np.float64(-3771912.2124641463),
 np.float64(4304153.836767693),
 np.float64(-4390203.790700719),
 np.float64(4294867.885261321))