mpas_tools.mesh.mask.compute_mpas_region_masks¶
- mpas_tools.mesh.mask.compute_mpas_region_masks(dsMesh, fcMask, maskTypes=('cell', 'vertex'), logger=None, pool=None, chunkSize=1000, showProgress=False, subdivisionThreshold=30.0)[source]¶
Use shapely and processes to create a set of masks from a feature collection made up of regions (polygons)
- 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
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 regions 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
subdivisionThreshold (float, optional) – A threshold in degrees (lon or lat) above which the mask region will be subdivided into smaller polygons for faster intersection checking
- Returns:
dsMask (xarray.Dataset) – The masks