# latitude derivations

1. latitude from polygon

   symbol | description | unit | variable name
   --- | --- | --- | ---
   \(\lambda\) | longitude | \(degE\) | longitude {:}
   \(\lambda^{B}(i)\) | longitude | \(degE\) | longitude_bounds {:,N}
   \(\phi\) | latitude | \(degN\) | latitude {:}
   \(\phi^{B}(i)\) | latitude | \(degN\) | latitude_bounds {:,N}

   Convert all polygon corner coordinates defined by \(\phi^{B}(i)\) and \(\lambda^{B}(i)\) into unit sphere points \(\mathbf{p}(i) = [x_{i}, y_{i}, z_{i}]\)

   \(x_{min} = min(x_{i}), y_{min} = min(y_{i}), z_{min} = min(z_{i})\)

   \(x_{max} = max(x_{i}), y_{max} = max(y_{i}), z_{max} = max(z_{i})\)

   \(\mathbf{p}_{center} = [\frac{x_{min} + x_{max}}{2}, \frac{y_{min} + y_{max}}{2}, \frac{z_{min} + z_{max}}{2}]\)

   The vector \(\mathbf{p}_{center}\) is converted back to \(\phi\) and \(\lambda\)

2. latitude from range

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

   The pattern : for the dimensions can represent {latitude}, or {time,latitude}.

   \[\phi = \frac{\phi^{B}(2) + \phi^{B}(1)}{2}\]

3. latitude from vertical profile latitudes

   symbol | description | unit | variable name
   --- | --- | --- | ---
   \(\phi\) | single latitude for the full profile | \(degN\) | latitude {:}
   \(\phi(i)\) | latitude for each profile point | \(degN\) | latitude {:,vertical}
   \(N\) | number of profile points |  |

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

   \[\begin{split}\begin{eqnarray} N & = & max(i, \phi(i) \neq NaN) \\ \phi & = & \phi(N/2) \end{eqnarray}\end{split}\]

4. latitude from sensor latitude

   symbol | description | unit | variable name
   --- | --- | --- | ---
   \(\phi\) | latitude | \(degN\) | latitude {:}
   \(\phi_{instr}\) | latitude of the sensor | \(degN\) | sensor_latitude {:}

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

   \[\phi = \phi_{instr}\]