colawater.toolbox.calculate_fids.tool#

Contains the functions used by the Calculate Facility Identifiers tool and other helper functions.

Module Contents#

Functions#

execute(→ None)

Entry point for Calculate Facility Identifiers.

parameters(→ list[arcpy.Parameter])

Returns the parameters for Calculate Facility Identifiers.

calculate_fids(→ Optional[int])

Calculates the facility identifiers for the provided layer.

colawater.toolbox.calculate_fids.tool.execute(parameters: list[arcpy.Parameter]) None#

Entry point for Calculate Facility Identifiers.

Calculates the new facility identifiers for features with given placeholder initials starting from a given start value.

Parameters:

parameters (list[arcpy.Parameter]) – The list of parameters.

colawater.toolbox.calculate_fids.tool.parameters() list[arcpy.Parameter]#

Returns the parameters for Calculate Facility Identifiers.

Parameters are of type GPString, GPLong, GPFeatureLayer multivalue, and 7 GPLong.

Returns:

The list of parameters.

Return type:

list[arcpy.Parameter]

colawater.toolbox.calculate_fids.tool.calculate_fids(layer: arcpy._mp.Layer, start: int, interval: int, initials: str, affix_template: str, calculate_fid_index: bool) int | None#

Calculates the facility identifiers for the provided layer.

Also updates the substituted initials with the new facility identifiers in the provided layer.

Parameters:
  • layer (arcpy._mp.Layer) – The layer value.

  • start (int) – The start value.

  • interval (int) – The interval to increment the facility identifier.

  • initials (str) – The initials to replace with the calculated facility identifiers.

  • affix_template (str) – A format string with one anonymous brace pair.

  • calculate_fid_index (bool) – Whether to calculate the FID indices for layer.

Returns:

The final facility identifier value, plus one interval to be used

as an input for the next tool execution, or None if no values matching initials were found.

Return type:

Optional[int]

Raises:

ExecuteError – An error ocurred in the tool execution.

Note

Modifies input layer.