The Kadomtsev-Petviashvili (KP) equation appears in the approximate treatment of many weakly two-dimensional wave phenomena in physics as waves in shallow water. The equation has explicit solutions in terms of multi-dimensional theta functions on an arbitrary Riemann surfaces. The picture/animation describes a solution given on a hyperelliptic Riemann surface of genus 4, i.e. a compact surface with 4 holes. In general the corresponding solutions are almost periodic. When the holes of the surface shrink to points, the solution reduces to the four-soliton solution and solitary waves appear (see the previous picture). The theta function solutions are numerically evaluated using spectral methods.