urclib.create_pe_grid
Create grid to be used for PE Scoring.
Module Contents
Functions
|
Clip one layer with the geometry of another. |
|
Calculates index field for an STA domain type. |
|
Index domain for Layer in dataset. |
|
Copy a layer, optionally applying a spatial transformation. |
|
Create PE_Grid step 1 of 3: Create indexes for local grids and SD, LD, SA domains |
|
Create PE_Grid step 2 of 3: Calculate unique domains (UD). |
|
Create a series of index rasters representing the gridded version of a collection |
- urclib.create_pe_grid.clip_layer(scratch_ds, input_layer, clipping_layer)
Clip one layer with the geometry of another.
- Parameters:
scratch_ds (gdal.Dataset) – Dataset to hold newly created layer.
input_layer (ogr.Layer) – The layer to be clipped.
clipping_layer (ogr.Layer) – The layer to clip by.
- Returns:
The newly clipped layer.
- Return type:
ogr.Layer
- urclib.create_pe_grid.index_calc(domain_type, lyr)
Calculates index field for an STA domain type.
- Parameters:
domain_type (str) – Name of the domain type. Only the following two-letter strings should be used: * ‘LD’ (lithologic domain) * ‘SD’ (structural domain) * ‘SA’ (secondary alteration)
lyr (osgeo.ogr.Layer) –
- Returns:
- A copy of the input dataset with a new field for the domain index.
IMPORTANT: This file will be saved to the same directory as domainDS.
- Return type:
osgeo.gdal.Dataset
- urclib.create_pe_grid.index_domain_type(domain_type, input_ds, lyr)
Index domain for Layer in dataset.
- Parameters:
domain_type (str) – Name of the domain type. Only the following two-letter strings should be used: * ‘LD’ (lithologic domain) * ‘SD’ (structural domain) * ‘SA’ (secondary alteration)
input_ds (osgeo.gdal.Dataset) – The loaded dataset.
lyr (osgeo.ogr.Layer) – The target layer from input_ds
- Returns:
- Containing the following:
osgeo.gdal.Dataset: The newly indexed Dataset or input_ds if indexing not needed.
osgeo.ogr.Layer: The newly created layer or lyr if indexing not needed.
- Return type:
tuple
- urclib.create_pe_grid.copy_layer(scratch_ds, in_path, sref=None)
Copy a layer, optionally applying a spatial transformation.
- Parameters:
scratch_ds (osgeo.gdal.Dataset) – The Dataset to store the copied layer.
in_path (str) – Path to dataset containing Layer to copy (at index 0).
sref (osgeo.osr.SpatialReference,optional) – Optional Spatial Reference to apply
- Returns:
The new copy of the layer residing in scratch_ds, properly reprojected if needed.
- Return type:
osgeo.ogr.Layer
- urclib.create_pe_grid.build_indices(workspace, outputs, cell_width, cell_height, sref=None)
Create PE_Grid step 1 of 3: Create indexes for local grids and SD, LD, SA domains
- Parameters:
workspace (common_utils.UrcWorkspace) – Input workspace object.
outputs (common_utils.UrcWorkspace) – Output workspace object.
cell_width (float) – The height to apply to generated grid; units derived from ds.
cell_height (float) – The width to apply to generated grid; units derived from ds.
sref (osgeo.osr.SpatialReference,optional) – Optional spatial reference to apply.
- Returns:
- Contains the following:
osgeo.gdal.Dataset: The mask layer.
numpy.ndarray: LD data.
numpy.ndarray: SD data.
- Return type:
tuple
- urclib.create_pe_grid.calc_unique_domains(inmask, in_sd_data, in_ld_data, in_sa_data, outputs, nodata=-9999)
Create PE_Grid step 2 of 3: Calculate unique domains (UD).
- Parameters:
inmask (osgeo.gdal.Dataset) – The mask raster layer.
in_sd_data (np.ndarray) – The SD indices conforming to the dimensions of in_mask.
in_ld_data (np.ndarray) – The LD indices conforming to the dimensions of in_mask.
in_sa_data (np.ndarray) – The SA indices conforming to the dimensions of in_mask.
outputs (common_utils.UrcWorkspace) – The outputs workspace object.
nodata (int,optional) – The value to use to represent “no data” pixels. defaults to -9999.
- urclib.create_pe_grid.run_create_pe_grid(workspace, out_workspace, gridwidth, gridheight, epsg=None, post_prog=None)
Create a series of index rasters representing the gridded version of a collection of vector records.
- Parameters:
workspace (UrcWorkspace) – Container for all input filepaths.
out_workspace (UrcWorkspace) – Container for all output filepaths.
gridwidth (int) – The desired width of the grid, in cells.
gridheight (int) – The desired height of the grid, in cells.
epsg (int) – Optional code for applying custom projection.
post_prog (function,optional) – Optional function to deploy for updating incremental progress feedback. function should expect a single integer as its argument, in the range of [0,100]