The ESS under spatial variation with applications to sex allocation.