mpas_tools.mesh.mask.compute_mpas_transect_masks¶
- mpas_tools.mesh.mask.compute_mpas_transect_masks(dsMesh, fcMask, earthRadius, maskTypes=('cell', 'edge', 'vertex'), logger=None, pool=None, chunkSize=1000, showProgress=False, subdivisionResolution=10000.0, addEdgeSign=False)[source]¶
Use shapely and processes to create a set of masks from a feature collection made up of transects (line strings)
- Parameters:
dsMesh (xarray.Dataset) – An MPAS mesh on which the masks should be created
fcMask (geometric_features.FeatureCollection) – A feature collection containing features to use to create the mask
earthRadius (float) – The radius of the earth in meters
maskTypes (tuple of {'cell', 'edge', 'vertex'}, optional) – Which type(s) of masks to make. Masks are created based on whether the latitude and longitude associated with each of these locations (e.g.
dsMesh.latCell
anddsMesh.lonCell
for'cells'
) are inside or outside of the transects infcMask
.logger (logging.Logger, optional) – A logger for the output if not stdout
pool (multiprocessing.Pool, optional) – A pool for performing multiprocessing
chunkSize (int, optional) – The number of cells, vertices or edges that are processed in one operation. Experimentation has shown that 1000 is a reasonable compromise between dividing the work into sufficient subtasks to distribute the load and having sufficient work for each thread.
showProgress (bool, optional) – Whether to show a progress bar
subdivisionResolution (float, optional) – The maximum resolution (in meters) of segments in a transect. If a transect is too coarse, it will be subdivided. Pass
None
for no subdivision.addEdgeSign (bool, optional) – Whether to add the
edgeSign
variable, which requires significant extra computation
- Returns:
dsMask (xarray.Dataset) – The masks