environmentaltools.spatial.local_to_global_coords
- environmentaltools.spatial.local_to_global_coords(x_loc, y_loc, alpha, lon_0_glob, lat_0_glob)[source]
Transform local rotated coordinates back to global coordinate system.
Inverse transformation of global_to_local_coords. Converts coordinates from local rotated reference system back to the global coordinate system.
- Parameters:
x_loc (float or np.ndarray) – Local X coordinates (along rotated axis)
y_loc (float or np.ndarray) – Local Y coordinates (perpendicular to rotated axis)
alpha (float) – Rotation angle in degrees that defines the local coordinate system
lon_0_glob (float) – Global X coordinate of local system origin
lat_0_glob (float) – Global Y coordinate of local system origin
- Returns:
x_glob (float or np.ndarray) – Global X coordinates (e.g., UTM easting or longitude)
y_glob (float or np.ndarray) – Global Y coordinates (e.g., UTM northing or latitude)
Notes
The transformation applies: 1. Inverse rotation by angle -alpha 2. Translation to restore original origin
This function is the mathematical inverse of global_to_local_coords.
Examples
>>> x_loc, y_loc = 70.71, 70.71 >>> x_glob, y_glob = local_to_global_coords(x_loc, y_loc, 45, 0, 0) >>> print(f"Global: ({x_glob:.2f}, {y_glob:.2f})")