gnomonic
lat_tile_east_west_edge(alpha, dely, south_north_tile_index)
local_gnomonic_ed(lon, lat, npx, west_edge, east_edge, south_edge, north_edge, global_is, global_js, np, rank)
normalize_vector(np, *vector_components)
normalize_xyz(xyz)
lon_lat_midpoint(lon1, lon2, lat1, lat2, np)
xyz_midpoint(*points)
lon_lat_corner_to_cell_center(lon, lat, np)
lon_lat_to_xyz(lon, lat, np)
map (lon, lat) to (x, y, z) Args: lon: 2d array of longitudes lat: 2d array of latitudes np: numpy-like module for arrays Returns: xyz: 3d array whose last dimension is length 3 and indicates x/y/z value
xyz_to_lon_lat(xyz, np)
map (x, y, z) to (lon, lat) Returns: xyz: 3d array whose last dimension is length 3 and indicates x/y/z value np: numpy-like module for arrays Returns: lon: 2d array of longitudes lat: 2d array of latitudes
symm_ed(lon, lat)
great_circle_distance_along_axis(lon, lat, radius, np, axis=0)
Returns the great-circle distance between points along the desired axis.
great_circle_distance_lon_lat(lon1, lon2, lat1, lat2, radius, np)
great_circle_distance_xyz(p1, p2, radius, np)
get_area(lon, lat, radius, np)
Given latitude and longitude on cell corners, return the area of each cell.
set_corner_area_to_triangle_area(lon, lat, area, tile_partitioner, rank, radius, np)
Given latitude and longitude on cell corners, and an array of cell areas, set the four corner areas to the area of the inner triangle at those corners.
set_c_grid_tile_border_area(xyz_dgrid, xyz_agrid, radius, area_cgrid, tile_partitioner, rank, np)
Using latitude and longitude without halo points, fix C-grid area at tile edges and corners. Naively, the c-grid area is calculated as the area between the rectangle at the four corners of the grid cell. At tile edges however, this is not accurate, because the area makes a butterfly-like shape as it crosses the tile boundary. Instead we calculate the area on one side of that shape, and multiply it by two. At corners, the corner is composed of three rectangles from each tile bordering the corner. We calculate the area from one tile and multiply it by three. Args: xyz_dgrid: d-grid cartesian coordinates as a 3-d array, last dimension of length 3 indicating x/y/z xyz_agrid: a-grid cartesian coordinates as a 3-d array, last dimension of length 3 indicating x/y/z area_cgrid: 2d array of c-grid areas radius: radius of Earth in metres tile_partitioner: partitioner class to determine subtile position rank: rank of current tile np: numpy-like module to interact with arrays
set_tile_border_dxc(xyz_dgrid, xyz_agrid, radius, dxc, tile_partitioner, rank, np)
set_tile_border_dyc(xyz_dgrid, xyz_agrid, radius, dyc, tile_partitioner, rank, np)
get_rectangle_area(p1, p2, p3, p4, radius, np)
Given four point arrays whose last dimensions are x/y/z in clockwise or counterclockwise order, return an array of spherical rectangle areas. NOTE, this is not the exact same order of operations as the Fortran code This results in some errors in the last digit, but the spherical_angle is an exact match. The errors in the last digit multiplied out by the radius end up causing relative errors larger than 1e-14, but still within 1e-12.
get_triangle_area(p1, p2, p3, radius, np)
Given three point arrays whose last dimensions are x/y/z, return an array of spherical triangle areas.
fortran_vector_spherical_angle(e1, e2, e3)
The Fortran version Given x/y/z tuples, compute the spherical angle between them according to: ! p3 ! / ! / ! p_center ---> angle ! ! ! p2 This angle will always be less than Pi.
spherical_angle(p_center, p2, p3, np)
Given ndarrays whose last dimension is x/y/z, compute the spherical angle between
them according to:
! p3 ! / ! / ! p_center ---> angle ! ! ! p2 This angle will always be less than Pi.
spherical_cos(p_center, p2, p3, np)
As Spherical angle, but returns cos(angle)
get_unit_vector_direction(p1, p2, np)
Returns the unit vector pointing from a set of lonlat points p1 to lonlat points p2
get_lonlat_vect(lonlat_grid, np)
Calculates the unit vectors pointing in the longitude/latitude directions for a set of longitude/latitude points