# latitude bounds derivations

1. latitude ranges from midpoints

   symbol | description | unit | variable name
   --- | --- | --- | ---
   \(\phi(i)\) | latitude | \(degN\) | latitude {:,latitude}
   \(\phi^{B}(i,l)\) | latitude boundaries (\(l \in \{1,2\}\)) | \(degN\) | latitude_bounds {:,latitude,2}

   The pattern : for the dimensions can represent {time}, or no dimension at all.

   \begin{eqnarray} \phi^{B}(1,1) & = & \frac{3\phi(1) - \phi(2)}{2} \\ \phi^{B}(i,1) & = & \frac{\phi(i-1) + \phi(i)}{2}, 1 < i \leq N \\ \phi^{B}(i,2) & = & \phi^{B}(i+1,1), 1 \leq i < N \\ \phi^{B}(N,2) & = & \frac{3\phi(N) - \phi(N-1)}{2} \end{eqnarray}

   This formula applies if the harp option `regrid_out_of_bounds` is set to `nan` or to `extrapolate`. If the option is set to `edge` then the first and last boundary value are set to the midpoints (\(\phi^{B}(1,1) = \phi(1)\), \(\phi^{B}(N,2) = \phi(N)\)).

   Note that all latitude values will always be clamped to the range \([-90,90]\).