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": "deepseek/deepseek-v4-flash",
"base_url": "https://openrouter.ai/api/v1"
}
0:03
Let me start by understanding the data. I need to work with Svalbard glaciers data. Let me first check what data is available in the working directory.
0:03
Bash
ls /work/
svalbard_glaciers_wgs84.gpkg
0:06
Let me first inspect the data to understand its structure.
0:06
Bash
cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
gdf = gpd.read_file('svalbard_glaciers_wgs84.gpkg')
print('CRS:', gdf.crs)
print('Columns:', gdf.columns.tolist())
print('Shape:', gdf.shape)
print(gdf.head())
"
CRS: EPSG:4326
Columns: ['id', 'name', 'subtype', 'class', 'geometry']
Shape: (169, 5)
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]
0:19
Okay, so we have 169 glacier features in EPSG:4326 (WGS84 lat/lon). We need to: 1. Choose the most appropriate projected CRS for measuring area at Svalbard's latitudes (roughly 74°N to 81°N). 2. Project to that CRS, calculate true geographic area in km². 3. Get the top 20 by area, with bounding boxes in the projected CRS. 4. Output CSV. For measuring area in polar regions, the best choices are: - **EPSG:3413** - NSIDC Sea Ice Polar Stereographic North (WGS 84) — centered on the North Pole, used for Arctic-wide analysis. Latitude of true scale: 70°N. - **EPSG:3995** - Arctic Polar Stereographic (WGS 84) — another Arctic polar stereographic. - **UTM zones** - Svalbard spans from ~10°E to ~35°E, so UTM zones 33N (0°-6°E... actually Svalbard is around 10°E-35°E, so zones 33N (0-6°E)... wait, let me think: - Zone 31N: 0°-6°E - Zone 32N: 6°-12°E - Zone 33N: 12°-18°E - Zone 34N: 18°-24°E - Zone 35N: 24°-30°E - Zone 36N: 30°-36°E Svalbard spans multiple UTM zones, so that's not ideal. **EPSG:3413** (NSIDC Sea Ice Polar Stereographic North) is a common standardized CRS for Arctic measurements. It uses a polar stereographic projection with central meridian at -45° (or 45°W) and latitude of true scale at 70°N. It's widely used for sea ice and Arctic glacier studies. **EPSG:3995** (Arctic Polar Stereographic / WGS 84) is similar but with central meridian at 0°. Actually, for Svalbard specifically, **EPSG:3413** is commonly used but its central meridian is -45° which means Svalbard (around 15°E) is a bit off-center. **EPSG:3995** has central meridian at 0° which is better for Svalbard. Another option: **EPSG:32633** (UTM zone 33N) covers 12°E to 18°E, which covers much of Svalbard. **EPSG:32635** (UTM zone 35N) covers 24°E to 30°E. But Svalbard spans multiple zones. For polar regions, the best standard is polar stereographic. Let me check what's most appropriate. Actually, for Svalbard many studies use: - EPSG:3413 (NSIDC North Polar Stereographic) - standard for Arctic - EPSG:3995 (WGS 84 / Arctic Polar Stereographic) - with 0° central meridian Let me go with EPSG:3413 which is the NSIDC standard. Actually, let me think more carefully. EPSG:3413 has: - Latitude of origin: 90°N - Central meridian: -45° - Scale factor: 1.0 - False easting: 0 - False northing: 0 EPSG:3995 has: - Latitude of origin: 90°N - Central meridian: 0° - Scale factor: 1.0 - False easting: 0 - False northing: 0 For Svalbard (~10°E-35°E), EPSG:3995 (central meridian at 0°) would be slightly better than EPSG:3413 (central meridian at -45°). But both are valid polar stereographic projections. Actually, another commonly used one for Svalbard is EPSG:32633 (UTM zone 33N) which covers the central part. But since Svalbard spans multiple zones, a polar stereographic is better. Let me just go with EPSG:3413 as it's the standard Arctic sea ice/glacier CRS used by NSIDC. Let me calculate areas and produce the CSV.
0:19
Bash
cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
import pandas as pd
import pyproj
# Load data
gdf = gpd.read_file('svalbard_glaciers_wgs84.gpkg')
print('Bounds (WGS84):', gdf.total_bounds)
print()
# Check what CRS to use
# Svalbard is roughly 74°N to 81°N, 10°E to 35°E
# Let's try EPSG:3413 (NSIDC Sea Ice Polar Stereographic North)
crs_nsidc = 'EPSG:3413'
gdf_proj = gdf.to_crs(crs_nsidc)
print('Bounds (NSIDC):', gdf_proj.total_bounds)
# Also try EPSG:3995
crs_arctic = 'EPSG:3995'
gdf_arctic = gdf.to_crs(crs_arctic)
print('Bounds (Arctic PS):', gdf_arctic.total_bounds)
"
Bounds (WGS84): [10.7877123 77.4630249 33.4866675 80.3115547] Bounds (NSIDC): [ 955923.98050555 -696203.49609167 1174563.87075942 -211860.17370644] Bounds (Arctic PS): [ 224550.5122728 -1325007.77810454 590653.56322425 -885258.51740589]
0:30
For Svalbard, which spans roughly 74°N to 81°N, the most appropriate projected CRS for accurate area measurement would be: 1. **EPSG:3413** - NSIDC Sea Ice Polar Stereographic North (true at 70°N) - This is a polar stereographic projection designed for the Arctic, with the standard parallel at 70°N. Svalbard ranges from 74°N to 81°N, so it's not too far from the standard parallel. 2. **EPSG:3995** - Arctic Polar Stereographic (but this uses latitude of origin 90°N and standard parallel 71°N) 3. **EPSG:32633 to 32637** - UTM zones - Svalbard spans multiple UTM zones (33-37), and above 80°N UTM breaks down. Actually, for Svalbard, there's also EPSG:5932 (NSIDC EASE-Grid 2.0 North) and EPSG:3408 (NSIDC EASE-Grid North). For the most accurate area measurement at high latitudes in the Arctic, EPSG:3413 (NSIDC Sea Ice Polar Stereographic North) is commonly used. The standard parallel is at 70°N, which is close to the southern part of Svalbard. But there's also EPSG:3996 (WGS 84 / Arctic Polar Stereographic) with standard parallel at 79°N — which is even better suited for Svalbard! Let me check: EPSG:3996 is "WGS 84 / Arctic Polar Stereographic" with latitude of origin at 90°N and standard parallel at 79°N. That would be ideal for Svalbard since the main islands are around 78-80°N. Let me verify and use the most appropriate one.
0:30
Bash
cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
import pandas as pd
gdf = gpd.read_file('svalbard_glaciers_wgs84.gpkg')
# For Svalbard (74-81°N), EPSG:3996 (WGS 84 / Arctic Polar Stereographic, std parallel 71°N)
# Actually let's check: EPSG:3996 has standard parallel at 71°N, same as EPSG:3995 but different datum
# There's also EPSG:5932 (EASE-Grid 2.0 North) and EPSG:3413 (NSIDC PS North, std parallel 70°N)
# Let's try a few options and compare areas
# EPSG:3413 - NSIDC Sea Ice Polar Stereographic North (std parallel 70°N)
gdf_3413 = gdf.to_crs('EPSG:3413')
gdf_3413['area_3413'] = gdf_3413.geometry.area / 1e6 # km2
# EPSG:3995 - WGS 84 / Arctic Polar Stereographic (std parallel 71°N)
gdf_3995 = gdf.to_crs('EPSG:3995')
gdf_3995['area_3995'] = gdf_3995.geometry.area / 1e6
# EPSG:5932 - NSIDC EASE-Grid 2.0 North
gdf_5932 = gdf.to_crs('EPSG:5932')
gdf_5932['area_5932'] = gdf_5932.geometry.area / 1e6
# EPSG:3996 - WGS 84 / Arctic Polar Stereographic (but with different datum?)
try:
gdf_3996 = gdf.to_crs('EPSG:3996')
gdf_3996['area_3996'] = gdf_3996.geometry.area / 1e6
except:
print('EPSG:3996 failed')
# Compare areas for a few glaciers
print('Glacier name | Area 3413 | Area 3995 | Area 5932')
for i in range(5):
name = gdf.iloc[i]['name']
a1 = gdf_3413.iloc[i]['area_3413']
a2 = gdf_3995.iloc[i]['area_3995']
a3 = gdf_5932.iloc[i]['area_5932']
print(f'{name} | {a1:.2f} | {a2:.2f} | {a3:.2f}')
"
Glacier name | Area 3413 | Area 3995 | Area 5932 Ahlmannfonna | 33.40 | 33.60 | 38.24 Aldegondabreen | 4.63 | 4.66 | 5.11 Altbreen | 1.27 | 1.28 | 1.41 Austgötabreen | 9.54 | 9.60 | 10.61 Austre Brøggerbreen | 7.85 | 7.90 | 8.80
0:41
Let me think about the most appropriate CRS for measuring area at Svalbard latitudes (74°N to 81°N). For polar regions, the most appropriate projected coordinate systems for area measurement are polar stereographic projections. Let's consider: 1. **EPSG:3413** - NSIDC Sea Ice Polar Stereographic North (standard parallel 70°N) - This is commonly used for Arctic sea ice and has good area preservation properties near the pole. 2. **EPSG:3995** - WGS 84 / Arctic Polar Stereographic (standard parallel 71°N) - Another common one. 3. **EPSG:6931** - WGS 84 / NSIDC EASE-Grid 2.0 North - Equal Area projection for the Arctic. Actually, the key consideration: For measuring area accurately, we want an **equal-area** (or equivalent) projection, not a conformal one. Let me check which of these are equal-area. EPSG:3413 is a polar stereographic projection - this is conformal (preserves angles/shapes), not equal-area. However, it's commonly used in the Arctic and distortion is moderate. EPSG:3995 is also a polar stereographic (conformal). EPSG:5932 - EASE-Grid 2.0 North - This is an equal-area projection! That would be the most appropriate for area measurement. Actually, wait - let me check more carefully. EPSG:3413 - NSIDC Sea Ice Polar Stereographic North - This is a **Lambert azimuthal equal-area** projection? No, it's actually a polar stereographic projection (which is conformal, not equal-area). Let me check EPSG:6931 (WGS 84 / NSIDC EASE-Grid 2.0 North) - this is an equal-area projection. Actually, let me look more carefully at what's available. For Svalbard specifically, there are also local projections: - EPSG:32631 to EPSG:32639 - UTM zones 31 to 39 (but UTM zones have issues at high latitudes and the zones are narrow) - EPSG:3571-3576 - Arctic LAEA projections - EPSG:3979 - WGS 84 / Arctic LAEA Actually, let me think about this more carefully. For measuring area in polar regions, the best options are: 1. **Lambert Azimuthal Equal-Area (LAEA)** projections centered on the pole 2. **EASE-Grid** (Equal-Area Scalable Earth Grid) 3. A local UTM zone, but since Svalbard spans many zones and is at high latitude, this isn't ideal EPSG:3571 to EPSG:3576 are WGS 84 / Arctic LAEA zones. Specifically: - EPSG:3571 - WGS 84 / North Pole LAEA Bering Sea - EPSG:3572 - WGS 84 / North Pole LAEA Alaska - EPSG:3573 - WGS 84 / North Pole LAEA Canada - EPSG:3574 - WGS 84 / North Pole LAEA Greenland - EPSG:3575 - WGS 84 / North Pole LAEA Europe - EPSG:3576 - WGS 84 / North Pole LAEA Russia Svalbard is at ~10°E to 35°E, so EPSG:3575 (Europe) would cover it well. Also EPSG:5932 (EASE-Grid 2.0 North) is equal-area. Let me also consider EPSG:3995 - WGS 84 / Arctic Polar Stereographic - this is conformal, not equal-area, so areas would be distorted. Let me use an equal-area projection. Let me check EPSG:3575 (WGS 84 / North Pole LAEA Europe) and EPSG:6931 (WGS 84 / NSIDC EASE-Grid 2.0 North) or EPSG:5932. Let me also try EPSG:3413 more carefully - actually EPSG:3413 is a polar stereographic which is NOT equal-area. But it's commonly used. For the most appropriate answer, I'll go with an equal-area projection. EPSG:3575 (North Pole LAEA Europe) is a good choice for Svalbard. Let me verify.
0:41
Bash
cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
gdf = gpd.read_file('svalbard_glaciers_wgs84.gpkg')
# Test equal-area projections
# EPSG:3575 - WGS 84 / North Pole LAEA Europe (Europe-centered Lambert Azimuthal Equal-Area)
# EPSG:5932 - WGS 84 / NSIDC EASE-Grid 2.0 North (Equal-Area)
# EPSG:6931 - WGS 84 / NSIDC EASE-Grid 2.0 North (also Equal-Area, different origin)
# Test EPSG:3575
gdf_3575 = gdf.to_crs('EPSG:3575')
gdf_3575['area_3575'] = gdf_3575.geometry.area / 1e6
print('EPSG:3575 bounds:', gdf_3575.total_bounds)
# Test EPSG:5932
gdf_5932 = gdf.to_crs('EPSG:5932')
gdf_5932['area_5932'] = gdf_5932.geometry.area / 1e6
print('EPSG:5932 bounds:', gdf_5932.total_bounds)
print()
print('Name | Area 3575 | Area 5932')
for i in range(5):
name = gdf.iloc[i]['name']
a1 = gdf_3575.iloc[i]['area_3575']
a2 = gdf_5932.iloc[i]['area_5932']
print(f'{name} | {a1:.2f} | {a2:.2f}')
"
EPSG:3575 bounds: [ 17306.08446821 -1393345.0236293 436293.94150631 -995410.5766468 ] EPSG:5932 bounds: [ 970990.5292159 1916127.98365187 1193729.84441631 2446625.75327786] Name | Area 3575 | Area 5932 Ahlmannfonna | 34.98 | 38.24 Aldegondabreen | 4.81 | 5.11 Altbreen | 1.33 | 1.41 Austgötabreen | 9.94 | 10.61 Austre Brøggerbreen | 8.19 | 8.80
0:50
Let me think about the most appropriate CRS for measuring area in Svalbard. Svalbard spans latitudes 74°N to 81°N. The key criteria for measuring area accurately is to use an equal-area projection. Options: 1. **EPSG:3413** - NSIDC Sea Ice Polar Stereographic North (std parallel 70°N) - This is a polar stereographic projection commonly used for northern high latitudes. It's widely used for Arctic applications. 2. **EPSG:3995** - WGS 84 / Arctic Polar Stereographic (std parallel 71°N) - Similar but with standard parallel at 71°N. 3. **EPSG:3575** - WGS 84 / North Pole LAEA Europe - Lambert Azimuthal Equal-Area, centered on Europe/North Pole. This is an equal-area projection, which is excellent for area measurement. 4. **EPSG:5932** - WGS 84 / NSIDC EASE-Grid 2.0 North - Equal-Area Scalable Earth Grid, an equal-area projection. For measuring TRUE geographic area, an equal-area projection is most appropriate. EPSG:3575 (Lambert Azimuthal Equal-Area) is designed for Europe and includes the Arctic, making it suitable for Svalbard. EPSG:3413 is a polar stereographic projection which is conformal (preserves angles), not equal-area, so it will distort areas. Actually, let me reconsider. Polar Stereographic projections preserve angles (conformal) but distort areas, especially away from the standard parallel. For area measurement, equal-area projections are best. EPSG:3575 (WGS 84 / North Pole LAEA Europe) is a Lambert Azimuthal Equal-Area projection with central meridian at 10°E and latitude of origin at 90°N. This is specifically designed for Europe and the Arctic, making it excellent for Svalbard. Let me use EPSG:3575 as the primary CRS, as it's an equal-area projection that covers Svalbard well. Wait, let me also check EPSG:3408 (NSIDC EASE-Grid North) and EPSG:6931... Actually, I think the best candidate is EPSG:3575 (WGS 84 / North Pole LAEA Europe). It's a Lambert Azimuthal Equal-Area projection centered at 90°N and 10°E, specifically designed for European Arctic mapping. This is an equal-area projection, so area measurements will be accurate. Let me proceed with EPSG:3575 and compute the top 20 glaciers by area.
0:50
Bash
cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
import pandas as pd
gdf = gpd.read_file('svalbard_glaciers_wgs84.gpkg')
# EPSG:3575 is WGS 84 / North Pole LAEA Europe - Lambert Azimuthal Equal-Area
# This is an equal-area projection centered at 90°N, 10°E, perfect for Svalbard
crs_epsg = 3575
gdf_proj = gdf.to_crs(f'EPSG:{crs_epsg}')
# Compute area in km2
gdf_proj['area_km2'] = gdf_proj.geometry.area / 1e6
# Compute bounding boxes
bbox = gdf_proj.geometry.bounds
gdf_proj['bbox_minx_polar'] = bbox['minx']
gdf_proj['bbox_miny_polar'] = bbox['miny']
gdf_proj['bbox_maxx_polar'] = bbox['maxx']
gdf_proj['bbox_maxy_polar'] = bbox['maxy']
# Add CRS column
gdf_proj['crs_epsg'] = crs_epsg
# Sort and get top 20
top20 = gdf_proj.sort_values('area_km2', ascending=False).head(20)
# Select and reorder columns
result = top20[['name', 'area_km2', 'bbox_minx_polar', 'bbox_miny_polar',
'bbox_maxx_polar', 'bbox_maxy_polar', 'crs_epsg']].copy()
print(result.to_string())
"
name area_km2 bbox_minx_polar bbox_miny_polar bbox_maxx_polar bbox_maxy_polar crs_epsg 140 Sørfonna 4335.832923 215171.360300 -1.169659e+06 320016.013116 -1.103032e+06 3575 156 Vestfonna 2378.883369 165886.759500 -1.129465e+06 235709.648031 -1.065976e+06 3575 168 Åsgardfonna 911.981123 116295.375025 -1.183688e+06 151327.167794 -1.127169e+06 3575 78 Kvitøyjøkulen 623.623478 402965.631153 -1.032099e+06 436293.941506 -9.954106e+05 3575 149 Valhallfonna 423.704226 138082.927851 -1.153075e+06 160465.964109 -1.119314e+06 3575 103 Nordmannsfonna 130.748908 184822.195154 -1.301911e+06 201711.773162 -1.283039e+06 3575 132 Sveabreen 126.287900 72592.392283 -1.274725e+06 95742.772595 -1.251880e+06 3575 44 Gruvfonna 113.630721 146755.379803 -1.338346e+06 166742.289384 -1.323710e+06 3575 160 Veteranen 96.499807 146165.167491 -1.201491e+06 156039.341308 -1.175969e+06 3575 54 Himingbjørgfonna 84.108312 132484.110046 -1.194435e+06 148653.376645 -1.181540e+06 3575 52 Hellefonna 82.139947 169182.700462 -1.320345e+06 180933.939357 -1.302632e+06 3575 53 Heuglinbreen 71.062312 190614.306483 -1.283966e+06 201423.475091 -1.270566e+06 3575 102 Nordenskiöldbreen 66.923677 152250.327309 -1.257600e+06 162882.834135 -1.244584e+06 3575 29 Eidembreen 66.894492 65121.770670 -1.294453e+06 81422.979733 -1.283524e+06 3575 60 Isrosa 46.949925 187701.126728 -1.307516e+06 201027.435151 -1.299878e+06 3575 27 Edvardbreen 46.232427 171864.205200 -1.345953e+06 184041.796186 -1.332415e+06 3575 32 Esmarkbreen 42.860919 80684.195642 -1.301763e+06 89571.932140 -1.289799e+06 3575 154 Venernbreen 42.524210 70095.098909 -1.299447e+06 82844.268808 -1.291034e+06 3575 25 Dunérbreen 40.495260 132462.523209 -1.137756e+06 139052.914405 -1.123932e+06 3575 37 Fridtjovbreen 39.080140 98906.080046 -1.358207e+06 108050.680477 -1.346257e+06 3575
0:55
The areas look reasonable. Let me verify the CRS choice. EPSG:3575 (WGS 84 / North Pole LAEA Europe) - this is a Lambert Azimuthal Equal-Area projection centered at 90°N, 10°E. It's specifically designed for the European Arctic region and is an equal-area projection, making it perfect for area measurement. Let me also check if there are any null names or other issues. Let me write the CSV properly.
0:55
Bash
cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
import pandas as pd
gdf = gpd.read_file('svalbard_glaciers_wgs84.gpkg')
print('Null names:', gdf['name'].isna().sum())
print('Unique names:', gdf['name'].nunique())
print('Total glaciers:', len(gdf))
"
Null names: 0 Unique names: 169 Total glaciers: 169
1:01
Let me check the names more carefully. Some might have the same name which could affect the output.
1:01
Bash
cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
import pandas as pd
gdf = gpd.read_file('svalbard_glaciers_wgs84.gpkg')
# Let's look at the top names and all data
print(gdf['name'].value_counts().head(20))
print()
# Check the largest ones' names
gdf['name'].value_counts().to_csv('/dev/stdout')
" | head -30
name Ahlmannfonna 1 Aldegondabreen 1 Altbreen 1 Austgötabreen 1 Austre Brøggerbreen 1 Austre Grønfjordbreen 1 Austre Helvetiabreen 1 AustreLovenbreen 1 Baalsrudbreen 1 Bertilbreen 1 Billesholmbreen 1 Bivrostfonna 1 Bjuvbreen 1 Blackbreen 1 Blekumbreen 1 Bogerbreen 1 Bosarpbreen 1 Brandtbreen 1 Brattvaagbukta 1 Bullbreen 1 Name: count, dtype: int64 name,count Ahlmannfonna,1 Aldegondabreen,1 Altbreen,1 Austgötabreen,1 Austre Brøggerbreen,1 Austre Grønfjordbreen,1
1:10
Okay, the data looks good. Now let me write the final script to produce the CSV with the correct format. I'll use EPSG:3575 (WGS 84 / North Pole LAEA Europe) as recommended for equal-area measurements at high latitudes. Let me write the script to produce the CSV.
1:10
1:10
Write
/work/solve.py
content · 42 lines · py
import geopandas as gpd
import pandas as pd
# Load the original data (WGS84 lat/lon)
gdf = gpd.read_file('svalbard_glaciers_wgs84.gpkg')
# EPSG:3575 = WGS 84 / North Pole LAEA Europe
# Lambert Azimuthal Equal-Area projection centred at 90°N, 10°E.
# Perfect for equal-area measurements at Svalbard latitudes (~74°N–81°N).
CRS_EPSG = 3575
gdf_proj = gdf.to_crs(f'EPSG:{CRS_EPSG}')
# Compute area in square kilometres
gdf_proj['area_km2'] = gdf_proj.geometry.area / 1e6
# Extract bounding boxes (minx, miny, maxx, maxy) in projected metres
bbox = gdf_proj.geometry.bounds
gdf_proj['bbox_minx_polar'] = bbox['minx']
gdf_proj['bbox_miny_polar'] = bbox['miny']
gdf_proj['bbox_maxx_polar'] = bbox['maxx']
gdf_proj['bbox_maxy_polar'] = bbox['maxy']
# Constant CRS column
gdf_proj['crs_epsg'] = CRS_EPSG
# Sort descending by area and take top 20
top20 = gdf_proj.sort_values('area_km2', ascending=False).head(20)
# Build the output DataFrame with the requested columns
out = top20[['name', 'area_km2',
'bbox_minx_polar', 'bbox_miny_polar',
'bbox_maxx_polar', 'bbox_maxy_polar',
'crs_epsg']].copy()
# Round area to 4 decimal places for a clean CSV
out['area_km2'] = out['area_km2'].round(4)
# Write CSV
out.to_csv('/work/svalbard_glaciers_top20.csv', index=False)
print('Written top 20 to /work/svalbard_glaciers_top20.csv')
print(out.to_string())
Wrote /work/solve.py (1387 chars).
1:13
1:13
Bash
cd /work && python solve.py
Written top 20 to /work/svalbard_glaciers_top20.csv
name area_km2 bbox_minx_polar bbox_miny_polar bbox_maxx_polar bbox_maxy_polar crs_epsg
140 Sørfonna 4335.8329 215171.360300 -1.169659e+06 320016.013116 -1.103032e+06 3575
156 Vestfonna 2378.8834 165886.759500 -1.129465e+06 235709.648031 -1.065976e+06 3575
168 Åsgardfonna 911.9811 116295.375025 -1.183688e+06 151327.167794 -1.127169e+06 3575
78 Kvitøyjøkulen 623.6235 402965.631153 -1.032099e+06 436293.941506 -9.954106e+05 3575
149 Valhallfonna 423.7042 138082.927851 -1.153075e+06 160465.964109 -1.119314e+06 3575
103 Nordmannsfonna 130.7489 184822.195154 -1.301911e+06 201711.773162 -1.283039e+06 3575
132 Sveabreen 126.2879 72592.392283 -1.274725e+06 95742.772595 -1.251880e+06 3575
44 Gruvfonna 113.6307 146755.379803 -1.338346e+06 166742.289384 -1.323710e+06 3575
160 Veteranen 96.4998 146165.167491 -1.201491e+06 156039.341308 -1.175969e+06 3575
54 Himingbjørgfonna 84.1083 132484.110046 -1.194435e+06 148653.376645 -1.181540e+06 3575
52 Hellefonna 82.1399 169182.700462 -1.320345e+06 180933.939357 -1.302632e+06 3575
53 Heuglinbreen 71.0623 190614.306483 -1.283966e+06 201423.475091 -1.270566e+06 3575
102 Nordenskiöldbreen 66.9237 152250.327309 -1.257600e+06 162882.834135 -1.244584e+06 3575
29 Eidembreen 66.8945 65121.770670 -1.294453e+06 81422.979733 -1.283524e+06 3575
60 Isrosa 46.9499 187701.126728 -1.307516e+06 201027.435151 -1.299878e+06 3575
27 Edvardbreen 46.2324 171864.205200 -1.345953e+06 184041.796186 -1.332415e+06 3575
32 Esmarkbreen 42.8609 80684.195642 -1.301763e+06 89571.932140 -1.289799e+06 3575
154 Venernbreen 42.5242 70095.098909 -1.299447e+06 82844.268808 -1.291034e+06 3575
25 Dunérbreen 40.4953 132462.523209 -1.137756e+06 139052.914405 -1.123932e+06 3575
37 Fridtjovbreen 39.0801 98906.080046 -1.358207e+06 108050.680477 -1.346257e+06 3575
1:17
Let me verify the output file looks correct.
1:17
Read
/work/svalbard_glaciers_top20.csv
1 name,area_km2,bbox_minx_polar,bbox_miny_polar,bbox_maxx_polar,bbox_maxy_polar,crs_epsg
2 Sørfonna,4335.8329,215171.36030024572,-1169659.2669979744,320016.0131161042,-1103032.4200437693,3575
3 Vestfonna,2378.8834,165886.75949957134,-1129465.1664767656,235709.64803107225,-1065976.3953940861,3575
4 Åsgardfonna,911.9811,116295.37502548612,-1183688.2969401781,151327.16779357466,-1127169.1808557955,3575
5 Kvitøyjøkulen,623.6235,402965.6311529813,-1032099.0081147389,436293.94150630676,-995410.5766467985,3575
6 Valhallfonna,423.7042,138082.92785126864,-1153075.3057341585,160465.96410896454,-1119313.6839005493,3575
7 Nordmannsfonna,130.7489,184822.19515352606,-1301911.3639787377,201711.77316162313,-1283039.2588810697,3575
8 Sveabreen,126.2879,72592.39228276194,-1274725.0072520191,95742.77259496816,-1251880.038191403,3575
9 Gruvfonna,113.6307,146755.37980252606,-1338346.383053021,166742.28938444814,-1323709.7481342985,3575
10 Veteranen,96.4998,146165.16749050815,-1201490.50106078,156039.34130754403,-1175968.60421921,3575
11 Himingbjørgfonna,84.1083,132484.11004596952,-1194434.9900222803,148653.37664483069,-1181539.9105849795,3575
12 Hellefonna,82.1399,169182.7004618256,-1320345.2304836947,180933.93935658093,-1302631.7336852208,3575
13 Heuglinbreen,71.0623,190614.30648292712,-1283966.3671051469,201423.47509108714,-1270566.3646776031,3575
14 Nordenskiöldbreen,66.9237,152250.32730939685,-1257600.075248099,162882.83413451537,-1244584.0427805681,3575
15 Eidembreen,66.8945,65121.770670461054,-1294452.5853037427,81422.97973340382,-1283523.9143036723,3575
16 Isrosa,46.9499,187701.12672814605,-1307515.8842438997,201027.4351513477,-1299877.7988941947,3575
17 Edvardbreen,46.2324,171864.20520048257,-1345952.5972722026,184041.79618640777,-1332415.3776392941,3575
18 Esmarkbreen,42.8609,80684.19564229425,-1301763.4975387289,89571.93214032202,-1289799.1439381195,3575
19 Venernbreen,42.5242,70095.09890947441,-1299447.1671914207,82844.26880783115,-1291034.3197949477,3575
20 Dunérbreen,40.4953,132462.52320939006,-1137756.079230218,139052.91440537485,-1123931.7493181499,3575
21 Fridtjovbreen,39.0801,98906.08004624947,-1358207.2889868051,108050.68047678251,-1346256.5125891278,3575
1:24
The CSV looks good. Let me verify it's well-formed and double-check the results are correct.
1:24
1:24
Bash
cd /work && python3 -c "
cd /work && python3 -c "
import pandas as pd
df = pd.read_csv('svalbard_glaciers_top20.csv')
print('Shape:', df.shape)
print('Columns:', df.columns.tolist())
print()
print(df.to_string())
print()
print('All CRS values same?', (df['crs_epsg'] == 3575).all())
print('Area descending?', df['area_km2'].is_monotonic_decreasing)
"
Shape: (20, 7)
Columns: ['name', 'area_km2', 'bbox_minx_polar', 'bbox_miny_polar', 'bbox_maxx_polar', 'bbox_maxy_polar', 'crs_epsg']
name area_km2 bbox_minx_polar bbox_miny_polar bbox_maxx_polar bbox_maxy_polar crs_epsg
0 Sørfonna 4335.8329 215171.360300 -1.169659e+06 320016.013116 -1.103032e+06 3575
1 Vestfonna 2378.8834 165886.759500 -1.129465e+06 235709.648031 -1.065976e+06 3575
2 Åsgardfonna 911.9811 116295.375025 -1.183688e+06 151327.167794 -1.127169e+06 3575
3 Kvitøyjøkulen 623.6235 402965.631153 -1.032099e+06 436293.941506 -9.954106e+05 3575
4 Valhallfonna 423.7042 138082.927851 -1.153075e+06 160465.964109 -1.119314e+06 3575
5 Nordmannsfonna 130.7489 184822.195154 -1.301911e+06 201711.773162 -1.283039e+06 3575
6 Sveabreen 126.2879 72592.392283 -1.274725e+06 95742.772595 -1.251880e+06 3575
7 Gruvfonna 113.6307 146755.379803 -1.338346e+06 166742.289384 -1.323710e+06 3575
8 Veteranen 96.4998 146165.167491 -1.201491e+06 156039.341308 -1.175969e+06 3575
9 Himingbjørgfonna 84.1083 132484.110046 -1.194435e+06 148653.376645 -1.181540e+06 3575
10 Hellefonna 82.1399 169182.700462 -1.320345e+06 180933.939357 -1.302632e+06 3575
11 Heuglinbreen 71.0623 190614.306483 -1.283966e+06 201423.475091 -1.270566e+06 3575
12 Nordenskiöldbreen 66.9237 152250.327309 -1.257600e+06 162882.834135 -1.244584e+06 3575
13 Eidembreen 66.8945 65121.770670 -1.294453e+06 81422.979733 -1.283524e+06 3575
14 Isrosa 46.9499 187701.126728 -1.307516e+06 201027.435151 -1.299878e+06 3575
15 Edvardbreen 46.2324 171864.205200 -1.345953e+06 184041.796186 -1.332415e+06 3575
16 Esmarkbreen 42.8609 80684.195642 -1.301763e+06 89571.932140 -1.289799e+06 3575
17 Venernbreen 42.5242 70095.098909 -1.299447e+06 82844.268808 -1.291034e+06 3575
18 Dunérbreen 40.4953 132462.523209 -1.137756e+06 139052.914405 -1.123932e+06 3575
19 Fridtjovbreen 39.0801 98906.080046 -1.358207e+06 108050.680477 -1.346257e+06 3575
All CRS values same? True
Area descending? True
1:43
The CSV is correctly generated with all the required columns, sorted by area descending, and using EPSG:3575 (WGS 84 / North Pole LAEA Europe) which is a Lambert Azimuthal Equal-Area projection centered at the North Pole — the most appropriate CRS for measuring true geographic area at Svalbard's high latitudes.
1:43