modeling.utils module¶
Utility functions useful for the modeling module - the glue functions not fitting neatly anywhere else.
-
modeling.utils.
can_enrich_gis
(user)¶ Determine if the provided user has data enrichment privileges in the Web GIS.
Note
The current user can be retrieved using gis.users.me for input.
- Parameters
user (
User
) – Required arcgis.gis.User object instance.- Return type
- Returns
Boolean indicating if the provided user has enrichment privileges in the Web GIS.
-
modeling.utils.
geography_iterable_to_arcpy_geometry_list
(geography_iterable, geometry_filter=None)¶ Processing helper to convert a iterable of geography_levels to a list of ArcPy Geometry objects suitable for input into ArcGIS ArcPy geoprocessing tools.
-
modeling.utils.
get_sanitized_names
(names)¶ Sanitize the column names using the GeoAccessor.sanitize_column_names function. Useful when trying to match up column names from previously enriched data.
Note
This process is, especially with long lists, painfully slow, so only use if absolutely necessary.
-
modeling.utils.
get_spatially_enabled_dataframe
(input_object, spatial_column='SHAPE')¶ Garbage disposal taking variety of possible inputs and outputting, if possible, a Spatially Enabled Pandas DataFrame.
- Return type
DataFrame
-
modeling.utils.
get_top_codes
(codes, threshold=0.5)¶ Get the top category codes by only keeping those compromising 50% or greater of the records.
-
modeling.utils.
has_networkanalysis_gis
(user, network_function=None)¶ Determine if the provided user has network analysis privileges in the Web GIS.
Note
The current user can be retrieved using gis.users.me for input.
- Parameters
user (
User
) – Required arcgis.gis.User object instance.network_function (
Optional
[str
]) – Optional string describing specific network function to check for. Valid values include ‘closestfacility’, ‘locationallocation’, ‘optimizedrouting’, ‘origindestinationcostmatrix’, ‘routing’, ‘servicearea’, or ‘vehiclerouting’.
Returns: Boolean indicating if the provided user has network analysis privileges in the Web GIS.
- Return type
-
modeling.utils.
local_business_analyst_avail
()¶ Check if a local installation of Business Analyst is available.
- Return type
-
modeling.utils.
local_vs_gis
(fn)¶ Decorator to facilitate bridging between local and remote resources.
-
modeling.utils.
module_avail
(module_name)¶ Determine if module is available in this environment.
- Return type
-
modeling.utils.
preproces_code_inputs
(codes)¶ helper funtion to preprocess naics or sic codes
-
modeling.utils.
set_source
(in_source=None)¶ Helper function to check source input. The source can be set explicitly, but if nothing is provided, it assumes the order of local first and then a Web GIS. Along the way, it also checks to see if a GIS object instance is available in the current session.
-
modeling.utils.
validate_spatial_reference
(spatial_reference)¶ Validate the variety of ways a spatial reference can be inputted. This does not validate the WKID.