View preprocessing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import lru_cache | |
from typing import Union, List, Optional | |
from arcgis.geoenrichment import Country | |
from arcgis.geometry import Polygon | |
import numpy as np | |
import pandas as pd | |
from sklearn.base import BaseEstimator, TransformerMixin | |
__all__ = ['EnrichBase', 'EnrichPolygon', 'EnrichStandardGeography', 'KeepOnlyEnrichColumns', 'ArrayToDataFrame'] |
View hashing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hashlib import md5 | |
import pandas as pd | |
from typing import Optional, Iterable | |
def get_md5_from_series(input_iterable: Iterable) -> str: | |
""" | |
Create a MD5 hash from an Iterable, typically a row from a Pandas ``DataFrame``, but can be any | |
Iterable object instance such as a list, tuple or Pandas ``Series``. | |
Args: |
View get_logger.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from pathlib import Path | |
from typing import Union | |
def get_logger(log_path: Union[str, Path] = 'logfile.log', log_name: str = 'logger', log_level: int = logging.ERROR): | |
""" | |
Standardized way to create a console and file logger in one. | |
Args: |
View get_sys_info.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psutil | |
import platform | |
from datetime import datetime | |
def get_size(bytes, suffix="B"): | |
""" | |
Scale bytes to its proper format | |
e.g: | |
1253656 => '1.20MB' | |
1253656678 => '1.17GB' |
View polsby_popper.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from arcgis.geometry import Polygon | |
def get_simplified_polygon(geometry: Polygon, simplification_factor: float = 0.1) -> Polygon: | |
# ensure working with a polygon | |
assert isinstance(geometry, Polygon) |
View environment.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: arcgis | |
channels: | |
- esri | |
- conda-forge | |
dependencies: | |
- arcgis | |
- arcpy | |
- jupyterlab |
View test_pro_version.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pro_at_least_version(version: str) -> bool: | |
""" | |
Test the current ArcGIS Pro version to be equal or greater than. | |
Args: | |
version: Version number eg ('2', '2.1', '2.8.1') | |
Returns: | |
Boolean indicating if version is at least or greater than specified version. | |
""" | |
# late import since may or may not already be loaded |
View od-nax.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View enrichment-introspection.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View arcade_commute.arcade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
$feature.commute_ACSTWORKU5 * 2.5 | |
+ $feature.commute_ACSTWORK5 * 7.0 | |
+ $feature.commute_ACSTWORK10 * 12.0 | |
+ $feature.commute_ACSTWORK15 * 17.0 | |
+ $feature.commute_ACSTWORK20 * 22.0 | |
+ $feature.commute_ACSTWORK25 * 27.0 | |
+ $feature.commute_ACSTWORK30 * 32.0 | |
+ $feature.commute_ACSTWORK35 * 37.0 | |
+ $feature.commute_ACSTWORK40 * 42.0 |
NewerOlder