Difference between revisions of "Cartopybackgrounds"

(Created page with " == Background images for cartopy plots == [https://scitools.org.uk/cartopy/docs/latest/ Cartopy] is a python package for geospatial data processing that can be used to ...")
 
m
 
(3 intermediate revisions by the same user not shown)
Line 17: Line 17:
 
Blue Marble:
 
Blue Marble:
  
[[File:Bluemarble.png|upright|NASA Blue Marble as cartopy background]]
+
[[File:Bluemarble.png|800x666px|NASA Blue Marble as cartopy background]]
  
 
City Lights:
 
City Lights:
  
[[File:Lights.png|upright|NASA City Lights background plot with cartopy]]
+
[[File:Lights.png|800x666px|NASA City Lights background plot with cartopy]]
  
 
Explorer Base Map:
 
Explorer Base Map:
  
[[File:Explorer.png|upright|NASA Explorer Base Map as cartopy background]]
+
[[File:Explorer.png|800x666px|NASA Explorer Base Map as cartopy background]]
  
 
Blue Marble as a background image with SST data in a near side cartopy projection
 
Blue Marble as a background image with SST data in a near side cartopy projection
  
[[File:Bluemarble with sst nearside.png|Blue Marble background image with SST data plotted in near side cartopy projection]]
+
[[File:BlueMarble with COSIMA.png|800x666px|Blue Marble background image with SST data plotted in near side cartopy projection]]
 +
 
 +
The code to generate the picture above is [https://nbviewer.jupyter.org/gist/aidanheerdegen/e2699fb6c9f0da864586c26a3d7d2de2 available as a jupyter notebook].

Latest revision as of 00:15, 29 March 2021

Background images for cartopy plots

Cartopy is a python package for geospatial data processing that can be used to produce production quality maps. It is the supported package for this purpose and is part of our python conda distribution installed at NCI.

The cartopy package has replaced the now deprecated basemap. One of the useful functions provided by basemap that has no equivalent in the cartopy package is the ability to easily add a background "NASA Blue Marble" image.

We have downloaded three NASA blue marble products (bluemarble, city lightsexplorer base map) and made them easily available to use as a background for a cartopy plot. The shut up and show me how is:

plt.figure(figsize=(24,12)) 
ax = plt.subplot(111, projection=ccrs.PlateCarree()) 
ax.background_img(name='bluemarble', resolution='high')

replace bluemarble with lights or explorer to access the different products. All are avaible in four different resolutions: low, medium, high and extrahigh (aliases for 1.0deg, 0.5deg, 0.25deg and 0.1deg).

Examples of each plot

Blue Marble:

NASA Blue Marble as cartopy background

City Lights:

NASA City Lights background plot with cartopy

Explorer Base Map:

NASA Explorer Base Map as cartopy background

Blue Marble as a background image with SST data in a near side cartopy projection

Blue Marble background image with SST data plotted in near side cartopy projection

The code to generate the picture above is available as a jupyter notebook.