Source code for irfpy.pep.moon_image
''' Picture handling library for Galilean moons.
A simple way of using the module is:
>>> img = get_io_image()
This will load ``Image`` instance of PIL for Io.
Io and Europa is colored (RGB) image and Ganymede and Callisto is black and white.
imshow() will plot the map.
.. code-block:: py
> from pylab import *
> imshow(img, origin='bottom', extent=[180, -180, -90, 90])
'''
import os
from pkg_resources import resource_filename
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
from PIL import Image # Should PIL be installed.
[docs]def get_image(filename):
return Image.open(filename)
[docs]def get_io_image():
fnamn = resource_filename(__name__, os.path.join('images', 'io.jpg'))
logger.info('File %s to load' % fnamn)
return get_image(fnamn)
[docs]def get_europa_image():
fnamn = resource_filename(__name__, os.path.join('images', 'europa.jpg'))
logger.info('File %s to load' % fnamn)
return get_image(fnamn)
[docs]def get_ganymede_image():
fnamn = resource_filename(__name__, os.path.join('images', 'ganymede.jpg'))
logger.info('File %s to load' % fnamn)
return get_image(fnamn)
[docs]def get_callisto_image():
fnamn = resource_filename(__name__, os.path.join('images', 'callisto.jpg'))
logger.info('File %s to load' % fnamn)
return get_image(fnamn)