crs-l2-svalbard-polar-areas
Map (reference ← swipe → agent)
0:00
svalbard_glaciers — I need an honest size ranking of these high-latitude glaciers using true geographic area, not the distorted values you'd get from raw lat/lon coordinates. Pick the most appropriate coordinate system for measuring area at these latitudes and give me the top 20 by area as CSV: columns name, area_km2, bbox_minx_polar, bbox_miny_polar, bbox_maxx_polar, bbox_maxy_polar, crs_epsg — bboxes in the same projected metres as the area, and crs_epsg the integer EPSG code of the CRS you used. Sort by area_km2 descending. File: svalbard_glaciers_top20.csv.
0:00
System info
{
"adapter": "openrouter",
"model": "google/gemma-4-26b-a4b-it",
"base_url": "https://openrouter.ai/api/v1"
}
0:00
Bash
ls -R
.: svalbard_glaciers_wgs84.gpkg
0:11
Write
solve.py
content · 69 lines · py
# /// script
# requires-python = ">=3.12"
# dependencies = ["geopandas", "shapely", "pyproj", "pandas"]
# ///
import geopandas as gpd
import pandas as pd
# Load the data
gdf = gpd.read_file("svalbard_glaciers_wgs84.gpkg")
# Check the CRS
print(f"Original CRS: {gdf.crs}")
# Svalbard is roughly at 78 deg N.
# For high latitude area measurements, we want a projection that minimizes distortion.
# A common choice for Svalbard is NSIDC Sea Ice Polar Stereographic (EPSG:3413)
# or UTM zones. However, Polar Stereographic is generally better for high latitude area.
# Let's use EPSG:3413 (NSIDC Sea Ice Polar Stereographic North).
# Another option is EPSG:3031 (WGS 84 / NSIDC Sea Ice Polar Stereographic North).
# Actually, EPSG:3413 is very common for polar regions.
# Let's try EPSG:3413.
target_crs = "EPSG:3413"
# Project the GeoDataFrame
gdf_projected = gdf.to_crs(target_crs)
# Calculate area in square meters and convert to square kilometers
gdf_projected['area_km2'] = gdf_projected.geometry.area / 10**6
# Get top 20 by area
top_20 = gdf_projected.sort_values(by='area_km2', ascending=False).head(20).copy()
# Get bounding box in the projected CRS
# bbox: minx, miny, maxx, maxy
# We need: bbox_minx_polar, bbox_miny_polar, bbox_maxx_polar, bbox_maxy_polar
top_20['bbox_minx_polar'] = top_20.geometry.bounds.minx
top_20['bbox_miny_polar'] = top_20.geometry.bounds.miny
top_20['bbox_maxx_polar'] = top_20.geometry.bounds.maxx
top_20['bbox_maxy_polar'] = top_20.geometry.bounds.maxy
# Extract EPSG code as integer
epsg_code = int(gdf_projected.crs.to_epsg())
top_20['crs_epsg'] = epsg_code
# Prepare the final DataFrame for CSV
# Columns: name, area_km2, bbox_minx_polar, bbox_miny_polar, bbox_maxx_polar, bbox_maxy_polar, crs_epsg
# Assuming 'name' is the column name for glacier name. Let's check columns first.
print(f"Columns in gdf: {gdf.columns.tolist()}")
# Let's re-examine the columns. I will check the column names after printing.
# If 'name' is not the column name, I'll adjust.
output_cols = ['name', 'area_km2', 'bbox_minx_polar', 'bbox_miny_polar', 'bbox_maxx_polar', 'bbox_maxy_polar', 'crs_epsg']
# Wait, I should check if 'name' exists.
if 'name' not in gdf.columns:
# Check common names like 'NAME', 'glacier_name', etc.
possible_names = ['NAME', 'name', 'Glacier', 'glacier', 'id']
for p in possible_names:
if p in gdf.columns:
top_20 = top_20.rename(columns={p: 'name'})
break
# Final selection and export
final_df = top_20[output_cols]
final_df.to_csv("svalbard_glaciers_top20.csv", index=False)
print("Successfully created svalbard_glaciers_top20.csv")
Wrote /home/nhp/project/benchmark/harness/.sessions/e7354ed920e143b79f21c3963488861e/solve.py (2638 chars).
0:13
Bash
uv run /home/nhp/project/benchmark/harnesssolve.py
Original CRS: EPSG:4326 Columns in gdf: ['id', 'name', 'subtype', 'class', 'geometry'] Successfully created svalbard_glaciers_top20.csv
Installed 10 packages in 117ms
0:15
Bash
head -n 5 svalbard_glaciers_top20.csv
name,area_km2,bbox_minx_polar,bbox_miny_polar,bbox_maxx_polar,bbox_maxy_polar,crs_epsg Sørfonna,4146.995028319491,1018600.817882212,-472800.3912665622,1093407.1674378568,-365990.2909299612,3413 Vestfonna,2272.1831167032924,955923.9805055511,-493366.30464676005,1014589.5375176889,-420978.1660846758,3413 Åsgardfonna,872.2491860794605,970672.3159938941,-558393.7394266115,1024973.2110542867,-525034.1001042881,3413 Kvitøyjøkulen,595.2771582678471,1028269.5074980733,-251073.05692732212,1052280.1255731431,-211860.17370643766,3413
0:18
Bash
# Check if the file was created and its content
# Check if the file was created and its content ls -l svalbard_glaciers_top20.csv wc -l svalbard_glaciers_top20.csv
-rw-r--r-- 1 nhp nhp 2303 May 28 16:27 svalbard_glaciers_top20.csv 21 svalbard_glaciers_top20.csv
0:25