Public Documentation

Documentation for CubedSphere.jl's public interface.

See the Internals section of the manual for internal package docs covering all submodules.

CubedSphere

CubedSphere.cartesian_to_lat_lonMethod
cartesian_to_lat_lon(x, y, z)

Convert 3D cartesian coordinates (x, y, z) on the sphere to latitude-longitude. Returns a tuple (latitude, longitude) in degrees.

The equatorial plane falls at $z = 0$, latitude is the angle measured from the equatorial plane, and longitude is measured anti-clockwise (eastward) from $x$-axis ($y = 0$) about the $z$-axis.

Examples

Find latitude-longitude of the North Pole

julia> using CubedSphere

julia> x, y, z = (0, 0, 6.4e6); # cartesian coordinates of North Pole [in meters]

julia> cartesian_to_lat_lon(x, y, z)
(90.0, 0.0)

Let's confirm that for few points on the unit sphere we get the answers we expect.

julia> cartesian_to_lat_lon(√2/4, -√2/4, √3/2)
(59.99999999999999, -45.0)

julia> cartesian_to_lat_lon(-√6/4, √2/4, -√2/2)
(-45.00000000000001, 150.0)
source
CubedSphere.conformal_cubed_sphere_inverse_mappingMethod
conformal_cubed_sphere_inverse_mapping(X, Y, Z; Z_map=Z_Rancic)

Inverse mapping for conformal cube sphere for quadrant of North-pole face in which X and Y are both positive. All other mappings to other cube face coordinates can be recovered from rotations of this map. There a 3 other quadrants for the north-pole face and five other faces for a total of twenty-four quadrants. Because of symmetry only the reverse for a single quadrant is needed. Because of branch cuts and the complex transform the inverse mappings are multi-valued in general, using a single quadrant case allows a simple set of rules to be applied.

The mapping is valid for the cube face quadrant defined by $0 < x < 1$ and $0 < y < 1$, where a full cube face has extent $-1 < x < 1$ and $-1 < y < 1$. The quadrant for the mapping is from a cube face that has "north-pole" at its center $(x=0, y=0)$. i.e., has X, Y, Z = (0, 0, 1) at its center. The valid ranges of X and Y for this mapping and convention are a quadrant defined be geodesics that connect the points A, B, C and D, on the shell of a sphere of radius $R$ with X, Y coordinates as follows

A = (0, 0)
B = (√2, 0)
C = (√3/3, √3/3)
D = (0, √2)
source
CubedSphere.conformal_cubed_sphere_mappingMethod
conformal_cubed_sphere_mapping(x, y; W_map=W_Rancic)

Conformal mapping from a face of a cube onto the equivalent sector of a sphere with unit radius.

Map the north-pole face of a cube with coordinates $(x, y)$ onto the equivalent sector of the sphere with coordinates $(X, Y, Z)$.

The cube's face oriented normal to $z$-axis and its coordinates must lie within the range $-1 ≤ x ≤ 1$, $-1 ≤ y ≤ 1$ with its center at $(x, y) = (0, 0)$. The coordinates $X, Y$ increase in the same direction as $x, y$.

The numerical conformal mapping used here is described by Rančić et al. [1].

This is a Julia translation of MATLAB code from MITgcm that is based on Fortran 77 code from Jim Purser & Misha Rančić.

Examples

The center of the cube's face $(x, y) = (0, 0)$ is mapped onto $(X, Y, Z) = (0, 0, 1)$

julia> using CubedSphere

julia> conformal_cubed_sphere_mapping(0, 0)
(0, 0, 1.0)

and the edge of the cube's face at $(x, y) = (1, 1)$ is mapped onto $(X, Y, Z) = (√3/3, √3/3, √3/3)$

julia> using CubedSphere

julia> conformal_cubed_sphere_mapping(1, 1)
(0.5773502691896256, 0.5773502691896256, 0.5773502691896257)

References

  • [1] Rančić et al., Q. J. R. Meteorol., (1996).
source