Milestone 1 - Spherical coordinates

The shape of Earth is very close to a sphere with radius of about 6378 km. Therefore, the geometrical model of Earth is reasonably given by the surface of a sphere in our 2D climate model.

There are several conventions for spherical coordinates. In the geographic coordinate system, we speak of latitude/colatitude and longitude:

  • Latitude (θ\theta): North-south direction. Latitude lines are parallel to the equator and are assigned the angle from the equator.

  • Colatitude (θ~\tilde \theta): Complementary angle from a given latitude (meassured from the north pole).

LocationLatitudeColatitude
North pole90°
Equator90°
South pole-90°180°
  • Longitude (φ\varphi): East-West direction. Longitude lines are perpendicular to the equator with range West -180° to East +180°.

  • Latitude and Longitude. Source: Wikipedia, Public Domain.

Remark 1: The values of longitude and latitude can be given in radians or degrees.
Remark 2: In geography, the generation of a map with long/lat values of a location always depends on the choice of a reference system: the so-called geodetic datum. The geodetic datum is a reference ellipsoid. Only in combination (map+geodetic datum) the coordinates are precise and can be compared.

We consider the spherical coordinate system, in which all points in the three-dimensional space can be located using three variables:

  • Radius (rR, 0r<r \in \mathbb R, \, 0 \le r < \infty),

  • Latitude (θR, π/2θ<π/2\theta \in \mathbb R, \, -\pi/2 \le \theta < \pi/2) or colatitude (θ~R, 0θ~<π\tilde \theta \in \mathbb R, \, 0 \le \tilde \theta < \pi),

  • Longitude: φR, 0φ<2π\varphi \in \mathbb R, \, 0 \le \varphi < 2\pi.

We can map any point in absolute Cartesian coordinates (x,y,zx,y,z) to spherical coordinates (r,θ~,φr,\tilde \theta,\varphi) using the following transformations:

x=rsinθ~cosφ,r=x2+y2+z2,y=rsinθ~sinφ,θ~=arctan(x2+y2z),z=rcosθ~,φ=arctan(y/z).\begin{aligned} x &= r \sin \tilde \theta \cos \varphi, & r &= \sqrt{x^2 + y^2 + z^2},\\ y &= r \sin \tilde \theta \sin \varphi, & \tilde \theta &= \arctan \left(\frac{x^2 + y^2}{z} \right),\\ z &= r \cos \tilde \theta, & \varphi &= \arctan(y/z). \end{aligned}

From mathematical analysis, we know that the Jacobian of the coordinate transformation is given by

xr=sinθ~cosφ,xφ=rsinθ~sinφ,xθ~=rcosθ~cosφyr=sinθ~sinφ,yφ=rsinθ~cosφ,yθ~=rcosθ~sinφzr=cosθ~,zφ=0,zθ~=rsinθ~,\begin{aligned} \frac{\partial { x}}{\partial { r} } &= \sin \tilde \theta \cos \varphi, & \frac{\partial { x}}{\partial { \varphi} } &= -r \sin \tilde \theta \sin \varphi, & \frac{\partial { x}}{\partial { \tilde \theta} } &= r \cos \tilde \theta \cos \varphi \\ \frac{\partial { y}}{\partial { r} } &= \sin \tilde \theta \sin \varphi, & \frac{\partial { y}}{\partial { \varphi} } &= r \sin \tilde \theta \cos \varphi, & \frac{\partial { y}}{\partial { \tilde \theta} } &= r \cos \tilde \theta \sin \varphi \\ \frac{\partial { z}}{\partial { r} } &= \cos \tilde \theta, & \frac{\partial { z}}{\partial { \varphi} } &= 0, & \frac{\partial { z}}{\partial { \tilde \theta} } &= -r \sin \tilde \theta, \end{aligned}

respectively in matrix form

J=(x,y,z)(r,φ,θ~)=[sinθ~cosφrsinθ~sinφrcosθ~cosφsinθ~sinφrsinθ~cosφrcosθ~sinφcosθ~0rsinθ~]R3×3,\begin{aligned} J = \frac{\partial { (x,y,z)}}{\partial { (r,\varphi,\tilde \theta)} } = \begin{bmatrix} \sin \tilde \theta \cos \varphi & -r \sin \tilde \theta \sin \varphi & r \cos \tilde \theta \cos \varphi \\ \sin \tilde \theta \sin \varphi & r \sin \tilde \theta \cos \varphi & r \cos \tilde \theta \sin \varphi \\ \cos \tilde \theta & 0 & -r \sin \tilde \theta \end{bmatrix} \in \mathbb R^{3 \times 3}, \end{aligned}

with the determinant

J=r2sinθ~. |J|=r^2 \sin \tilde \theta.
Example: The coordinate transformation can be used to compute the volume of a sphere with radius RR: VdV=Vdxdydz=r=0Rθ~=0πφ=02πJdrdθ~dφ=4πR33\begin{aligned} \iiint_{V} \mathrm{d} V &= \iiint_{V} \mathrm{d} x \mathrm{d} y \mathrm{d} z \\ &= \int_{r=0}^R \int_{\tilde \theta=0}^{\pi} \int_{\varphi=0}^{2\pi} |J| \mathrm{d} r \mathrm{d} \tilde \theta \mathrm{d} \varphi\\ &= \frac{4\pi R^3}{3} \end{aligned}

Created by Gregor Gassner and Andrés Rueda-Ramírez with contributions by Simone Chiocchetti, Daniel Bach, Sophia Horak, Philipp Baasch, Benjamin Bolm, Erik Faulhaber, and Luca Sommer. Last modified: April 02, 2026. Website built with Franklin.jl and the Julia programming language.