Fork of DIWASP code from http://www.metocean.co.nz/support/resources/