Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/api/hwp_storage.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import LandisStratified from "./LandisStratified.jsx";
import LandownerYields from "./LandownerYields.jsx";
import FaustmannRotation from "./FaustmannRotation.jsx";
import AOIReport from "./AOIReport.jsx";
import HWPStorage from "./HWPStorage.jsx";
import { findFeature, agbAtAge, polygonCentroid, polygonAreaM2, pointInGeometry } from "./geo.js";

const BASE = import.meta.env.BASE_URL; // "./" -> resolves relative to the page
Expand Down Expand Up @@ -263,6 +264,7 @@ export default function App(){
const [landis,setLandis] = useState(null);
const [landowner,setLandowner] = useState(null);
const [faustmann,setFaustmann] = useState(null);
const [hwp,setHwp] = useState(null); // experimental HWP storage layer
// v1.3 map/AOI tools
const [ecoOn,setEcoOn] = useState(false);
const [ecoGeo,setEcoGeo] = useState(null);
Expand All @@ -285,6 +287,7 @@ export default function App(){
j("api/landis_stratified.json").then(setLandis).catch(()=>{});
j("api/landowner_yields.json").then(setLandowner).catch(()=>{});
j("api/faustmann_rotation.json").then(setFaustmann).catch(()=>{});
j("api/hwp_storage.json").then(setHwp).catch(()=>{});
geo.features.forEach(ft=>{ const st=ft.properties.state; const c=s[st];
ft.properties.engines = c ? c.engines : 0;
ft.properties.hasSeries = (c && c.has_series) ? 1 : 0;
Expand Down Expand Up @@ -837,12 +840,14 @@ export default function App(){
<div className="tabs">
{[["engines","Engine compare"],["rd","RD trend"],["divergence","Engine spread"],
["stumpage","Stumpage"],["landis","LANDIS stratified"],
["landowner","Landowner yields"],["faustmann","Faustmann rotation"]].map(([k,lbl])=>{
["landowner","Landowner yields"],["faustmann","Faustmann rotation"],
["hwp","Wood products C"]].map(([k,lbl])=>{
const disabled = (k==="divergence" && !divergence)
|| (k==="stumpage" && !(stumpage && stumpage.series && stumpage.series[sel]))
|| (k==="landis" && !(landis && landis[sel]))
|| (k==="landowner" && !(landowner && landowner[sel]))
|| (k==="faustmann" && !(faustmann && faustmann[sel]))
|| (k==="hwp" && !(hwp && hwp.states && hwp.states[sel]))
|| ((k==="engines"||k==="rd") && !series);
return <button key={k} className={"tab"+(tab===k?" on":"")} disabled={disabled}
onClick={()=>setTab(k)} title={disabled?"no data for this state":lbl}>{lbl}</button>;
Expand All @@ -856,6 +861,7 @@ export default function App(){
{tab==="landis" && <LandisStratified data={landis} state={sel}/>}
{tab==="landowner" && <LandownerYields data={landowner} state={sel}/>}
{tab==="faustmann" && <FaustmannRotation data={faustmann} state={sel}/>}
{tab==="hwp" && <HWPStorage data={hwp} state={sel}/>}
{(tab==="engines"||tab==="rd") && (<>
{LANDIS_STATES.includes(sel) && (
<div className="controls" style={{margin:"0 4px 8px"}}>
Expand Down
65 changes: 65 additions & 0 deletions src/HWPStorage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Harvested wood products (HWP) carbon storage tab. Experimental layer.
// Source: api/hwp_storage.json (WPsCS-exact pool model, Wei 2022 service lives,
// driven by the PERSEUS hybrid harvest). Shows the in-use / landfill / charcoal
// stored-carbon pools and the cumulative Avoided Carbon (substitution) line,
// per state and management scenario. Reported separately from forest carbon
// per the FACT (Forestry Analytics for Carbon Tracking) taxonomy.
import { useState, useEffect } from "react";
import MiniChart from "./MiniChart.jsx";

const SCEN_ORDER = ["managed (harvest)", "managed (intensive)",
"managed (conservation)", "reserve (no harvest)"];
const POOL = [
{ key: "total", label: "HWP total", color: "#d7301f" },
{ key: "solid", label: "In-use solidwood", color: "#fe9929" },
{ key: "paper", label: "In-use paper", color: "#41ab5d" },
{ key: "landfill", label: "Landfill", color: "#6baed6" },
{ key: "charcoal", label: "Charcoal", color: "#8d6e63" },
];

export default function HWPStorage({ data, state }){
const stData = data && data.states && data.states[state];
const scens = stData
? SCEN_ORDER.filter(s => stData[s]) : [];
const [scen, setScen] = useState(scens[0] || "managed (harvest)");
useEffect(() => { if(scens.length && !scens.includes(scen)) setScen(scens[0]); }, [state]);

if(!data || !data.states) return <div className="empty">HWP storage data not loaded.</div>;
if(!stData) return <div className="empty">No HWP storage for {state}.</div>;

const rows = stData[scen] || [];
const line = key => rows.map(r => [r.year, null, r[key], null]);
const poolSeries = POOL.map(p => ({ label: p.label, color: p.color, pts: line(p.key) }));
const avoidSeries = [{ label: "Avoided (substitution)", color: "#9467bd", pts: line("avoided") }];

const last = rows[rows.length - 1] || {};
return (
<div>
<div className="controls" style={{marginTop:0}}>
<select value={scen} onChange={e=>setScen(e.target.value)} title="Management scenario">
{scens.map(s => <option key={s} value={s}>{s}</option>)}
</select>
<span style={{color:"var(--mut)",fontSize:12,alignSelf:"center"}}>stored carbon (Tg C)</span>
</div>
<div className="chartcard" style={{padding:"6px 8px"}}>
<MiniChart series={poolSeries} unit="Tg C" xlabel="Year"/>
</div>
<div className="lgd" style={{marginTop:8}}>
{POOL.map(p => <span key={p.key}><i style={{background:p.color,width:14,height:3}}/>{p.label}</span>)}
</div>
<div className="chartcard" style={{padding:"6px 8px",marginTop:10}}>
<MiniChart series={avoidSeries} unit="Tg C (cumulative)" xlabel="Year"/>
</div>
<div className="note">
<b>Stored carbon</b> in harvested wood products under <b>{scen}</b> for {state}:
in-use solidwood (building/exterior/home), paper, landfill, and charcoal pools,
from a WPsCS-style first-order-decay model (Wei 2022 service lives) driven by the
PERSEUS hybrid harvest. At {last.year}: HWP total {last.total?.toFixed(1)} Tg C.
The lower panel is <b>Avoided Carbon</b> (substitution of wood for non-wood
materials, cumulative, displacement factor 1.2) reported separately per the FACT
taxonomy, never added to stored-carbon totals. <i>Experimental layer; parameters
(regional product allocation, recycling) not yet finalized. Data: api/hwp_storage.json.</i>
</div>
</div>
);
}