Numerical software for sequential or parallel machines with memory hierarchies can benefit from locality optimizations which are usually achieved by program restructuring or program transformations. The choice of the program version that achieves the best performance is usually complex as many dependencies have to be taken into account. Thus program-based locality measures have been introduced to give programmers a guideline if a performance gain can be expected from a program restructuring. The novel contribution of this paper is the extension of these locality measures to support spatial locality. These extended measures are applied to two applications from scientific computing and the obtained prediction is compared to benchmark results.