Skip to content

Commit 393e3f6

Browse files
committed
update CCS licensees
1 parent ed9e1e8 commit 393e3f6

2 files changed

Lines changed: 82 additions & 114 deletions

File tree

assets/baa_shapes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14394,7 +14394,7 @@
1439414394
},
1439514395
{
1439614396
"baaNpdidBsnsArrArea": 41319935,
14397-
"baaName": "EXL012",
14397+
"baaName": "EXL012 (Kaupang)",
1439814398
"baaKind": "EXPLORATION LICENCE",
1439914399
"baaDateApproved": "2025-03-11 00:00:00",
1440014400
"baaDateValidFrom": "2025-02-28 00:00:00",
@@ -15245,7 +15245,7 @@
1524515245
},
1524615246
{
1524715247
"baaNpdidBsnsArrArea": 41319936,
15248-
"baaName": "EXL013",
15248+
"baaName": "EXL013 (Frigg)",
1524915249
"baaKind": "EXPLORATION LICENCE",
1525015250
"baaDateApproved": "2025-03-11 00:00:00",
1525115251
"baaDateValidFrom": "2025-02-28 00:00:00",

main.ipynb

Lines changed: 80 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 1,
12+
"execution_count": 3,
1313
"metadata": {
1414
"tags": []
1515
},
@@ -89,6 +89,85 @@
8989
" return (degF-32)*5/9"
9090
]
9191
},
92+
{
93+
"cell_type": "markdown",
94+
"metadata": {},
95+
"source": [
96+
"## shapes of CO2 storage licenses\n",
97+
"from https://factpages.sodir.no/downloads/csv/baaAreaCurrent.zip"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": null,
103+
"metadata": {},
104+
"outputs": [],
105+
"source": [
106+
"from shapely import wkt\n",
107+
"\n",
108+
"# Load the CSV\n",
109+
"# df = pd.read_csv(\"baaAreaCurrent.csv\")\n",
110+
"# Load the CSV\n",
111+
"shp = pd.read_csv(r\"./data/NOD/baaAreaCurrent.csv\")\n",
112+
"\n",
113+
"# Filter valid geometries\n",
114+
"shp = shp[shp['baaAreaGeometryWKT'].notna() & (shp['baaAreaGeometryWKT'] != 'POLYGON EMPTY')].copy()\n",
115+
"\n",
116+
"# Parse geometries\n",
117+
"shp['geometry'] = shp['baaAreaGeometryWKT'].apply(wkt.loads)\n",
118+
"\n",
119+
"# Extract polygons with all metadata\n",
120+
"features = []\n",
121+
"\n",
122+
"ccs_licenses = {\n",
123+
" \"EL001\": \"Aurora\",\n",
124+
" \"EXL002\": \"Smeaheia\",\n",
125+
" \"EXL003\": \"Polaris\",\n",
126+
" \"EXL004\": \"Luna\",\n",
127+
" \"EXL005\": \"Poseidon\",\n",
128+
" \"EXL006\": \"Havstjerne\",\n",
129+
" \"EXL007\": \"Trudvang\",\n",
130+
" \"EXL008\": \"Albondigas\",\n",
131+
" \"EXL009\": \"Iroko\",\n",
132+
" \"EXL010\": \"Kinno\",\n",
133+
" \"EXL011\": \"Atlas\",\n",
134+
" \"EXL012\": \"Kaupang\",\n",
135+
" \"EXL013\": \"Frigg\",\n",
136+
"}\n",
137+
"\n",
138+
"for _, row in shp.iterrows():\n",
139+
"\n",
140+
" # keeping only CO2 licenses ...\n",
141+
" exl = row['baaName'][:6]\n",
142+
" if not exl[:3] in ['EL0', 'EXL']: continue\n",
143+
" \n",
144+
" name = ccs_licenses.get(exl,None)\n",
145+
" if name is not None: row['baaName'] += f' ({name})'\n",
146+
" geom = row['geometry']\n",
147+
" # drop the shapely object for serialization \n",
148+
" row_data = row.drop(['geometry', 'baaAreaGeometryWKT']) \n",
149+
"\n",
150+
" if geom.geom_type == 'Polygon':\n",
151+
" coords = list(geom.exterior.coords)\n",
152+
" feature = row_data.to_dict()\n",
153+
" feature['coordinates'] = coords\n",
154+
" features.append(feature)\n",
155+
"\n",
156+
" elif geom.geom_type == 'MultiPolygon':\n",
157+
" for poly in geom.geoms:\n",
158+
" coords = list(poly.exterior.coords)\n",
159+
" feature = row_data.to_dict()\n",
160+
" feature['coordinates'] = coords\n",
161+
" features.append(feature)\n",
162+
"\n",
163+
"# Save to JSON\n",
164+
"with open(\"./assets/baa_shapes.json\", \"w\") as f:\n",
165+
" json.dump(features, f, indent=1)\n",
166+
"\n",
167+
"for n,r in enumerate(features):\n",
168+
" print(n, r['baaName'])"
169+
]
170+
},
92171
{
93172
"cell_type": "markdown",
94173
"metadata": {},
@@ -24248,117 +24327,6 @@
2424824327
" json.dump(HELP_CLMNS, file, indent=4)"
2424924328
]
2425024329
},
24251-
{
24252-
"cell_type": "markdown",
24253-
"metadata": {},
24254-
"source": [
24255-
"# shapes of CO2 storage licenses"
24256-
]
24257-
},
24258-
{
24259-
"cell_type": "markdown",
24260-
"metadata": {},
24261-
"source": [
24262-
"from https://factpages.sodir.no/downloads/csv/baaAreaCurrent.zip"
24263-
]
24264-
},
24265-
{
24266-
"cell_type": "code",
24267-
"execution_count": 287,
24268-
"metadata": {},
24269-
"outputs": [],
24270-
"source": [
24271-
"from shapely import wkt\n",
24272-
"\n",
24273-
"# Load the CSV\n",
24274-
"# df = pd.read_csv(\"baaAreaCurrent.csv\")\n",
24275-
"# Load the CSV\n",
24276-
"shp = pd.read_csv(r\"./data/NOD/baaAreaCurrent.csv\")\n",
24277-
"\n",
24278-
"# Filter valid geometries\n",
24279-
"shp = shp[shp['baaAreaGeometryWKT'].notna() & (shp['baaAreaGeometryWKT'] != 'POLYGON EMPTY')].copy()\n",
24280-
"\n",
24281-
"# Parse geometries\n",
24282-
"shp['geometry'] = shp['baaAreaGeometryWKT'].apply(wkt.loads)\n",
24283-
"\n",
24284-
"# Extract polygons with all metadata\n",
24285-
"features = []\n",
24286-
"\n",
24287-
"ccs_licenses = {\n",
24288-
" \"EL001\": \"Aurora\",\n",
24289-
" \"EXL002\": \"Smeaheia\",\n",
24290-
" \"EXL003\": \"Polaris\",\n",
24291-
" \"EXL004\": \"Luna\",\n",
24292-
" \"EXL005\": \"Poseidon\",\n",
24293-
" \"EXL006\": \"Havstjerne\",\n",
24294-
" \"EXL007\": \"Trudvang\",\n",
24295-
" \"EXL008\": \"Albondigas\",\n",
24296-
" \"EXL009\": \"Iroko\",\n",
24297-
" \"EXL010\": \"Kinno\",\n",
24298-
" \"EXL011\": \"Atlas\"\n",
24299-
"}\n",
24300-
"\n",
24301-
"for _, row in shp.iterrows():\n",
24302-
"\n",
24303-
" # keeping only CO2 licenses ...\n",
24304-
" exl = row['baaName'][:6]\n",
24305-
" if not exl[:3] in ['EL0', 'EXL']: continue\n",
24306-
" \n",
24307-
" name = ccs_licenses.get(exl,None)\n",
24308-
" if name is not None: row['baaName'] += f' ({name})'\n",
24309-
" geom = row['geometry']\n",
24310-
" # drop the shapely object for serialization \n",
24311-
" row_data = row.drop(['geometry', 'baaAreaGeometryWKT']) \n",
24312-
"\n",
24313-
" if geom.geom_type == 'Polygon':\n",
24314-
" coords = list(geom.exterior.coords)\n",
24315-
" feature = row_data.to_dict()\n",
24316-
" feature['coordinates'] = coords\n",
24317-
" features.append(feature)\n",
24318-
"\n",
24319-
" elif geom.geom_type == 'MultiPolygon':\n",
24320-
" for poly in geom.geoms:\n",
24321-
" coords = list(poly.exterior.coords)\n",
24322-
" feature = row_data.to_dict()\n",
24323-
" feature['coordinates'] = coords\n",
24324-
" features.append(feature)\n",
24325-
"\n",
24326-
"# Save to JSON\n",
24327-
"with open(\"./assets/baa_shapes.json\", \"w\") as f:\n",
24328-
" json.dump(features, f, indent=1)"
24329-
]
24330-
},
24331-
{
24332-
"cell_type": "code",
24333-
"execution_count": 288,
24334-
"metadata": {},
24335-
"outputs": [
24336-
{
24337-
"name": "stdout",
24338-
"output_type": "stream",
24339-
"text": [
24340-
"0 EL001 (Aurora)\n",
24341-
"1 EXL002 (Smeaheia)\n",
24342-
"2 EXL003 (Polaris)\n",
24343-
"3 EXL004 (Luna)\n",
24344-
"4 EXL005 (Poseidon)\n",
24345-
"5 EXL006 (Havstjerne)\n",
24346-
"6 EXL007 (Trudvang)\n",
24347-
"7 EXL009 (Iroko)\n",
24348-
"8 EXL008 (Albondigas)\n",
24349-
"9 EXL011 (Atlas)\n",
24350-
"10 EXL010 (Kinno)\n",
24351-
"11 EXL012\n",
24352-
"12 EXL013\n",
24353-
"13 EXL014\n"
24354-
]
24355-
}
24356-
],
24357-
"source": [
24358-
"for n,r in enumerate(features):\n",
24359-
" print(n, r['baaName'])"
24360-
]
24361-
},
2436224330
{
2436324331
"cell_type": "markdown",
2436424332
"metadata": {},

0 commit comments

Comments
 (0)