mpas_tools.mesh.mask.compute_lon_lat_region_masks

mpas_tools.mesh.mask.compute_lon_lat_region_masks(lon, lat, fcMask, 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) on a tensor lon/lat grid

Parameters:
  • lon (numpy.ndarray) – A 1D array of longitudes in degrees between -180 and 180

  • lat (numpy.ndarray) – A 1D array of latitudes in degrees between -90 and 90

  • fcMask (geometric_features.FeatureCollection) – A feature collection containing features to use to create the mask

  • 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