def calculate_n_subimages(data, k, stride):
    """
    Calculates the number of subimages generated for a single timestep of 'data'
    given a k x k subimage window and stride.
    """
    return (1 + (data.lat.size - k) // stride)*(1 + (data.lon.size - k) // stride)