Skip to content

Commit 82d382b

Browse files
committed
Move locations to json
1 parent 82b42b1 commit 82d382b

File tree

2 files changed

+75
-75
lines changed

2 files changed

+75
-75
lines changed

articles/seaweed-farming-explainer/components/cost-calculator/cost-calculator.js

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -7,83 +7,11 @@ import {
77
calculateCost,
88
} from '@carbonplan/seaweed-farming-model'
99

10+
import locations from './locations.json'
1011
import { formatValue } from './utils'
1112
import Parameters from './parameters'
1213
import SpatialValues from './spatial-values'
1314

14-
const LOCATIONS = [
15-
{
16-
key: 'pacific',
17-
point: [-90, 2],
18-
values: {
19-
seaweed_dw: 7939.91552734375,
20-
d2p: 192.85289001464844,
21-
fseq_transport: 0.9930768013000488,
22-
d2sink: 0.0,
23-
species: 'tropical red',
24-
depth: 2016.75,
25-
nharv: 8.0,
26-
wave_height: 1.4342491626739502,
27-
},
28-
},
29-
{
30-
key: 'north_sea',
31-
point: [0, 58],
32-
values: {
33-
seaweed_dw: 1636.282470703125,
34-
d2p: 29.229372024536133,
35-
fseq_transport: 0.7799999713897705,
36-
d2sink: 428.871826171875,
37-
species: 'temperate brown',
38-
depth: 131.5,
39-
nharv: 2.0,
40-
wave_height: 1.8970307111740112,
41-
},
42-
},
43-
{
44-
key: 'alaska',
45-
point: [-165, 55],
46-
values: {
47-
seaweed_dw: 1316.7147216796875,
48-
d2p: 99.7650146484375,
49-
fseq_transport: 0.9700000286102295,
50-
d2sink: 115.72320556640625,
51-
species: 'temperate brown',
52-
depth: 91.25,
53-
nharv: 1.0,
54-
wave_height: 1.9661271572113037,
55-
},
56-
},
57-
{
58-
key: 'argentina',
59-
point: [-66, -46],
60-
values: {
61-
seaweed_dw: 2587.830322265625,
62-
d2p: 103.04915618896484,
63-
fseq_transport: 0.44999998807907104,
64-
d2sink: 273.8975830078125,
65-
species: 'temperate brown',
66-
depth: 104.0,
67-
nharv: 2.0,
68-
wave_height: 1.3610966205596924,
69-
},
70-
},
71-
{
72-
key: 'yellow_sea',
73-
point: [124.5, 33.3],
74-
values: {
75-
seaweed_dw: 972.8525390625,
76-
d2p: 167.25067138671875,
77-
fseq_transport: 0.9700000286102295,
78-
d2sink: 748.9559936523438,
79-
species: 'temperate brown',
80-
depth: 72.0,
81-
nharv: 1.0,
82-
wave_height: 1.2413867712020874,
83-
},
84-
},
85-
]
86-
8715
const sx = {
8816
column: {
8917
borderStyle: 'solid',
@@ -149,7 +77,7 @@ const CostCalculator = () => {
14977
const [parameters, setParameters] = useState(INITIAL_PARAMETERS)
15078

15179
const benefitUnits = target === 'sinking' ? 'tCO₂' : 'tCO₂e'
152-
const { values } = LOCATIONS[location]
80+
const { values } = locations[location]
15381

15482
const benefit = calculateBenefit(target, values, parameters)
15583
const cost = calculateCost(target, values, parameters)
@@ -203,7 +131,7 @@ const CostCalculator = () => {
203131
<Divider sx={{ mt: [1, 1, 2, 2], mb: [3, 3, 4, 4] }} />
204132

205133
<SpatialValues
206-
locations={LOCATIONS}
134+
locations={locations}
207135
setLocation={setLocation}
208136
location={location}
209137
target={target}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
[
2+
{
3+
"key": "pacific",
4+
"point": [-90, 2],
5+
"values": {
6+
"seaweed_dw": 7939.91552734375,
7+
"d2p": 192.85289001464844,
8+
"fseq_transport": 0.9930768013000488,
9+
"d2sink": 0.0,
10+
"species": "tropical red",
11+
"depth": 2016.75,
12+
"nharv": 8.0,
13+
"wave_height": 1.4342491626739502
14+
}
15+
},
16+
{
17+
"key": "north_sea",
18+
"point": [0, 58],
19+
"values": {
20+
"seaweed_dw": 1636.282470703125,
21+
"d2p": 29.229372024536133,
22+
"fseq_transport": 0.7799999713897705,
23+
"d2sink": 428.871826171875,
24+
"species": "temperate brown",
25+
"depth": 131.5,
26+
"nharv": 2.0,
27+
"wave_height": 1.8970307111740112
28+
}
29+
},
30+
{
31+
"key": "alaska",
32+
"point": [-165, 55],
33+
"values": {
34+
"seaweed_dw": 1316.7147216796875,
35+
"d2p": 99.7650146484375,
36+
"fseq_transport": 0.9700000286102295,
37+
"d2sink": 115.72320556640625,
38+
"species": "temperate brown",
39+
"depth": 91.25,
40+
"nharv": 1.0,
41+
"wave_height": 1.9661271572113037
42+
}
43+
},
44+
{
45+
"key": "argentina",
46+
"point": [-66, -46],
47+
"values": {
48+
"seaweed_dw": 2587.830322265625,
49+
"d2p": 103.04915618896484,
50+
"fseq_transport": 0.44999998807907104,
51+
"d2sink": 273.8975830078125,
52+
"species": "temperate brown",
53+
"depth": 104.0,
54+
"nharv": 2.0,
55+
"wave_height": 1.3610966205596924
56+
}
57+
},
58+
{
59+
"key": "yellow_sea",
60+
"point": [124.5, 33.3],
61+
"values": {
62+
"seaweed_dw": 972.8525390625,
63+
"d2p": 167.25067138671875,
64+
"fseq_transport": 0.9700000286102295,
65+
"d2sink": 748.9559936523438,
66+
"species": "temperate brown",
67+
"depth": 72.0,
68+
"nharv": 1.0,
69+
"wave_height": 1.2413867712020874
70+
}
71+
}
72+
]

0 commit comments

Comments
 (0)