''' Simple plotting routine with polar projections (basemap version)
'''
import sys
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import mapinmedata
def main():
'''Main script'''
md = mapinmedata.orbitdata_reader(sys.argv[1])
lonarr, latarr = md.get_cgrid()
nlist = md.get_counts()
fig = plt.figure(figsize=(12, 6))
ax1 = fig.add_subplot(1, 2, 1)
ax2 = fig.add_subplot(1, 2, 2)
m = Basemap(projection='npaeqd', boundinglat=60, lon_0=-90, ax=ax1)
# m = Basemap(projection='npaeqd', boundinglat=-0, lon_0=-90, ax=ax1)
m.drawcoastlines()
# m.fillcontinents(color='coral', lake_color='aqua')
m.drawparallels(np.arange(-80, 81, 10))
m.drawmeridians(np.arange(-180, 181, 30))
# m.drawmapboundary(fill_color='aqua')
x, y = m(lonarr, latarr)
m.pcolor(x, y, np.ma.masked_less(nlist, 0.1))
m = Basemap(projection='spaeqd', boundinglat=-60, lon_0=90, ax=ax2)
# m = Basemap(projection='spaeqd', boundinglat=0, lon_0=90, ax=ax2)
m.drawcoastlines()
# m.fillcontinents(color='coral', lake_color='aqua')
m.drawparallels(np.arange(-80, 81, 10))
m.drawmeridians(np.arange(-180, 181, 30))
# m.drawmapboundary(fill_color='aqua')
x, y = m(lonarr, latarr)
m.pcolor(x, y, np.ma.masked_less(nlist, 0.1))
fig.savefig(sys.argv[1] + '_pc.png')
if __name__ == "__main__":
main()