diff --git a/spatial-data-science/scripts/build/lib/heatri/__init__.py b/spatial-data-science/scripts/build/lib/heatri/__init__.py deleted file mode 100644 index e784f62..0000000 --- a/spatial-data-science/scripts/build/lib/heatri/__init__.py +++ /dev/null @@ -1,58 +0,0 @@ - -from .heat_risk_index import hri_main -from arcgis.geometry import Envelope -from arcpy import Extent as PyExtent, SpatialReference as PySpatialReference -import json -import os - - - -def calculate_heat_risk_index_using_extent(extent: Envelope) -> str: - """ - Calculates the heat risk index for a defined geographic region. - - :return: The local path to the calculated heat risk index spatial bin features. - """ - - landsat_surf_temp = "https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer" - land_cover = "https://tiledimageservices.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/European_Space_Agency_WorldCover_2021_Land_Cover_WGS84_7/ImageServer" - zensus_2022 = "https://services2.arcgis.com/jUpNdisbWqRpMo35/arcgis/rest/services/Zensus2022_grid_final/FeatureServer/0" - - if not 'spatialReference' in extent: - raise ValueError('The extent has no spatial reference!') - - extent_spatial_reference = extent['spatialReference'] - if not 'wkid' in extent_spatial_reference: - raise ValueError('The extent has no wkid!') - - wkid = extent_spatial_reference['wkid'] - spatial_reference = PySpatialReference(wkid) - extent = PyExtent(XMin=extent['xmin'], YMin=extent['ymin'], XMax=extent['xmax'], YMax=extent['ymax'], spatial_reference=spatial_reference) - hri_spatial_bins = hri_main(landsat_surf_temp, land_cover, zensus_2022, extent, spatial_reference) - return hri_spatial_bins - -def calculate_heat_risk_index(x_min: float, y_min: float, x_max: float, y_max: float, wkid: int) -> str: - """ - Calculates the heat risk index for a defined geographic region. - - :return: The local path to the calculated heat risk index spatial bin features. - """ - - landsat_surf_temp = "https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer" - land_cover = "https://tiledimageservices.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/European_Space_Agency_WorldCover_2021_Land_Cover_WGS84_7/ImageServer" - zensus_2022 = "https://services2.arcgis.com/jUpNdisbWqRpMo35/arcgis/rest/services/Zensus2022_grid_final/FeatureServer/0" - - spatial_reference = PySpatialReference(wkid) - extent = PyExtent(XMin=x_min, YMin=y_min, XMax=x_max, YMax=y_max, spatial_reference=spatial_reference) - hri_spatial_bins = hri_main(landsat_surf_temp, land_cover, zensus_2022, extent, spatial_reference) - return hri_spatial_bins - -def generate_renderer() -> dict: - """ - Generates the heat index renderer. - - :return: The class breaks renderer as dict. - """ - - with open(os.path.join(os.path.dirname(__file__), 'data', 'hri-renderer.json'), mode='r', encoding='utf8') as in_stream: - return json.load(in_stream) \ No newline at end of file diff --git a/spatial-data-science/scripts/build/lib/heatri/data/hri-renderer.json b/spatial-data-science/scripts/build/lib/heatri/data/hri-renderer.json deleted file mode 100644 index c2693a4..0000000 --- a/spatial-data-science/scripts/build/lib/heatri/data/hri-renderer.json +++ /dev/null @@ -1,1034 +0,0 @@ -{"type": "classBreaks", - "visualVariables": [], - "rotationType": "arithmetic", - "minValue": 0, - "field": "HRI", - "defaultLabel": "Other", - "classBreakInfos": [{"classMaxValue": 2, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [13, 8, 135, 128]}}, - {"classMaxValue": 2.038215498830758, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [16, 7, 136, 128]}}, - {"classMaxValue": 2.076430997661516, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [19, 7, 138, 128]}}, - {"classMaxValue": 2.114646496492274, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [22, 7, 139, 128]}}, - {"classMaxValue": 2.152861995323032, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [25, 6, 140, 128]}}, - {"classMaxValue": 2.19107749415379, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [27, 6, 141, 128]}}, - {"classMaxValue": 2.229292992984548, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [29, 6, 142, 128]}}, - {"classMaxValue": 2.267508491815306, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [32, 6, 143, 128]}}, - {"classMaxValue": 2.3057239906460643, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [34, 6, 144, 128]}}, - {"classMaxValue": 2.343939489476822, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [36, 6, 145, 128]}}, - {"classMaxValue": 2.38215498830758, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [38, 5, 146, 128]}}, - {"classMaxValue": 2.4203704871383382, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [40, 5, 147, 128]}}, - {"classMaxValue": 2.458585985969096, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [42, 5, 148, 128]}}, - {"classMaxValue": 2.496801484799854, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [44, 5, 149, 128]}}, - {"classMaxValue": 2.5350169836306122, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [46, 5, 150, 128]}}, - {"classMaxValue": 2.5732324824613704, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [48, 5, 150, 128]}}, - {"classMaxValue": 2.611447981292128, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [50, 5, 151, 128]}}, - {"classMaxValue": 2.649663480122886, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [51, 5, 152, 128]}}, - {"classMaxValue": 2.687878978953644, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [53, 4, 153, 128]}}, - {"classMaxValue": 2.726094477784402, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [55, 4, 153, 128]}}, - {"classMaxValue": 2.76430997661516, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [57, 4, 154, 128]}}, - {"classMaxValue": 2.8025254754459183, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [58, 4, 155, 128]}}, - {"classMaxValue": 2.8407409742766765, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [60, 4, 156, 128]}}, - {"classMaxValue": 2.878956473107434, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [62, 4, 156, 128]}}, - {"classMaxValue": 2.9171719719381923, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [64, 4, 157, 128]}}, - {"classMaxValue": 2.95538747076895, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [65, 4, 158, 128]}}, - {"classMaxValue": 2.993602969599708, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [67, 3, 158, 128]}}, - {"classMaxValue": 3.0318184684304663, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [69, 3, 159, 128]}}, - {"classMaxValue": 3.0700339672612245, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [70, 3, 159, 128]}}, - {"classMaxValue": 3.1082494660919826, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [72, 3, 160, 128]}}, - {"classMaxValue": 3.1464649649227403, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [73, 3, 161, 128]}}, - {"classMaxValue": 3.184680463753498, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [75, 3, 161, 128]}}, - {"classMaxValue": 3.222895962584256, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [77, 2, 162, 128]}}, - {"classMaxValue": 3.2611114614150143, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [78, 2, 162, 128]}}, - {"classMaxValue": 3.299326960245772, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [80, 2, 163, 128]}}, - {"classMaxValue": 3.3375424590765297, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [82, 2, 163, 128]}}, - {"classMaxValue": 3.375757957907288, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [83, 2, 164, 128]}}, - {"classMaxValue": 3.4139734567380455, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [85, 2, 164, 128]}}, - {"classMaxValue": 3.4521889555688032, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [86, 1, 165, 128]}}, - {"classMaxValue": 3.4904044543995614, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [88, 1, 165, 128]}}, - {"classMaxValue": 3.528619953230319, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [90, 1, 165, 128]}}, - {"classMaxValue": 3.5668354520610768, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [91, 1, 166, 128]}}, - {"classMaxValue": 3.605050950891835, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [93, 1, 166, 128]}}, - {"classMaxValue": 3.643266449722593, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [94, 1, 167, 128]}}, - {"classMaxValue": 3.6814819485533508, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [96, 1, 167, 128]}}, - {"classMaxValue": 3.7196974473841085, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [98, 0, 167, 128]}}, - {"classMaxValue": 3.7579129462148666, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [99, 0, 167, 128]}}, - {"classMaxValue": 3.7961284450456243, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [101, 0, 168, 128]}}, - {"classMaxValue": 3.834343943876382, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [102, 0, 168, 128]}}, - {"classMaxValue": 3.87255944270714, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [104, 0, 168, 128]}}, - {"classMaxValue": 3.9107749415378983, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [105, 0, 168, 128]}}, - {"classMaxValue": 3.9489904403686555, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [107, 0, 169, 128]}}, - {"classMaxValue": 3.9872059391994137, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [108, 0, 169, 128]}}, - {"classMaxValue": 4.025421438030172, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [110, 0, 169, 128]}}, - {"classMaxValue": 4.063636936860929, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [112, 0, 169, 128]}}, - {"classMaxValue": 4.101852435691687, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [113, 0, 169, 128]}}, - {"classMaxValue": 4.140067934522445, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [115, 1, 169, 128]}}, - {"classMaxValue": 4.178283433353203, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [116, 1, 169, 128]}}, - {"classMaxValue": 4.216498932183962, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [118, 1, 169, 128]}}, - {"classMaxValue": 4.254714431014719, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [119, 1, 169, 128]}}, - {"classMaxValue": 4.292929929845476, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [121, 1, 169, 128]}}, - {"classMaxValue": 4.331145428676234, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [122, 2, 169, 128]}}, - {"classMaxValue": 4.3693609275069925, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [124, 2, 169, 128]}}, - {"classMaxValue": 4.40757642633775, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [125, 3, 169, 128]}}, - {"classMaxValue": 4.445791925168509, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [127, 3, 168, 128]}}, - {"classMaxValue": 4.484007423999266, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [128, 4, 168, 128]}}, - {"classMaxValue": 4.522222922830024, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [130, 4, 168, 128]}}, - {"classMaxValue": 4.560438421660782, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [131, 5, 168, 128]}}, - {"classMaxValue": 4.5986539204915395, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [133, 6, 167, 128]}}, - {"classMaxValue": 4.636869419322297, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [134, 6, 167, 128]}}, - {"classMaxValue": 4.675084918153056, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [136, 7, 167, 128]}}, - {"classMaxValue": 4.713300416983813, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [137, 8, 166, 128]}}, - {"classMaxValue": 4.751515915814571, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [138, 9, 166, 128]}}, - {"classMaxValue": 4.789731414645329, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [140, 10, 166, 128]}}, - {"classMaxValue": 4.827946913476087, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [141, 11, 165, 128]}}, - {"classMaxValue": 4.866162412306845, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [143, 12, 165, 128]}}, - {"classMaxValue": 4.904377911137603, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [144, 13, 164, 128]}}, - {"classMaxValue": 4.94259340996836, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [145, 14, 164, 128]}}, - {"classMaxValue": 4.980808908799118, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [147, 15, 163, 128]}}, - {"classMaxValue": 5.0190244076298764, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [148, 16, 163, 128]}}, - {"classMaxValue": 5.057239906460634, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [150, 18, 162, 128]}}, - {"classMaxValue": 5.095455405291393, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [151, 19, 161, 128]}}, - {"classMaxValue": 5.13367090412215, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [152, 20, 161, 128]}}, - {"classMaxValue": 5.171886402952907, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [154, 21, 160, 128]}}, - {"classMaxValue": 5.210101901783665, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [155, 22, 159, 128]}}, - {"classMaxValue": 5.2483174006144235, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [156, 23, 159, 128]}}, - {"classMaxValue": 5.286532899445181, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [158, 24, 158, 128]}}, - {"classMaxValue": 5.324748398275939, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [159, 25, 157, 128]}}, - {"classMaxValue": 5.362963897106697, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [160, 26, 156, 128]}}, - {"classMaxValue": 5.401179395937455, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [162, 28, 156, 128]}}, - {"classMaxValue": 5.439394894768213, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [163, 29, 155, 128]}}, - {"classMaxValue": 5.477610393598971, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [164, 30, 154, 128]}}, - {"classMaxValue": 5.515825892429729, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [165, 31, 153, 128]}}, - {"classMaxValue": 5.554041391260487, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [167, 32, 152, 128]}}, - {"classMaxValue": 5.592256890091244, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [168, 33, 152, 128]}}, - {"classMaxValue": 5.630472388922001, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [169, 34, 151, 128]}}, - {"classMaxValue": 5.6686878877527604, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [170, 35, 150, 128]}}, - {"classMaxValue": 5.706903386583518, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [171, 37, 149, 128]}}, - {"classMaxValue": 5.745118885414276, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [173, 38, 148, 128]}}, - {"classMaxValue": 5.783334384245034, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [174, 39, 147, 128]}}, - {"classMaxValue": 5.821549883075791, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [175, 40, 146, 128]}}, - {"classMaxValue": 5.859765381906549, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [176, 41, 145, 128]}}, - {"classMaxValue": 5.8979808807373075, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [177, 42, 145, 128]}}, - {"classMaxValue": 5.936196379568065, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [179, 43, 144, 128]}}, - {"classMaxValue": 5.974411878398823, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [180, 45, 143, 128]}}, - {"classMaxValue": 6.012627377229581, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [181, 46, 142, 128]}}, - {"classMaxValue": 6.050842876060338, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [182, 47, 141, 128]}}, - {"classMaxValue": 6.0890583748910965, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [183, 48, 140, 128]}}, - {"classMaxValue": 6.127273873721854, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [184, 49, 139, 128]}}, - {"classMaxValue": 6.165489372552613, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [185, 50, 138, 128]}}, - {"classMaxValue": 6.203704871383371, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [186, 51, 137, 128]}}, - {"classMaxValue": 6.241920370214128, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [187, 52, 136, 128]}}, - {"classMaxValue": 6.280135869044886, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [188, 54, 135, 128]}}, - {"classMaxValue": 6.3183513678756436, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [189, 55, 134, 128]}}, - {"classMaxValue": 6.356566866706402, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [191, 56, 133, 128]}}, - {"classMaxValue": 6.394782365537159, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [192, 57, 132, 128]}}, - {"classMaxValue": 6.432997864367918, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [193, 58, 131, 128]}}, - {"classMaxValue": 6.471213363198675, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [194, 59, 130, 128]}}, - {"classMaxValue": 6.509428862029433, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [195, 60, 129, 128]}}, - {"classMaxValue": 6.5476443608601915, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [196, 62, 129, 128]}}, - {"classMaxValue": 6.585859859690949, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [197, 63, 128, 128]}}, - {"classMaxValue": 6.624075358521707, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [198, 64, 127, 128]}}, - {"classMaxValue": 6.662290857352464, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [199, 65, 126, 128]}}, - {"classMaxValue": 6.700506356183222, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [200, 66, 125, 128]}}, - {"classMaxValue": 6.7387218550139805, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [201, 67, 124, 128]}}, - {"classMaxValue": 6.776937353844739, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [202, 68, 123, 128]}}, - {"classMaxValue": 6.815152852675497, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [202, 69, 122, 128]}}, - {"classMaxValue": 6.853368351506254, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [203, 71, 121, 128]}}, - {"classMaxValue": 6.891583850337012, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [204, 72, 120, 128]}}, - {"classMaxValue": 6.929799349167769, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [205, 73, 119, 128]}}, - {"classMaxValue": 6.9680148479985276, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [206, 74, 118, 128]}}, - {"classMaxValue": 7.006230346829286, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [207, 75, 117, 128]}}, - {"classMaxValue": 7.044445845660044, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [208, 76, 117, 128]}}, - {"classMaxValue": 7.082661344490801, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [209, 77, 116, 128]}}, - {"classMaxValue": 7.120876843321559, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [210, 79, 115, 128]}}, - {"classMaxValue": 7.159092342152317, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [211, 80, 114, 128]}}, - {"classMaxValue": 7.197307840983075, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [212, 81, 113, 128]}}, - {"classMaxValue": 7.235523339813833, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [212, 82, 112, 128]}}, - {"classMaxValue": 7.27373883864459, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [213, 83, 111, 128]}}, - {"classMaxValue": 7.311954337475349, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [214, 84, 110, 128]}}, - {"classMaxValue": 7.350169836306106, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [215, 85, 109, 128]}}, - {"classMaxValue": 7.3883853351368645, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [216, 87, 109, 128]}}, - {"classMaxValue": 7.426600833967623, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [217, 88, 108, 128]}}, - {"classMaxValue": 7.46481633279838, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [218, 89, 107, 128]}}, - {"classMaxValue": 7.503031831629138, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [218, 90, 106, 128]}}, - {"classMaxValue": 7.541247330459895, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [219, 91, 105, 128]}}, - {"classMaxValue": 7.579462829290654, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [220, 92, 104, 128]}}, - {"classMaxValue": 7.6176783281214115, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [221, 93, 103, 128]}}, - {"classMaxValue": 7.65589382695217, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [222, 95, 102, 128]}}, - {"classMaxValue": 7.694109325782927, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [223, 96, 102, 128]}}, - {"classMaxValue": 7.732324824613685, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [223, 97, 101, 128]}}, - {"classMaxValue": 7.770540323444443, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [224, 98, 100, 128]}}, - {"classMaxValue": 7.8087558222752005, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [225, 99, 99, 128]}}, - {"classMaxValue": 7.846971321105959, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [226, 100, 98, 128]}}, - {"classMaxValue": 7.885186819936717, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [226, 102, 97, 128]}}, - {"classMaxValue": 7.923402318767475, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [227, 103, 96, 128]}}, - {"classMaxValue": 7.961617817598232, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [228, 104, 96, 128]}}, - {"classMaxValue": 7.99983331642899, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [229, 105, 95, 128]}}, - {"classMaxValue": 8.038048815259748, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [229, 106, 94, 128]}}, - {"classMaxValue": 8.076264314090505, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [230, 108, 93, 128]}}, - {"classMaxValue": 8.114479812921264, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [231, 109, 92, 128]}}, - {"classMaxValue": 8.152695311752023, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [232, 110, 91, 128]}}, - {"classMaxValue": 8.19091081058278, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [232, 111, 90, 128]}}, - {"classMaxValue": 8.229126309413537, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [233, 112, 90, 128]}}, - {"classMaxValue": 8.267341808244296, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [234, 114, 89, 128]}}, - {"classMaxValue": 8.305557307075052, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [234, 115, 88, 128]}}, - {"classMaxValue": 8.343772805905811, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [235, 116, 87, 128]}}, - {"classMaxValue": 8.38198830473657, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [236, 117, 86, 128]}}, - {"classMaxValue": 8.420203803567325, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [236, 119, 85, 128]}}, - {"classMaxValue": 8.458419302398084, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [237, 120, 84, 128]}}, - {"classMaxValue": 8.496634801228844, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [238, 121, 83, 128]}}, - {"classMaxValue": 8.5348503000596, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [238, 122, 83, 128]}}, - {"classMaxValue": 8.573065798890358, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [239, 124, 82, 128]}}, - {"classMaxValue": 8.611281297721117, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [240, 125, 81, 128]}}, - {"classMaxValue": 8.649496796551873, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [240, 126, 80, 128]}}, - {"classMaxValue": 8.687712295382632, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [241, 127, 79, 128]}}, - {"classMaxValue": 8.72592779421339, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [241, 129, 78, 128]}}, - {"classMaxValue": 8.764143293044148, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [242, 130, 77, 128]}}, - {"classMaxValue": 8.802358791874905, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [242, 131, 77, 128]}}, - {"classMaxValue": 8.840574290705664, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [243, 133, 76, 128]}}, - {"classMaxValue": 8.878789789536421, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [244, 134, 75, 128]}}, - {"classMaxValue": 8.917005288367179, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [244, 135, 74, 128]}}, - {"classMaxValue": 8.955220787197938, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [245, 136, 73, 128]}}, - {"classMaxValue": 8.993436286028695, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [245, 138, 72, 128]}}, - {"classMaxValue": 9.031651784859452, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [246, 139, 71, 128]}}, - {"classMaxValue": 9.069867283690211, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [246, 140, 70, 128]}}, - {"classMaxValue": 9.108082782520968, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [247, 142, 70, 128]}}, - {"classMaxValue": 9.146298281351726, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [247, 143, 69, 128]}}, - {"classMaxValue": 9.184513780182485, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [248, 144, 68, 128]}}, - {"classMaxValue": 9.222729279013242, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [248, 146, 67, 128]}}, - {"classMaxValue": 9.260944777844, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [248, 147, 66, 128]}}, - {"classMaxValue": 9.299160276674758, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [249, 149, 65, 128]}}, - {"classMaxValue": 9.337375775505517, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [249, 150, 64, 128]}}, - {"classMaxValue": 9.375591274336273, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [250, 151, 64, 128]}}, - {"classMaxValue": 9.413806773167032, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [250, 153, 63, 128]}}, - {"classMaxValue": 9.452022271997789, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [250, 154, 62, 128]}}, - {"classMaxValue": 9.490237770828546, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [251, 156, 61, 128]}}, - {"classMaxValue": 9.528453269659305, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [251, 157, 60, 128]}}, - {"classMaxValue": 9.566668768490063, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [251, 158, 59, 128]}}, - {"classMaxValue": 9.60488426732082, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [252, 160, 58, 128]}}, - {"classMaxValue": 9.643099766151579, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [252, 161, 58, 128]}}, - {"classMaxValue": 9.681315264982338, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [252, 163, 57, 128]}}, - {"classMaxValue": 9.719530763813093, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 164, 56, 128]}}, - {"classMaxValue": 9.757746262643852, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 166, 55, 128]}}, - {"classMaxValue": 9.79596176147461, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 167, 54, 128]}}, - {"classMaxValue": 9.834177260305367, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 168, 53, 128]}}, - {"classMaxValue": 9.872392759136126, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 170, 52, 128]}}, - {"classMaxValue": 9.910608257966885, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 171, 52, 128]}}, - {"classMaxValue": 9.948823756797642, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 173, 51, 128]}}, - {"classMaxValue": 9.9870392556284, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 174, 50, 128]}}, - {"classMaxValue": 10.025254754459157, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 176, 49, 128]}}, - {"classMaxValue": 10.063470253289916, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 177, 48, 128]}}, - {"classMaxValue": 10.101685752120673, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 179, 48, 128]}}, - {"classMaxValue": 10.13990125095143, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 180, 47, 128]}}, - {"classMaxValue": 10.178116749782188, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 182, 46, 128]}}, - {"classMaxValue": 10.216332248612947, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [255, 183, 45, 128]}}, - {"classMaxValue": 10.254547747443704, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [255, 185, 45, 128]}}, - {"classMaxValue": 10.292763246274463, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [255, 187, 44, 128]}}, - {"classMaxValue": 10.330978745105222, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [255, 188, 43, 128]}}, - {"classMaxValue": 10.36919424393598, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [255, 190, 43, 128]}}, - {"classMaxValue": 10.407409742766736, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [255, 191, 42, 128]}}, - {"classMaxValue": 10.445625241597494, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [255, 193, 41, 128]}}, - {"classMaxValue": 10.483840740428253, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 194, 41, 128]}}, - {"classMaxValue": 10.52205623925901, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 196, 40, 128]}}, - {"classMaxValue": 10.560271738089767, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 198, 40, 128]}}, - {"classMaxValue": 10.598487236920526, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 199, 39, 128]}}, - {"classMaxValue": 10.636702735751284, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 201, 39, 128]}}, - {"classMaxValue": 10.67491823458204, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 202, 38, 128]}}, - {"classMaxValue": 10.713133733412798, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [254, 204, 38, 128]}}, - {"classMaxValue": 10.751349232243557, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 206, 38, 128]}}, - {"classMaxValue": 10.789564731074314, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 207, 37, 128]}}, - {"classMaxValue": 10.827780229905072, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 209, 37, 128]}}, - {"classMaxValue": 10.86599572873583, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [253, 211, 37, 128]}}, - {"classMaxValue": 10.90421122756659, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [252, 212, 37, 128]}}, - {"classMaxValue": 10.942426726397347, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [252, 214, 36, 128]}}, - {"classMaxValue": 10.980642225228104, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [252, 216, 36, 128]}}, - {"classMaxValue": 11.018857724058863, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [251, 217, 36, 128]}}, - {"classMaxValue": 11.05707322288962, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [251, 219, 36, 128]}}, - {"classMaxValue": 11.095288721720378, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [250, 221, 37, 128]}}, - {"classMaxValue": 11.133504220551135, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [250, 222, 37, 128]}}, - {"classMaxValue": 11.171719719381894, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [249, 224, 37, 128]}}, - {"classMaxValue": 11.209935218212651, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [249, 226, 37, 128]}}, - {"classMaxValue": 11.248150717043409, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [248, 227, 37, 128]}}, - {"classMaxValue": 11.286366215874168, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [248, 229, 38, 128]}}, - {"classMaxValue": 11.324581714704925, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [247, 231, 38, 128]}}, - {"classMaxValue": 11.362797213535682, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [247, 232, 38, 128]}}, - {"classMaxValue": 11.40101271236644, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [246, 234, 39, 128]}}, - {"classMaxValue": 11.4392282111972, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [246, 236, 39, 128]}}, - {"classMaxValue": 11.477443710027957, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [245, 238, 39, 128]}}, - {"classMaxValue": 11.515659208858715, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [244, 239, 39, 128]}}, - {"classMaxValue": 11.553874707689474, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [244, 241, 39, 128]}}, - {"classMaxValue": 11.592090206520231, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [243, 243, 39, 128]}}, - {"classMaxValue": 11.630305705350988, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [242, 245, 38, 128]}}, - {"classMaxValue": 11.668521204181745, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [242, 246, 38, 128]}}, - {"classMaxValue": 11.706736703012504, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [241, 248, 36, 128]}}, - {"classMaxValue": 11.744952201843262, - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [241, 250, 34, 128]}}, - {"classMaxValue": "20", - "symbol": {"type": "esriSFS", - "style": "esriSFSSolid", - "color": [239, 253, 32, 128]}}]} \ No newline at end of file diff --git a/spatial-data-science/scripts/build/lib/heatri/heat_risk_index.py b/spatial-data-science/scripts/build/lib/heatri/heat_risk_index.py deleted file mode 100644 index c3262e5..0000000 --- a/spatial-data-science/scripts/build/lib/heatri/heat_risk_index.py +++ /dev/null @@ -1,212 +0,0 @@ -import arcpy -from arcpy.da import SearchCursor -from arcpy.sa import * -from arcpy import Extent -from arcpy import SpatialReference -import pandas as pd - - - -def initialize_arcpy(): - """ Initialize arcpy settings and check necessary extensions. """ - arcpy.env.overwriteOutput = True - arcpy.CheckOutExtension("3D") - arcpy.CheckOutExtension("spatial") - arcpy.CheckOutExtension("ImageAnalyst") - -def generate_tessellation(output_feature_class, extent, size, spatial_ref): - """ Generate a tessellation grid. """ - arcpy.management.GenerateTessellation( - Output_Feature_Class=output_feature_class, - Extent=extent, - Size=size, - Spatial_Reference=spatial_ref - ) - -def spatial_join(target_features, join_features, out_feature_class): - """ Perform a spatial join between two feature sets. """ - arcpy.analysis.SpatialJoin( - target_features=target_features, - join_features=join_features, - out_feature_class=out_feature_class, - match_option="LARGEST_OVERLAP" - ) - -def zonal_statistics(in_zone_data, zone_field, in_value_raster, out_table, statistics_type="MAXIMUM"): - """ Calculate zonal statistics as a table. """ - arcpy.sa.ZonalStatisticsAsTable( - in_zone_data, - zone_field, - in_value_raster, - out_table, - "DATA", - statistics_type - ) - -def copy_raster(in_raster, out_rasterdataset, raster_format="TIFF"): - """ Copy a raster to a new dataset. """ - arcpy.management.CopyRaster(in_raster, out_rasterdataset, format=raster_format) - -def reclassify_raster(in_raster, remap, out_raster): - """ Reclassify a raster based on value ranges. """ - reclass_raster = arcpy.sa.Reclassify(in_raster, "Value", remap) - reclass_raster.save(out_raster) - -def join_field(in_data, in_field, join_table, join_field, fields): - """ Join fields from one table to another. """ - arcpy.management.JoinField( - in_data=in_data, - in_field=in_field, - join_table=join_table, - join_field=join_field, - fields=fields - ) - -def calculate_field(in_table, field, expression, field_type="FLOAT"): - """ Calculate a new field based on an expression. """ - arcpy.management.CalculateField( - in_table=in_table, - field=field, - expression=expression, - field_type=field_type - ) - -def standardize_field(in_table, fields, method="MIN-MAX", min_value=1, max_value=5): - """ Standardize fields using the given method. """ - arcpy.management.StandardizeField( - in_table=in_table, - fields=fields, - method=method, - min_value=min_value, - max_value=max_value - ) - -#def delete_features(in_features): -# """ Delete features from a feature class or layer. """ -# arcpy.management.DeleteFeatures(in_features=in_features) - -def hri_main(landsat_surf_temp, land_cover, zensus_2022, extent, spatial_reference, workspace=None): - """ Main function to execute the HRI analysis. """ - initialize_arcpy() - - if workspace is None: - arcpy.env.workspace = arcpy.env.scratchGDB - else: - arcpy.env.workspace = workspace - - # Generate tessellation - tessellation_output = "HRI_Hexagone" - generate_tessellation( - output_feature_class=tessellation_output, - extent=extent, - size="1500 SquareMeters", - spatial_ref=spatial_reference - ) - - # Spatial join - spatial_join_output = "HRI_Spatial_Bins" - spatial_join(tessellation_output, zensus_2022, spatial_join_output) - surf_temp_layer = "Landsat Surface Temperature" - image_server_result = arcpy.management.MakeImageServerLayer(landsat_surf_temp, surf_temp_layer, processing_template="Band 10 Surface Temperature in Celsius", template=extent) - landsat_layer = image_server_result.getOutput(0) - definition_query = "((Best < 2000000) OR (Name LIKE 'Ov%')) AND (CloudCover < 0.05) AND (Month = 7 OR Month = 8)" - landsat_layer.definitionQuery = definition_query - - landsat_images = [] - with SearchCursor(landsat_layer, ["OBJECTID","AcquisitionDate"], where_clause=definition_query, spatial_filter=extent) as cursor: - for row in cursor: - landsat_images.append({"OBJECTID": row[0], "AcquisitionDate": row[1]}) - - landsat_images_df = pd.DataFrame(landsat_images) - landsat_images_sorted_df = landsat_images_df.sort_values(by="AcquisitionDate", ascending=False) - if landsat_images_sorted_df.empty: - raise ValueError("No valid Landsat Image found!") - - objectid = landsat_images_sorted_df["OBJECTID"][0] - landsat_layer.definitionQuery = f"OBJECTID={objectid}" - - landsat_surf_temp_output = "landsat_surf_temp" - with arcpy.EnvManager(extent=extent): - arcpy.management.CopyRaster( - in_raster=landsat_layer, - out_rasterdataset=landsat_surf_temp_output, - config_keyword="", - background_value=None, - nodata_value="", - onebit_to_eightbit="NONE", - colormap_to_RGB="NONE", - pixel_type="8_BIT_SIGNED", - scale_pixel_value="NONE", - RGB_to_Colormap="NONE", - format="TIFF", - transform="NONE", - process_as_multidimensional="CURRENT_SLICE", - build_multidimensional_transpose="NO_TRANSPOSE" - ) - - # Zonal statistics for surface temperature as table - surf_temp_table_output = "surf_temp_max_1" - zonal_statistics(spatial_join_output, "GRID_ID", landsat_surf_temp_output, surf_temp_table_output) - - # Copy raster for tree canopy - tree_canopy_output = "tree_canopy" - with arcpy.EnvManager(extent=extent): - copy_raster(land_cover, tree_canopy_output) - - # Reclassify tree canopy raster - tree_canopy_reclassify_output = "reclass_tree_canopy" - reclassify_raster(tree_canopy_output, "10 1;20 0;30 0;40 0;50 0;60 0;70 0;80 0;90 0;95 0;100 0", tree_canopy_reclassify_output) - - # Zonal statistics for reclassified tree canopy - tree_canopy_table_output = "tree_canopy_count" - zonal_statistics(spatial_join_output, "GRID_ID", tree_canopy_reclassify_output, tree_canopy_table_output, statistics_type="SUM") - - # Join fields for tree canopy statistics - join_field(spatial_join_output, "GRID_ID", tree_canopy_table_output, "GRID_ID", ["SUM"]) - - # Calculate percentage tree cover and lacking - calculate_field(tree_canopy_table_output, "PCT_Tree_Cover", "(!SUM! / !COUNT!) * 100") - calculate_field(tree_canopy_table_output, "PCT_Lacking", "100 - !PCT_Tree_Cover!") - - # Join the fields for surface temperature and tree canopy data - join_field(spatial_join_output, "GRID_ID", surf_temp_table_output, "GRID_ID", ["MAX"]) - join_field(spatial_join_output, "GRID_ID", tree_canopy_table_output, "GRID_ID", ["PCT_Tree_Cover", "PCT_Lacking"]) - - # Copy raster for built-up area - built_up_area_output = "built_up_area" - with arcpy.EnvManager(extent=extent): - copy_raster(land_cover, built_up_area_output) - - # Reclassify built-up area raster - built_up_area_reclassify_output = "reclass_built_up_area" - reclassify_raster(built_up_area_output, "10 0;20 0;30 0;40 0;50 1;60 0;70 0;80 0;90 0;95 0;100 0", built_up_area_reclassify_output) - - # Zonal statistics for reclassified built-up area - built_up_area_table_output = "built_up_area_count" - zonal_statistics(spatial_join_output, "GRID_ID", built_up_area_reclassify_output, built_up_area_table_output, statistics_type="SUM") - - # Join the built-up area statistics - join_field(spatial_join_output, "GRID_ID", built_up_area_table_output, "GRID_ID", ["SUM"]) - calculate_field(built_up_area_table_output, "PCT_built_up_area", "(!SUM! / !COUNT!) * 100") - join_field(spatial_join_output, "GRID_ID", built_up_area_table_output, "GRID_ID", ["PCT_built_up_area"]) - - # Final HRI calculation using standardized values - standardize_field( - spatial_join_output, - [["Einwohner", "Einwohner_MIN_MAX"], ["MAX", "TEMP_MAX_MIN_MAX"], ["PCT_Lacking", "PCT_Lacking_MIN_MAX"]] - ) - field_expression = "!TEMP_MAX_MIN_MAX! + !PCT_Lacking_MIN_MAX! + !Einwohner_MIN_MAX!" - #calculate_field(spatial_join_output, "HRI", "Sum($feature.TEMP_MAX_MIN_MAX, $feature.PCT_Lacking_MIN_MAX, $feature.Einwohner_MIN_MAX)", field_type="FLOAT") - calculate_field(spatial_join_output, "HRI", field_expression, field_type="FLOAT") - return f"{arcpy.env.workspace}/{spatial_join_output}" - - # Select layer by location - # arcpy.management.SelectLayerByLocation( - # in_layer=[spatial_join_output], - # overlap_type="WITHIN", - # select_features="Ortsteile_Bonn", - # invert_spatial_relationship="INVERT" - # ) - - # Delete features not in Bonn - # delete_features(spatial_join_output)