lt_toolbox.TrajFrame.transform_trajectory_coords#
- TrajFrame.transform_trajectory_coords(lon: ndarray, lat: ndarray, depth: ndarray)[source]#
Transform trajectories from model grid coordinates {i,j,k} to geographical coordinates {lon, lat, depth}.
Lagrangian trajectory positions are (bi-)linearly interpolated from the specified ocean general circulation model grid.
Both z and terrain following sigma vertical coordinate systems are supported.
- Parameters:
lon (ndarray) – Longitudes associated with the center of each model grid cell. This must be specified as a 2-D array with dimensions {j, i}.
lat (ndarray) – Latitudes associated with the center of each model grid cell. This must be specified as a 2-D array with dimensions {j, i}.
depth (ndarray) – Depths associated with model vertical grid levels. This must be as specified as either a 1-D array with dimensions {k} or a 3-D array with dimensions {k, j, i}.
- Returns:
TrajFrame containing Lagrangian trajectories in geographical coords {lon, lat, depth}.
- Return type:
TrajFrame
Examples
Transforming Lagrangian trajectories with positions referenced to model coordinate system {x, y, z} to geographical coordinates {lon, lat, depth} using the ocean general circulation horizontal and vertical model grids. Here, we show a simple example for the Nucleus for European Modelling of the Ocean ORCA C-grid with a z-level vertical coordinate system:
>>> lon_mdl = ds_grid.nav_lon.values >>> lat_mdl = ds_grid.nav_lat.values >>> depth_mdl = ds_grid.nav_lev.values >>> trajectories.transform_trajectory_coords(lon=lon_mdl, lat=lat_mdl, depth=depth_mdl)