File: geography.rst

package info (click to toggle)
basemap 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 213,532 kB
  • sloc: python: 11,826; sh: 45; makefile: 41
file content (71 lines) | stat: -rw-r--r-- 3,049 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.. _geography:

Drawing a Map Background
========================

Basemap includes the `GSHHG <https://www.soest.hawaii.edu/pwessel/gshhg/>`_
coastline dataset, as well as datasets for rivers, state and
country boundaries from 
`GMT <https://www.generic-mapping-tools.org/>`_.
These datasets can be used to draw coastlines, rivers and political
boundaries on maps at several different resolutions.  The relevant Basemap 
methods are:

* :func:`~mpl_toolkits.basemap.Basemap.drawcoastlines`: draw coastlines.
* :func:`~mpl_toolkits.basemap.Basemap.fillcontinents`: color the interior
  of continents (by filling the coastline polygons).
  Unfortunately, the fillcontinents method doesn't always do the right thing.
  Matplotlib always tries to fill the inside of a polygon.  Under certain situations,
  what is the inside of a coastline polygon can be ambiguous, and the 
  outside may be filled instead of the inside.  
  In these situations, the recommended workaround is to use the 
  :func:`~mpl_toolkits.basemap.Basemap.drawlsmask` method to 
  overlay an image with different colors specified for land and water regions
  (see below).
* :func:`~mpl_toolkits.basemap.Basemap.drawcountries`: draw country boundaries.
* :func:`~mpl_toolkits.basemap.Basemap.drawstates`: draw state boundaries
  in North America.
* :func:`~mpl_toolkits.basemap.Basemap.drawrivers`: draw rivers.

Instead of drawing coastlines and political boundaries, an image can be
used as a map background.  Basemap provides several options for this:

* :func:`~mpl_toolkits.basemap.Basemap.drawlsmask`: draw a high-resolution 
  land-sea mask as an image, with land and ocean colors specified. The land-sea
  mask is derived from the GSHHS coastline data, and there are several 
  coastline options and pixel sizes to choose from.
* :func:`~mpl_toolkits.basemap.Basemap.bluemarble`: draw a NASA
  `Blue Marble <https://visibleearth.nasa.gov/images/73726/june-blue-marble-next-generation-w-topography-and-bathymetry>`_
  image as a map background.
* :func:`~mpl_toolkits.basemap.Basemap.shadedrelief`: draw a  
  `shaded relief <https://www.shadedrelief.com/>`_ image
  as a map background.
* :func:`~mpl_toolkits.basemap.Basemap.etopo`: draw an  
  `etopo <https://www.ngdc.noaa.gov/mgg/global/global.html>`_
  relief image as map background.
* :func:`~mpl_toolkits.basemap.Basemap.warpimage`: use an abitrary
  image as a map background.  The image must be global, covering the
  world in lat/lon coordinates from the international dateline eastward
  and the South Pole northward.

Here are examples of the various ways to draw a map background.

1. Draw coastlines, filling ocean and land areas.

.. plot:: source/users/figures/background1.py

2. Draw a land-sea mask as an image.

.. plot:: source/users/figures/background2.py

3. Draw the NASA 'Blue Marble' image.

.. plot:: source/users/figures/background3.py

4. Draw a shaded relief image.

.. plot:: source/users/figures/background4.py
 
5. Draw an etopo relief image.

.. plot:: source/users/figures/background5.py