Parallelizing the spectral method in climate and weather modeling