Source code for irfpy.moon.moon_map
"""
"""
from pkg_resources import resource_filename as _resource_filename
import imageio as _imageio
import numpy as _np
from irfpy.util import gridsphere as _gs
[docs]class MoonMapSmall:
""" A class for a lunar map. Small version (1024x512 pix).
>>> moonmap = MoonMapSmall()
>>> filename = moonmap.filename
>>> import os
>>> print(os.path.basename(filename))
Moon_LRO_LROC-WAC_Mosaic_global_1024.jpg
"""
def __init__(self):
self.filename = _resource_filename(__name__,
'map/Moon_LRO_LROC-WAC_Mosaic_global_1024.jpg')
self.image = _imageio.imread(self.filename)
"""Imageio image instance. (Extended from ``numpy`` array)
"""
self._gridsphere = None
[docs] def gridsphere(self):
ny, nx, depth = self.image.shape
if self._gridsphere is None:
self._gridsphere = _gs.SimpleGridSphere(nlon=nx, nlat=ny)
lonarr, latarr = self._gridsphere.get_cgrid()
lonarr = lonarr.flatten()
latarr = latarr[::-1].flatten()
img = self.image[:, :, 0].flatten()
self._gridsphere.append_values_lonlat(lonarr + 180, latarr, img)
return self._gridsphere