improved stats_area cpu time

. switched the two inner cycles: first cycles through grid files, then
nodes, then layers.