In [9]:
%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

# Larger figure size
fig_size = [14, 10]
plt.rcParams['figure.figsize'] = fig_size

In [10]:
x = np.memmap('/home/daniel/codar_dechirp_f32_20171215_145510', mode='r', dtype='float32')

In [11]:
chunk_size = 1000
step = 3600*24
averaging = 45 # (1920 pixels per day)
a, b = 300, 850
begin = 3600*8 + 3310 # start at 6:00 UTC
for chunk_num, start in enumerate(range(-begin, x.size//chunk_size, step)):
    end = start + step
    piece = np.reshape(x[:x.size//chunk_size*chunk_size], (x.size//chunk_size, chunk_size))[np.max((start, 0)):end,:]
    if start < 0:
        piece = np.concatenate((np.zeros((-start, chunk_size)), piece), axis=0)
    elif piece.shape[0] < step:
        piece = np.concatenate((piece, np.zeros((step - piece.shape[0], chunk_size))), axis=0)
    
    #roll_each = 95
    #for j in range(piece.shape[0]):
    #    piece[j,:] = np.roll(piece[j,:], (start + j)//roll_each)
                   
    piece = np.average(np.reshape(piece[:piece.shape[0]//averaging*averaging,:], (piece.shape[0]//averaging, averaging, piece.shape[1])), axis=1)
    
    plt.imsave('codar_{}.png'.format(chunk_num), np.rot90(10*np.log10(piece[:,a:b])), cmap='viridis', vmax=30, vmin=-25)


/usr/lib64/python3.4/site-packages/ipykernel_launcher.py:20: RuntimeWarning: divide by zero encountered in log10