crs-l2-svalbard-polar-areas

Status: done
Score: 0.941
Duration: 1:09
Cost: 0.47¢
Model: google/gemma-4-26b-a4b-it
Model error Retrospective assessed 2026-06-09T12:11:38Z

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:01
Bash ls -F
svalbard_glaciers_wgs84.gpkg
0:03
Bash ogrinfo -so /work/svalbard_glaciers_wgs84.gpkg
INFO: Open of `/work/svalbard_glaciers_wgs84.gpkg'
      using driver `GPKG' successful.
1: glaciers (Multi Polygon)
0:07
Write /work/inspect_data.py
content · 12 lines · py
import geopandas as gpd

def inspect_data(file_path):
    gdf = gpd.read_file(file_path)
    print("Columns:", gdf.columns.tolist())
    print("CRS:", gdf.crs)
    print("Head:\n", gdf.head())
    print("Geometry type:", gdf.geometry.type.unique())

if __name__ == "__main__":
    inspect_data("/work/svalbard_glaciers_wgs84.gpkg")
Wrote /work/inspect_data.py (332 chars).
0:09
Bash python /work/inspect_data.py
Columns: ['id', 'name', 'subtype', 'class', 'geometry']
CRS: EPSG:4326
Head:
                                      id  ...                                           geometry
0  af2fac62-8f17-35dd-bb4b-cd7ac5f906b0  ...  MULTIPOLYGON (((22.78865 80.14451, 22.73235 80...
1  12ba70b6-6f49-35fa-a072-bfdc8321c987  ...  MULTIPOLYGON (((14.02517 77.97816, 14.02557 77...
2  5919887f-cdb2-3283-a884-b1146bdda8ee  ...  MULTIPOLYGON (((16.06338 78.22499, 16.06381 78...
3  cdbc3ec1-ce56-3dbc-89fe-f4bce34bd5a8  ...  MULTIPOLYGON (((12.92179 78.40649, 12.95164 78...
4  81e675dd-427e-3cd8-ac05-929fbbd3c30e  ...  MULTIPOLYGON (((11.88304 78.88352, 11.88399 78...

[5 rows x 5 columns]
Geometry type: <ArrowStringArray>
['MultiPolygon']
Length: 1, dtype: str
0:29
Write /work/solve.py
content · 54 lines · py
import geopandas as gpd
import pandas as pd

def solve():
    # Load the data
    gdf = gpd.read_file("/work/svalbard_glaciers_wgs84.gpkg")
    
    # Svalbard is roughly between 74N and 81N.
    # For area measurements in high latitudes, we should use an Equal Area projection.
    # NSIDC Sea Ice Polar Stereographic North (EPSG:3413) is a good candidate for the Arctic.
    # Alternatively, an Albers Equal Area projection centered on Svalbard.
    # Let's try EPSG:3413 (NSIDC Sea Ice Polar Stereographic North) 
    # or EPSG:3031 (WGS 84 / Antarctic?) No, that's South.
    # EPSG:3413 is standard for polar regions.
    # Another option: EPSG:3995 (WGS 84 / NSIDC Sea Ice Polar Stereographic North)
    # Let's use EPSG:3413.
    
    target_crs = "EPSG:3413"
    
    # Project to the chosen CRS
    gdf_projected = gdf.to_crs(target_crs)
    
    # Calculate area in square meters, then convert to km2
    gdf_projected['area_km2'] = gdf_projected.geometry.area / 10**6
    
    # Get bounding boxes in the projected CRS
    # bbox returns (minx, miny, maxx, maxy)
    bounds = gdf_projected.geometry.bounds
    gdf_projected['bbox_minx_polar'] = bounds['minx']
    gdf_projected['bbox_miny_polar'] = bounds['miny']
    gdf_projected['bbox_maxx_polar'] = bounds['maxx']
    gdf_projected['bbox_maxy_polar'] = bounds['maxy']
    gdf_projected['crs_epsg'] = 3413
    
    # Sort by area descending and take top 20
    top_20 = gdf_projected.sort_values(by='area_km2', ascending=False).head(20)
    
    # Select required columns
    # name, area_km2, bbox_minx_polar, bbox_miny_polar, bbox_maxx_polar, bbox_maxy_polar, crs_epsg
    output_cols = [
        'name', 'area_km2', 'bbox_minx_polar', 'bbox_miny_polar', 
        'bbox_maxx_polar', 'bbox_maxy_polar', 'crs_epsg'
    ]
    
    # Final check on names - the column is 'name'
    result = top_20[output_cols]
    
    # Write to CSV
    result.to_csv("/work/svalbard_glaciers_top20.csv", index=False)
    print("Successfully created /work/svalbard_glaciers_top20.csv")

if __name__ == "__main__":
    solve()
Wrote /work/solve.py (2073 chars).
0:33
Bash python /work/solve.py
Successfully created /work/svalbard_glaciers_top20.csv
0:37
Bash head -n 5 /work/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:40
Bash python -c "import geopandas as gpd; gdf = gpd.read_file('/work/svalbard_glaciers...
EPSG:4326
0:44
Bash ls -F /work/svalbard_glaciers_top20.csv
/work/svalbard_glaciers_top20.csv
0:47
Bash wc -l /work/svalbard_glaciers_top20.csv
21 /work/svalbard_glaciers_top20.csv
1:08