Skip to main content

Miscellaneous Functions

Utility functions for resolution selection and grid statistics.

findResolutionByCLS​

Find the resolution whose Characteristic Length Scale (CLS) is closest to a target diameter in metres.

findResolutionByCLS(target_m, prefer?) → int
ParameterTypeDescription
target_mfloatTarget cell diameter in metres
prefer"closest" | "finer" | "coarser"Strategy when target falls between levels

Python — dggrid4py​

dggrid4py has no dedicated lookup function. Use the resolution table from the experimental igeo7_ext module (dggrid as in the API Overview):

from dggrid4py import igeo7_ext

# resolution table, indexed by resolution; ISEA7H has the same cells as IGEO7
stats = igeo7_ext.dggrid_get_res(dggrid, "ISEA7H", 20)

# Find resolution closest to 1 km cell diameter
res = (stats["cls_m"] - 1000).abs().idxmin()
print(res) # 9 (CLS = 1268.6 m)

# Find resolution closest to 10 m cell diameter
res = (stats["cls_m"] - 10).abs().idxmin()
print(res) # 14 (CLS = 9.8 m)

Julia — IGEO7.jl​

using IGEO7

find_resolution_by_cls_m(1000) # 9
find_resolution_by_cls_m(10.0, prefer=:larger) # 14
find_resolution_by_cls_m(10.0, prefer=:smaller) # 15

findResolutionByArea​

Find the resolution whose cell area is closest to a target area in m².

findResolutionByArea(target_m2, prefer?) → int

Python​

# Resolution closest to 1 km² cell area (stats table as above)
res = (stats["average_hexagon_area_m2"] - 1e6).abs().idxmin()
print(res) # 9 (area = 1,263,990 m²)

Julia​

find_resolution_by_area_m2(1e6)   # 9

getResolutionStats​

Get the precomputed statistics for a single resolution level.

getResolutionStats(resolution) → {num_cells, area_km2, area_m2, cls_km, cls_m}

Python​

# One row of the stats table (as above)
print(stats.loc[9].to_dict())
# {'cells': 403536072.0, 'average_hexagon_area_km2': 1.2639902, 'cls_km': 1.2686064,
# 'average_hexagon_area_m2': 1263990.25, 'cls_m': 1268.6064}

Julia​

using IGEO7

s = get_resolution_stats(9)
s.num_cells # 403536072
s.area_m2 # 1263990.2
s.cls_m # 1268.6064

gridStatsTable​

Generate the full statistics table for all resolutions of a DGGS type.

gridStatsTable(dggs_type, max_resolution) → DataFrame

Python — dggrid4py​

df = dggrid.grid_stats_table("IGEO7", 20)
print(df.to_string())

This calls DGGRID directly and returns the authoritative values for all 21 resolution levels. The Resolution Table in this documentation is derived from this output.


Resolution Stats Reference​

The full precomputed table from IGEO7.jl:

ResCellsArea (m²)CLS (m)
01251,006,562,172,408.98,199,500.4
1727,286,651,738,915.63,053,223.2
24921,040,950,248,416.51,151,643.0
33,432148,707,178,345.2435,153.1
424,01221,243,882,620.7164,465.6
5168,0723,034,840,374.462,161.8
61,176,492433,548,624.923,494.9
78,235,43261,935,517.88,880.2
857,648,0128,847,931.13,356.4
9403,536,0721,263,990.21,268.6
102,824,752,492180,570.0479.5
1119,773,267,43225,795.7181.2
12138,412,872,0123,685.168.5
13968,890,104,072526.425.9
146,782,230,728,49275.29.8
1547,475,615,099,43210.73.7
16332,329,305,696,0121.51.4
172,326,305,139,872,0720.20.528

See Resolution Table for the full table including resolutions 18–20.