Skip to content

Commit b4e18e7

Browse files
authored
Merge pull request #343 from carbonplan/katamartin/ocr
Add Open Climate Risk content
2 parents 4386fb2 + f036fcf commit b4e18e7

25 files changed

+121799
-16
lines changed

articles/climate-risk-explainer/components/county-map.js

Lines changed: 436 additions & 0 deletions
Large diffs are not rendered by default.

articles/climate-risk-explainer/components/data/county-stats.json

Lines changed: 80672 additions & 0 deletions
Large diffs are not rendered by default.

articles/climate-risk-explainer/components/data/great-lakes.json

Lines changed: 1320 additions & 0 deletions
Large diffs are not rendered by default.

articles/climate-risk-explainer/components/data/states.json

Lines changed: 6496 additions & 0 deletions
Large diffs are not rendered by default.

articles/climate-risk-explainer/components/data/streets.json

Lines changed: 29988 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
import { Box, Flex } from 'theme-ui'
2+
import { Button, Figure, Table } from '@carbonplan/components'
3+
import { RotatingArrow } from '@carbonplan/icons'
4+
5+
const FACTORS = [
6+
{
7+
name: 'Building attributes like fire-resistant construction and defensible space',
8+
explanation:
9+
'Interventions like metal roofs, clean gutters, resistant siding, and defensible space can dramatically reduce the risk of home ignition. We do not account for any of these attributes.',
10+
resources: [
11+
{
12+
label: 'Home hardening',
13+
url: 'https://readyforwildfire.org/prepare-for-wildfire/hardening-your-home',
14+
},
15+
{
16+
label: 'Home ignition zone',
17+
url: 'https://www.nfpa.org/education-and-research/wildfire/preparing-homes-for-wildfire',
18+
},
19+
{
20+
label: 'Exterior home protection',
21+
url: 'https://cpaw.headwaterseconomics.org/wp-content/uploads/2022/08/2022HE-OwnYourZoneHouse-R3_CPAW.pdf',
22+
},
23+
],
24+
},
25+
{
26+
name: 'Building-to-building spread',
27+
explanation:
28+
'Our estimates do not account for how, during an urban conflagration, buildings can become fuel, and fire can spread amongst communities. This is an area of research in urgent need of innovation.',
29+
resources: [
30+
{
31+
label: 'Wildland-urban fire',
32+
url: 'https://doi.org/10.1073/pnas.2315797120',
33+
},
34+
{
35+
label: 'Research opportunities',
36+
url: 'https://headwaterseconomics.org/natural-hazards/wildfire/wildfire-risk-models-built-environment/',
37+
},
38+
],
39+
},
40+
{
41+
name: 'Changes in vegetation, including wildfires after 2020',
42+
explanation:
43+
'Our estimates are based on a combination of vegetation maps from the ends of 2020 and 2022. Changes in vegetation in the interim, particularly wildfires, would have removed fuel and temporarily reduced our BP and cRPS values, thereby decreasing the final risk estimate. In these cases our risk estimates are likely anomalously high-biased. Similarly, prescribed fire is an effective technique for reducing fire risk, but if it occurred after 2020, our estimates would not capture it.',
44+
resources: [
45+
{
46+
label: 'Prescribed fire',
47+
url: 'https://www.fs.usda.gov/managing-land/prescribed-fire',
48+
},
49+
{
50+
label: 'Wildfires',
51+
url: 'https://cires.colorado.edu/news/fewer-forest-fires-burn-north-america-today-past-and-thats-bad-thing',
52+
},
53+
],
54+
},
55+
{
56+
name: 'Community mitigation planning',
57+
explanation:
58+
'Our estimates do not account for community-scale actions like wildfire protection plans and land-use planning. These actions can reduce the risk of wildfire entering a community.',
59+
resources: [
60+
{
61+
label: 'Firewise communities',
62+
url: 'https://www.nfpa.org/education-and-research/wildfire/firewise-usa',
63+
},
64+
{
65+
label: 'Community wildfire protection plan',
66+
url: 'https://www.iafc.org/docs/default-source/pdf/wild_cwppleadrsguide.pdf',
67+
},
68+
{
69+
label: 'Fire adapted communities tool',
70+
url: 'https://fireadaptednetwork.org/resources/fac-assessment-tool/',
71+
},
72+
{
73+
label: 'Land-use planning',
74+
url: 'https://wildfirerisk.org/reduce-risk/land-use-planning',
75+
},
76+
],
77+
},
78+
{
79+
name: 'Community emergency planning',
80+
explanation:
81+
'Community-level emergency planning can support the development of strong evacuation plans and ensure adequate access, which could reduce wildfire risk.',
82+
resources: [
83+
{
84+
label: 'Evacuation readiness',
85+
url: 'https://www.nist.gov/publications/wui-fire-evacuation-and-sheltering-considerations-assessment-planning-and-execution-0',
86+
},
87+
{
88+
label: 'Fire apparatus access roads',
89+
url: 'https://www.nfpa.org/news-blogs-and-articles/blogs/2021/01/08/fire-apparatus-access-roads',
90+
},
91+
{
92+
label: 'Wildfire risk to roads',
93+
url: 'https://www.climatecentral.org/climate-matters/wildfire-risk-to-homes',
94+
},
95+
],
96+
},
97+
{
98+
name: 'Changes to ignition patterns',
99+
explanation:
100+
'Our model is based on simulations which used a fixed map of ignition probabilities. Changes in ignition patterns could either increase or decrease the estimated risk in a given location.',
101+
resources: [
102+
{
103+
label: 'Preventing ignitions',
104+
url: 'https://wildfirerisk.org/reduce-risk/prevent-ignitions',
105+
},
106+
{
107+
label: 'Wildfire prevention',
108+
url: 'https://dnr.wa.gov/wildfire-resources/wildfire-prevention',
109+
},
110+
],
111+
},
112+
]
113+
114+
const FactorsTable = () => {
115+
return (
116+
<Figure>
117+
<Table
118+
columns={6}
119+
start={[1, 1, 1]}
120+
width={[6, 6, 6]}
121+
data={[
122+
...FACTORS.map(({ name, explanation, resources }) => [
123+
<Box key='name' sx={{ color: 'red' }}>
124+
{name}
125+
</Box>,
126+
<Box
127+
key='explanation'
128+
sx={{
129+
mt: [2, 3, 3, 3],
130+
fontFamily: 'body',
131+
letterSpacing: 'body',
132+
textTransform: 'none',
133+
}}
134+
>
135+
{explanation}
136+
</Box>,
137+
138+
<Flex
139+
key='links'
140+
sx={{
141+
mt: [2, 3, 3, 3],
142+
columnGap: 4,
143+
rowGap: 2,
144+
flexWrap: 'wrap',
145+
}}
146+
>
147+
{resources.map(({ label, url }) => (
148+
<Button
149+
key={url}
150+
href={url}
151+
suffix={<RotatingArrow sx={{ display: 'inline' }} />}
152+
size='xs'
153+
inverted
154+
>
155+
<Box as='span' sx={{}}>
156+
{label}
157+
</Box>
158+
</Button>
159+
))}
160+
</Flex>,
161+
]),
162+
]}
163+
/>
164+
</Figure>
165+
)
166+
}
167+
168+
export default FactorsTable
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { geoAlbers as geoAlbersBase } from 'd3-geo'
2+
3+
const glsl = {
4+
geoAlbersInvert: `
5+
float sgn(float x) { return (x > 0.0) ? 1.0 : ((x < 0.0) ? -1.0 : 0.0); }
6+
vec2 sphRotateInverse(vec2 lonlat, float yawDeg, float pitchDeg) {
7+
// Inverse of sphRotate
8+
float lon = radians(lonlat.x), lat = radians(lonlat.y);
9+
float yaw = radians(yawDeg);
10+
float pitch = radians(pitchDeg);
11+
12+
float slat = sin(lat), clat = cos(lat);
13+
float sp = sin(pitch), cp = cos(pitch);
14+
15+
float lon1 = atan(clat * sin(lon), clat * cp * cos(lon) + slat * sp) - yaw;
16+
17+
float slat1 = clamp(slat * cp + clat * sp * cos(lon), -1.0, 1.0);
18+
float lat1 = asin(slat1);
19+
return vec2(degrees(lon1), degrees(lat1));
20+
}
21+
vec2 geoAlbersInvert(float x, float y)
22+
{
23+
float phi1 = radians(29.5);
24+
float phi2 = radians(45.5);
25+
float phi0 = radians(38.7);
26+
float lambda0 = radians(-0.6);
27+
28+
float n = 0.5 * (sin(phi1) + sin(phi2));
29+
float C = pow(cos(phi1), 2.0) + 2.0 * n * sin(phi1);
30+
float rho0 = sqrt(max(0.0, C - 2.0 * n * sin(phi0))) / n;
31+
32+
float xr = x;
33+
float yr = rho0 - y;
34+
float rho = sgn(n) * sqrt(xr * xr + yr * yr);
35+
float theta = atan(xr, yr);
36+
37+
38+
float lon = lambda0 + theta / n;
39+
// guard for tiny numeric drift
40+
float s = (C - pow(rho * n, 2.0)) / (2.0 * n);
41+
float lat = asin(clamp(s, -1.0, 1.0));
42+
43+
vec2 lonlat = vec2(degrees(lon), degrees(lat));
44+
return sphRotateInverse(lonlat, 96.0, 0.0);
45+
}
46+
47+
`,
48+
}
49+
50+
const geoAlbers = () => {
51+
const projection = geoAlbersBase().precision(0.1)
52+
projection.glsl = {
53+
name: 'geoAlbersInvert',
54+
func: glsl.geoAlbersInvert,
55+
nameForward: 'geoAlbers',
56+
funcForward: glsl.geoAlbers,
57+
}
58+
projection.id = 'geoAlbers'
59+
return projection
60+
}
61+
62+
export default geoAlbers
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import { Box } from 'theme-ui'
2+
import { useState, useEffect } from 'react'
3+
import zarr from 'zarr-js'
4+
import { Colorbar, Column, Row } from '@carbonplan/components'
5+
import { useThemedColormap } from '@carbonplan/colormaps'
6+
import Grid from './grid'
7+
8+
const SOURCE =
9+
'https://carbonplan-ocr.s3.us-west-2.amazonaws.com/output/fire-risk/tensor/web-figures/v1.1.0/methods-step04-gaussian-blur-30m-5070.zarr/burn_probability'
10+
11+
const CLIM = [0, 0.01]
12+
13+
const Blurring = () => {
14+
const [data, setData] = useState(null)
15+
const colormap = useThemedColormap('reds', { format: 'hex' })
16+
17+
useEffect(() => {
18+
const loadArray = async () => {
19+
try {
20+
zarr().load(SOURCE, (err, array) => {
21+
if (err) {
22+
console.error('Error opening array:', err)
23+
return
24+
}
25+
26+
setData(array)
27+
})
28+
} catch (error) {
29+
console.error('Error fetching group:', error)
30+
}
31+
}
32+
loadArray()
33+
}, [])
34+
35+
return (
36+
<Box>
37+
<Row columns={6}>
38+
<Column start={1} width={3}>
39+
<Box
40+
sx={{
41+
textAlign: 'center',
42+
fontFamily: 'mono',
43+
letterSpacing: 'mono',
44+
textTransform: 'uppercase',
45+
mb: 1,
46+
}}
47+
>
48+
Before
49+
</Box>
50+
51+
<Grid
52+
clim={CLIM}
53+
colormap={colormap}
54+
data={data?.pick(0, null, null)}
55+
/>
56+
</Column>
57+
<Column start={4} width={3}>
58+
<Box
59+
sx={{
60+
textAlign: 'center',
61+
fontFamily: 'mono',
62+
letterSpacing: 'mono',
63+
textTransform: 'uppercase',
64+
mb: 1,
65+
}}
66+
>
67+
After
68+
</Box>
69+
70+
<Grid
71+
clim={CLIM}
72+
colormap={colormap}
73+
data={data?.pick(1, null, null)}
74+
/>
75+
</Column>
76+
</Row>
77+
<Colorbar
78+
horizontal
79+
label='Burn probability'
80+
clim={CLIM}
81+
colormap={colormap}
82+
sx={{ mt: 3 }}
83+
/>
84+
</Box>
85+
)
86+
}
87+
88+
export default Blurring

0 commit comments

Comments
 (0)