import numpy as np
import io
import datetime
import matplotlib.pyplot as plt
f = open('./ice.1870-2011')
#years = []
for i in range(12*100+10):
header = f.readline()
txt = "".join(f.readline() for i in range(6480))
datevec = np.loadtxt(io.BytesIO(header), dtype="int")
year, month, day = datevec
date = datetime.datetime(year=year, month=month, day=day)
arr = np.loadtxt(io.BytesIO(txt))
arr_ma = np.ma.masked_equal(arr, -1).reshape(180,360)
#arrs.append(arr_ma.reshape(180,360)[:50])
#years.append(np.concatenate(arrs, axis=1))
f.close()
fig, ax = plt.subplots(subplot_kw=dict(polar=True), figsize=(20,13))
n = 45
X, Y = np.mgrid[0:2*np.pi:360j,:n]
ax.pcolormesh(X, Y, arr_ma[:n].mask.T, cmap='Greens', vmax=1.5)
ax.pcolormesh(X, Y, arr_ma[:n].T, cmap='Blues_r')
ax.grid(True)
ax.set_theta_zero_location('S')
3