Skip to content

Commit 89c6923

Browse files
Deeplink to geophires analysis for facility gradient from explorer
1 parent 90edf6a commit 89c6923

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

explorer/explorer-map.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ async function initMap() {
2626
});
2727
}
2828

29+
function getGeophiresWebInterfaceDeeplinkUrl(params) {
30+
let hashParams = new URLSearchParams()
31+
hashParams.set('geophires_input_parameters', JSON.stringify(params))
32+
let url = new URL(`${location.origin}/geothermal/geophires`)
33+
url.hash = btoa(hashParams.toString())
34+
return url
35+
}
36+
2937
initMap().then(async () => {
3038

3139
const {
@@ -149,22 +157,20 @@ initMap().then(async () => {
149157
$(summaryTable).append($(`<thead><tr><th colspan='2'>PRE-CACLULATED FACILITY RESULTS: ${facilityName}</th></tr></thead>`))
150158
$(summaryTable).append(getTbody(facilityData.geophires_summary))
151159

152-
153-
// WIP...
154-
/*
155-
'End-Use Option': EndUseOption.DIRECT_USE_HEAT.value,
156-
'Reservoir Model': 1,
157-
'Time steps per year': 6,
158-
'Reservoir Depth': 3,
159-
'Gradient 1': temp_gradient,
160-
*/
161-
// let geophiresDeeplinkHash = 'abc'
162-
// let geophiresDeeplink = `/geothermal/geophires#${geophiresDeeplinkHash}`
163-
160+
let geophiresParams = {
161+
'End-Use Option': 2,
162+
'Reservoir Depth': 3,
163+
'Gradient 1': facilityData['gradient_degC_per_km'],
164+
'Reservoir Model': 1,
165+
'Time steps per year': 6,
166+
}
164167
$('#results').empty()
165168
.append(summaryTable)
166169
//.append(infoTable.clone())
167-
//.append($(`<a href='${geophiresDeeplink}'>geophires</a>`))
170+
.append(
171+
$(`<a href='${getGeophiresWebInterfaceDeeplinkUrl(geophiresParams)}' target="_blank">
172+
Click here to start your own GEOPHIRES analysis with the estimated gradient at this facility location</a>`)
173+
)
168174

169175
resetGenerationProfileGraphs()
170176
});

0 commit comments

Comments
 (0)