diff --git a/dev/isle_of_wight/assets/index-b43c2f54.js b/dev/isle_of_wight/assets/index-1b5325d1.js similarity index 99% rename from dev/isle_of_wight/assets/index-b43c2f54.js rename to dev/isle_of_wight/assets/index-1b5325d1.js index 7d79dc3..70ab112 100644 --- a/dev/isle_of_wight/assets/index-b43c2f54.js +++ b/dev/isle_of_wight/assets/index-1b5325d1.js @@ -32,23 +32,23 @@ modelled development strategies on any of the four indicators. select all OAs within the region.`,e1(e,"class","smaller svelte-1392tz3")},m(t,r){te(t,e,r)},d(t){t&&J1(e)}}}function Db(i){let e;return{c(){e=S1("div"),e.textContent=`Click on the map to select an output area. You can shift-click to select multiple, or click anywhere outside the map to deselect all.`,e1(e,"class","smaller svelte-1392tz3")},m(t,r){te(t,e,r)},d(t){t&&J1(e)}}}function Lb(i){let e,t=i[0].length+"",r,n,f=i[0].length===1?"":"s",p,o,y,d,x,w,P,q,C,S,T,A;x=new ju({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function z(K,J){return K[2]?Bb:Ob}let R=z(i),N=R(i),W=i[14]&&Qc(i);return{c(){e=S1("span"),r=Re(t),n=Re(" output area"),p=Re(f),o=Re(" selected."),y=le(),d=S1("div"),d5(x.$$.fragment),w=le(),P=S1("input"),q=le(),N.c(),C=le(),W&&W.c(),e1(P,"type","checkbox"),e1(P,"id","sig-modified"),e1(d,"id","changes-grid"),e1(d,"class","svelte-1392tz3")},m(K,J){te(K,e,J),p1(e,r),p1(e,n),p1(e,p),p1(e,o),te(K,y,J),te(K,d,J),p5(x,d,null),p1(d,w),p1(d,P),P.checked=i[2],p1(d,q),N.m(d,null),p1(d,C),W&&W.m(d,null),S=!0,T||(A=[Ge(P,"change",i[27]),Ge(P,"change",i[28])],T=!0)},p(K,J){(!S||J[0]&1)&&t!==(t=K[0].length+"")&&_0(r,t),(!S||J[0]&1)&&f!==(f=K[0].length===1?"":"s")&&_0(p,f),J[0]&4&&(P.checked=K[2]),R===(R=z(K))&&N?N.p(K,J):(N.d(1),N=R(K),N&&(N.c(),N.m(d,C))),K[14]?W?(W.p(K,J),J[0]&16384&&he(W,1)):(W=Qc(K),W.c(),he(W,1),W.m(d,null)):W&&(x0(),xe(W,1,1,()=>{W=null}),v0())},i(K){S||(he(x.$$.fragment,K),he(W),S=!0)},o(K){xe(x.$$.fragment,K),xe(W),S=!1},d(K){K&&J1(e),K&&J1(y),K&&J1(d),u5(x),N.d(),W&&W.d(),T=!1,p0(A)}}}function Rb(i){let e;return{c(){e=S1("span"),e.textContent="No output areas selected."},m(t,r){te(t,e,r)},p:t5,i:t5,o:t5,d(t){t&&J1(e)}}}function Ob(i){let e,t=[...Se.signatures.entries()],r=[];for(let n=0;ni[29].call(e))},m(p,o){te(p,e,o);for(let y=0;yO0(e,"modified",q)),H5.push(()=>O0(e,"value",C)),e.$on("change",i[19]);function T(K){i[33](K)}function A(K){i[34](K)}let z={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:i[10],max:i[11],defaultVal:i[10],step:.01};i[9]!==void 0&&(z.modified=i[9]),i[8]!==void 0&&(z.value=i[8]),f=new Ns({props:z}),H5.push(()=>O0(f,"modified",T)),H5.push(()=>O0(f,"value",A)),f.$on("change",i[19]);function R(K){i[35](K)}function N(K){i[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return i[13]!==void 0&&(W.modified=i[13]),i[12]!==void 0&&(W.value=i[12]),d=new Ns({props:W}),H5.push(()=>O0(d,"modified",R)),H5.push(()=>O0(d,"value",N)),d.$on("change",i[19]),{c(){d5(e.$$.fragment),n=le(),d5(f.$$.fragment),y=le(),d5(d.$$.fragment)},m(K,J){p5(e,K,J),te(K,n,J),p5(f,K,J),te(K,y,J),p5(d,K,J),P=!0},p(K,J){const s1={};J[0]&64&&(s1.min=K[6]),J[0]&128&&(s1.max=K[7]),J[0]&64&&(s1.defaultVal=K[6]),!t&&J[0]&32&&(t=!0,s1.modified=K[5],R0(()=>t=!1)),!r&&J[0]&16&&(r=!0,s1.value=K[4],R0(()=>r=!1)),e.$set(s1);const i1={};J[0]&1024&&(i1.min=K[10]),J[0]&2048&&(i1.max=K[11]),J[0]&1024&&(i1.defaultVal=K[10]),!p&&J[0]&512&&(p=!0,i1.modified=K[9],R0(()=>p=!1)),!o&&J[0]&256&&(o=!0,i1.value=K[8],R0(()=>o=!1)),f.$set(i1);const d1={};!x&&J[0]&8192&&(x=!0,d1.modified=K[13],R0(()=>x=!1)),!w&&J[0]&4096&&(w=!0,d1.value=K[12],R0(()=>w=!1)),d.$set(d1)},i(K){P||(he(e.$$.fragment,K),he(f.$$.fragment,K),he(d.$$.fragment,K),P=!0)},o(K){xe(e.$$.fragment,K),xe(f.$$.fragment,K),xe(d.$$.fragment,K),P=!1},d(K){u5(e,K),K&&J1(n),u5(f,K),K&&J1(y),u5(d,K)}}}function Nb(i){let e,t,r,n,f,p,o,y,d,x,w,P,q,C,S,T,A,z,R,N;e=new Fu({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",i[24]),e.$on("forwardClick",i[25]),r=new F7({});function W(_1,o1){if(_1[16]==="click")return Db;if(_1[16]==="draw")return zb}let K=W(i),J=K&&K(i);q=new F7({});const s1=[Rb,Lb],i1=[];function d1(_1,o1){return _1[0].length===0?0:1}return S=d1(i),T=i1[S]=s1[S](i),{c(){d5(e.$$.fragment),t=le(),d5(r.$$.fragment),n=le(),f=S1("div"),p=S1("i"),p.textContent="Selection method",o=le(),y=S1("select"),d=S1("option"),d.textContent="Click on map",x=S1("option"),x.textContent="Freehand draw",w=le(),J&&J.c(),P=le(),d5(q.$$.fragment),C=le(),T.c(),A=$t(),d.__value="click",d.value=d.__value,x.__value="draw",x.value=x.__value,e1(y,"id","oa-selection-method"),i[16]===void 0&&$0(()=>i[26].call(y)),e1(f,"id","selection-method-choice"),e1(f,"class","svelte-1392tz3")},m(_1,o1){p5(e,_1,o1),te(_1,t,o1),p5(r,_1,o1),te(_1,n,o1),te(_1,f,o1),p1(f,p),p1(f,o),p1(f,y),p1(y,d),p1(y,x),e9(y,i[16],!0),te(_1,w,o1),J&&J.m(_1,o1),te(_1,P,o1),p5(q,_1,o1),te(_1,C,o1),i1[S].m(_1,o1),te(_1,A,o1),z=!0,R||(N=Ge(y,"change",i[26]),R=!0)},p(_1,o1){o1[0]&65536&&e9(y,_1[16]),K!==(K=W(_1))&&(J&&J.d(1),J=K&&K(_1),J&&(J.c(),J.m(P.parentNode,P)));let P1=S;S=d1(_1),S===P1?i1[S].p(_1,o1):(x0(),xe(i1[P1],1,1,()=>{i1[P1]=null}),v0(),T=i1[S],T?T.p(_1,o1):(T=i1[S]=s1[S](_1),T.c()),he(T,1),T.m(A.parentNode,A))},i(_1){z||(he(e.$$.fragment,_1),he(r.$$.fragment,_1),he(q.$$.fragment,_1),he(T),z=!0)},o(_1){xe(e.$$.fragment,_1),xe(r.$$.fragment,_1),xe(q.$$.fragment,_1),xe(T),z=!1},d(_1){u5(e,_1),_1&&J1(t),u5(r,_1),_1&&J1(n),_1&&J1(f),_1&&J1(w),J&&J.d(_1),_1&&J1(P),u5(q,_1),_1&&J1(C),i1[S].d(_1),_1&&J1(A),R=!1,N()}}}function Vb(i){let e,t;return e=new ca({props:{title:"Step 2: Modify output areas",$$slots:{default:[Nb]},$$scope:{ctx:i}}}),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,n){const f={};n[0]&131071|n[1]&1048576&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function L6(i){return Math.round(i*100)/100}function Ub(i,e,t){let r,n,f,p,o;m5(i,nt,ue=>t(0,r=ue)),m5(i,O9,ue=>t(37,n=ue)),m5(i,c7,ue=>t(38,f=ue)),m5(i,lt,ue=>t(39,p=ue)),m5(i,Y4,ue=>t(16,o=ue));const y=Ft();let{changes:d=n.get(p).changes}=e,{userChangesPresent:x}=e,w=!1;R7(()=>{q5(c7,f=!0,f),t(23,w=!0)}),O7(()=>{q5(c7,f=!1,f)});let P=null,q,C,S=null,T,A,z,R=null,N,W,K,J=null,s1,i1=!1;function d1(ue){if(ue.length===0)return{kind:"None"};if(ue.length===1){const we=ue[0].name,U=P1(we).get("signature_type");return U===null?{kind:"SinglePassive",oaName:we,sigId:o1(we)}:{kind:"SingleActive",oaName:we,sigId:U}}else{const we=ue.map(c1=>c1.name),$1=ue.map(c1=>P1(c1.name)).map(c1=>c1.get("signature_type")),N1=we.map(c1=>o1(c1));if($1.every(c1=>c1===null))return N1.every(c1=>c1===N1[0])?{kind:"MultipleSamePassive",oaNames:we,sigId:N1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:N1};if($1.some(c1=>c1!==null)&&$1.some(c1=>c1===null)){const c1=$1.map((l1,F1)=>l1||N1[F1]);return c1.every(l1=>l1===c1[0])?{kind:"MultipleSamePassive",oaNames:we,sigId:c1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:c1}}else return $1.every(c1=>c1===$1[0])?{kind:"MultipleSameActive",oaNames:we,sigId:$1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:$1}}}let _1=d1(r);function o1(ue){return n.get(Se.referenceScenarioObject.metadata.name).values.get(ue).get("signature_type")}function P1(ue){const we=d.has(ue),U=d.get(ue);return new Map([["signature_type",we?U.get("signature_type"):null],["job_types",we?U.get("job_types"):null],["use",we?U.get("use"):null],["greenspace",we?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",P),!q&&!T&&!N&&!s1)r.forEach(ue=>{d.delete(ue.name)});else{const ue=new Map([["signature_type",q?P:null],["job_types",T?S:null],["use",N?R:null],["greenspace",s1?J:null]]);r.forEach(we=>{d.set(we.name,ue)})}y("changesUpdated"),t(21,x=!0)}function m1(ue,we){t(4,S=P1(ue).get("job_types")),t(8,R=P1(ue).get("use")),t(12,J=P1(ue).get("greenspace")),t(5,T=S!==null),t(9,N=R!==null),t(13,s1=J!==null),t(6,A=L6(Se.signatures[we].job_d1)),t(7,z=L6(Se.signatures[we].job_d9)),t(10,W=L6(Se.signatures[we].use_d1)),t(11,K=L6(Se.signatures[we].use_d9))}function g1(ue,we){const U=ue.map(N1=>P1(N1));function $1(N1){const c1=U.map(l1=>l1.get(N1));return c1.every(l1=>l1===c1[0]&&l1!==null)?c1[0]:null}t(4,S=$1("job_types")),t(5,T=S!==null),t(8,R=$1("use")),t(9,N=R!==null),t(12,J=$1("greenspace")),t(13,s1=J!==null),t(6,A=Se.signatures[we].job_d1),t(7,z=Se.signatures[we].job_d9),t(10,W=Se.signatures[we].use_d1),t(11,K=Se.signatures[we].use_d9)}function k1(){switch(_1.kind){case"None":return;case"SingleActive":t(1,P=_1.sigId),t(2,q=!0),t(3,C=_1.sigId);break;case"SinglePassive":t(1,P=null),t(2,q=!1),t(3,C=_1.sigId);break;case"MultipleDifferent":t(1,P=null),t(2,q=!1),t(3,C=null);break;case"MultipleSameActive":t(1,P=_1.sigId),t(2,q=!0),t(3,C=null);break;case"MultipleSamePassive":t(1,P=null),t(2,q=!1),t(3,C=_1.sigId);break}C1()}function C1(){function ue(we){t(6,A=L6(Se.signatures[we].job_d1)),t(7,z=L6(Se.signatures[we].job_d9)),t(10,W=L6(Se.signatures[we].use_d1)),t(11,K=L6(Se.signatures[we].use_d9))}switch(console.log(_1),_1.kind){case"None":t(14,i1=!1);break;case"SingleActive":t(14,i1=!0),m1(_1.oaName,_1.sigId),ue(_1.sigId);break;case"SinglePassive":t(14,i1=!0),m1(_1.oaName,_1.sigId),ue(_1.sigId);break;case"MultipleSameActive":t(14,i1=!0),g1(_1.oaNames,_1.sigId),ue(_1.sigId);break;case"MultipleSamePassive":t(14,i1=!0),g1(_1.oaNames,_1.sigId),ue(_1.sigId);break;case"MultipleDifferent":t(14,i1=!1),t(4,S=null),t(8,R=null),t(12,J=null),t(5,T=!1),t(9,N=!1),t(13,s1=!1),V();break}}const I1=()=>y("returnToSelection",{}),L1=()=>y("proceedToMetadata",{});function E1(){o=b7(this),Y4.set(o)}function M1(){q=this.checked,t(2,q)}const _e=()=>{q&&_1.kind!=="MultipleDifferent"?t(1,P=C):(q&&_1.kind,t(1,P=null)),V(),t(15,_1=d1(r)),C1()};function ce(){P=b7(this),t(1,P)}const se=()=>{V(),t(15,_1=d1(r)),C1()};function ke(ue){T=ue,t(5,T)}function Ue(ue){S=ue,t(4,S)}function Pe(ue){N=ue,t(9,N)}function Ae(ue){R=ue,t(8,R)}function Xe(ue){s1=ue,t(13,s1)}function Ye(ue){J=ue,t(12,J)}return i.$$set=ue=>{"changes"in ue&&t(22,d=ue.changes),"userChangesPresent"in ue&&t(21,x=ue.userChangesPresent)},i.$$.update=()=>{i.$$.dirty[0]&8388609&&(t(15,_1=d1(r)),w&&k1())},[r,P,q,C,S,T,A,z,R,N,W,K,J,s1,i1,_1,o,y,d1,V,C1,x,d,w,I1,L1,E1,M1,_e,ce,se,ke,Ue,Pe,Ae,Xe,Ye]}class $b extends W5{constructor(e){super(),$5(this,e,Ub,Vb,z5,{changes:22,userChangesPresent:21},null,[-1,-1])}}function Wb(i){let e;return{c(){e=S1("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(t,r){te(t,e,r)},d(t){t&&J1(e)}}}function Gb(i){let e,t,r;return{c(){e=Re("This uses the "),t=S1("a"),t.textContent="Pyodide library",r=Re(" to run the calculation entirely in your browser."),e1(t,"href","https://pyodide.org/en/stable/"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Zb(i){let e,t,r;return{c(){e=Re("To use this option, the API must be running on port 5178. See the "),t=S1("a"),t.textContent="developer notes",r=Re(" for details on how to set this up."),e1(t,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Hb(i){let e,t,r;return{c(){e=Re("This is an "),t=S1("a"),t.textContent="Azure Functions",r=Re(" instance, i.e. a web service hosted on the cloud."),e1(t,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Xb(i){let e,t,r,n,f,p,o,y,d,x,w,P,q,C,S,T,A,z,R,N,W;e=new Fu({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",i[7]),e.$on("forwardClick",i[8]),r=new F7({});let K=!i[6]&&Wb();function J(d1,_1){if(d1[2]==="azure")return Hb;if(d1[2]==="local")return Zb;if(d1[2]==="wasm")return Gb}let s1=J(i),i1=s1&&s1(i);return C=new F7({}),{c(){d5(e.$$.fragment),t=le(),d5(r.$$.fragment),n=le(),f=S1("div"),p=S1("i"),p.textContent="Calculation method",o=le(),y=S1("select"),d=S1("option"),d.textContent="Azure REST API",K&&K.c(),x=S1("option"),x.textContent="In-browser",w=le(),P=S1("div"),i1&&i1.c(),q=le(),d5(C.$$.fragment),S=le(),T=S1("input"),A=le(),z=S1("textarea"),d.__value="azure",d.value=d.__value,x.__value="wasm",x.value=x.__value,i[2]===void 0&&$0(()=>i[9].call(y)),e1(f,"id","calculation-method-choice"),e1(f,"class","svelte-ygj49d"),e1(P,"class","smaller svelte-ygj49d"),e1(T,"type","text"),e1(T,"placeholder","Scenario title..."),e1(T,"class","svelte-ygj49d"),e1(z,"placeholder","A longer textual description..."),e1(z,"spellcheck","false"),e1(z,"class","svelte-ygj49d")},m(d1,_1){p5(e,d1,_1),te(d1,t,_1),p5(r,d1,_1),te(d1,n,_1),te(d1,f,_1),p1(f,p),p1(f,o),p1(f,y),p1(y,d),K&&K.m(y,null),p1(y,x),e9(y,i[2],!0),te(d1,w,_1),te(d1,P,_1),i1&&i1.m(P,null),te(d1,q,_1),p5(C,d1,_1),te(d1,S,_1),te(d1,T,_1),i[10](T),It(T,i[0]),te(d1,A,_1),te(d1,z,_1),i[13](z),It(z,i[1]),R=!0,N||(W=[Ge(y,"change",i[9]),Ge(T,"input",i[11]),Ge(T,"input",i[12]),Ge(z,"input",i[14]),Ge(z,"input",i[15])],N=!0)},p(d1,_1){_1&4&&e9(y,d1[2]),s1!==(s1=J(d1))&&(i1&&i1.d(1),i1=s1&&s1(d1),i1&&(i1.c(),i1.m(P,null))),_1&1&&T.value!==d1[0]&&It(T,d1[0]),_1&2&&It(z,d1[1])},i(d1){R||(he(e.$$.fragment,d1),he(r.$$.fragment,d1),he(C.$$.fragment,d1),R=!0)},o(d1){xe(e.$$.fragment,d1),xe(r.$$.fragment,d1),xe(C.$$.fragment,d1),R=!1},d(d1){u5(e,d1),d1&&J1(t),u5(r,d1),d1&&J1(n),d1&&J1(f),K&&K.d(),d1&&J1(w),d1&&J1(P),i1&&i1.d(),d1&&J1(q),u5(C,d1),d1&&J1(S),d1&&J1(T),i[10](null),d1&&J1(A),d1&&J1(z),i[13](null),N=!1,p0(W)}}}function Yb(i){let e,t;return e=new ca({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[Xb]},$$scope:{ctx:i}}}),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,[n]){const f={};n&65567&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function ef(i){i.style.borderColor="#f26d88"}function Kb(i,e,t){let{scenarioShort:r=""}=e,{scenarioDescription:n=""}=e,{calculationMethod:f="azure"}=e;const p=Ft();let o,y;const d=window.location.href.toLowerCase().includes(Se.baseUrl.toLowerCase()),x=()=>p("returnToModify"),w=()=>{if(r===""){alert("Please enter a scenario title."),ef(o);return}if(n===""){alert("Please enter a scenario description."),ef(y);return}p("acceptChangesAndCalculate")};function P(){f=b7(this),t(2,f)}function q(R){H5[R?"unshift":"push"](()=>{o=R,t(3,o)})}function C(){r=this.value,t(0,r)}const S=()=>{t(3,o.style.borderColor=r===""?"#f26d88":"#999",o)};function T(R){H5[R?"unshift":"push"](()=>{y=R,t(4,y)})}function A(){n=this.value,t(1,n)}const z=()=>{t(4,y.style.borderColor=n===""?"#f26d88":"#999",y)};return i.$$set=R=>{"scenarioShort"in R&&t(0,r=R.scenarioShort),"scenarioDescription"in R&&t(1,n=R.scenarioDescription),"calculationMethod"in R&&t(2,f=R.calculationMethod)},[r,n,f,o,y,p,d,x,w,P,q,C,S,T,A,z]}class Jb extends W5{constructor(e){super(),$5(this,e,Kb,Yb,z5,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Qb="modulepreload",em=function(i){return"/demoland-web/dev/isle_of_wight/"+i},tf={},tm=function(e,t,r){if(!t||t.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(t.map(f=>{if(f=em(f),f in tf)return;tf[f]=!0;const p=f.endsWith(".css"),o=p?'[rel="stylesheet"]':"";if(!!r)for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.href===f&&(!p||w.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${o}`))return;const d=document.createElement("link");if(d.rel=p?"stylesheet":Qb,p||(d.as="script",d.crossOrigin=""),d.href=f,document.head.appendChild(d),p)return new Promise((x,w)=>{d.addEventListener("load",x),d.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=f,window.dispatchEvent(p),!p.defaultPrevented)throw f})};let Zi;const D4={};let _4=0;async function im(){if(Zi)return Zi;const i=await tm(()=>import("./pyodide_worker-4c3de915.js"),[]);return Zi=new i.default,Zi.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:t,...r}=e.data,n=D4[t];console.log(D4),delete D4[t],n(r)}},Zi}async function rm(i,e){const t=await im();return _4=(_4+1)%Number.MAX_SAFE_INTEGER,new Promise(r=>{D4[_4]=r,t.postMessage({...e,python:i,id:_4,pathname:window.location.pathname})})}async function sm(i){const t=await rm(` import pyodide_http - pyodide_http.patch_all() + pyodide_http.patch_all() print(globals()) from js import scenario_json import demoland_engine import json import time - + start = time.time() scenario = json.loads(scenario_json) - - df = demoland_engine.get_empty() + + df = demoland_engine.get_empty() for oa_code, vals in scenario["scenario_json"].items(): df.loc[oa_code] = list(vals.values()) pred = demoland_engine.get_indicators(df, random_seed=42) - sig = demoland_engine.sampling.oa_key.primary_type.copy() + sig = demoland_engine.data.FILEVAULT["oa_key"].primary_type.copy() mapping = { "Wild countryside": 0, diff --git a/dev/isle_of_wight/index.html b/dev/isle_of_wight/index.html index a02707e..ab6cce8 100644 --- a/dev/isle_of_wight/index.html +++ b/dev/isle_of_wight/index.html @@ -7,7 +7,7 @@ - + diff --git a/dev/tyne_and_wear/assets/index-c7e4cbb3.js b/dev/tyne_and_wear/assets/index-5335266c.js similarity index 99% rename from dev/tyne_and_wear/assets/index-c7e4cbb3.js rename to dev/tyne_and_wear/assets/index-5335266c.js index 24958e1..aebeca9 100644 --- a/dev/tyne_and_wear/assets/index-c7e4cbb3.js +++ b/dev/tyne_and_wear/assets/index-5335266c.js @@ -37,23 +37,23 @@ modelled development strategies on any of the four indicators. select all OAs within the region.`,ee(e,"class","smaller svelte-1392tz3")},m(i,t){i1(i,e,t)},d(i){i&&Je(e)}}}function oq(s){let e;return{c(){e=Pe("div"),e.textContent=`Click on the map to select an output area. You can shift-click to select multiple, or click anywhere outside the map to deselect all.`,ee(e,"class","smaller svelte-1392tz3")},m(i,t){i1(i,e,t)},d(i){i&&Je(e)}}}function lq(s){let e,i=s[0].length+"",t,_,o=s[0].length===1?"":"s",n,c,u,g,d,x,m,A,O,P,F,T;d=new Cp({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function M(K,J){return K[2]?uq:pq}let L=M(s),N=L(s),W=s[14]&&Jy(s);return{c(){e=Pe("span"),t=L1(i),_=L1(" output area"),n=L1(o),c=L1(" selected."),u=l1(),g=Pe("div"),g0(d.$$.fragment),x=l1(),m=Pe("input"),A=l1(),N.c(),O=l1(),W&&W.c(),ee(m,"type","checkbox"),ee(m,"id","sig-modified"),ee(g,"id","changes-grid"),ee(g,"class","svelte-1392tz3")},m(K,J){i1(K,e,J),ne(e,t),ne(e,_),ne(e,n),ne(e,c),i1(K,u,J),i1(K,g,J),n0(d,g,null),ne(g,x),ne(g,m),m.checked=s[2],ne(g,A),N.m(g,null),ne(g,O),W&&W.m(g,null),P=!0,F||(T=[G1(m,"change",s[27]),G1(m,"change",s[28])],F=!0)},p(K,J){(!P||J[0]&1)&&i!==(i=K[0].length+"")&&b4(t,i),(!P||J[0]&1)&&o!==(o=K[0].length===1?"":"s")&&b4(n,o),J[0]&4&&(m.checked=K[2]),L===(L=M(K))&&N?N.p(K,J):(N.d(1),N=L(K),N&&(N.c(),N.m(g,O))),K[14]?W?(W.p(K,J),J[0]&16384&&h1(W,1)):(W=Jy(K),W.c(),h1(W,1),W.m(g,null)):W&&(d4(),d1(W,1,1,()=>{W=null}),f4())},i(K){P||(h1(d.$$.fragment,K),h1(W),P=!0)},o(K){d1(d.$$.fragment,K),d1(W),P=!1},d(K){K&&Je(e),K&&Je(u),K&&Je(g),p0(d),N.d(),W&&W.d(),F=!1,n4(T)}}}function nq(s){let e;return{c(){e=Pe("span"),e.textContent="No output areas selected."},m(i,t){i1(i,e,t)},p:i0,i:i0,o:i0,d(i){i&&Je(e)}}}function pq(s){let e,i=[...P1.signatures.entries()],t=[];for(let _=0;_s[29].call(e))},m(n,c){i1(n,e,c);for(let u=0;uR4(e,"modified",A)),H0.push(()=>R4(e,"value",O)),e.$on("change",s[19]);function F(K){s[33](K)}function T(K){s[34](K)}let M={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:s[10],max:s[11],defaultVal:s[10],step:.01};s[9]!==void 0&&(M.modified=s[9]),s[8]!==void 0&&(M.value=s[8]),o=new Na({props:M}),H0.push(()=>R4(o,"modified",F)),H0.push(()=>R4(o,"value",T)),o.$on("change",s[19]);function L(K){s[35](K)}function N(K){s[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return s[13]!==void 0&&(W.modified=s[13]),s[12]!==void 0&&(W.value=s[12]),g=new Na({props:W}),H0.push(()=>R4(g,"modified",L)),H0.push(()=>R4(g,"value",N)),g.$on("change",s[19]),{c(){g0(e.$$.fragment),_=l1(),g0(o.$$.fragment),u=l1(),g0(g.$$.fragment)},m(K,J){n0(e,K,J),i1(K,_,J),n0(o,K,J),i1(K,u,J),n0(g,K,J),m=!0},p(K,J){const ae={};J[0]&64&&(ae.min=K[6]),J[0]&128&&(ae.max=K[7]),J[0]&64&&(ae.defaultVal=K[6]),!i&&J[0]&32&&(i=!0,ae.modified=K[5],L4(()=>i=!1)),!t&&J[0]&16&&(t=!0,ae.value=K[4],L4(()=>t=!1)),e.$set(ae);const se={};J[0]&1024&&(se.min=K[10]),J[0]&2048&&(se.max=K[11]),J[0]&1024&&(se.defaultVal=K[10]),!n&&J[0]&512&&(n=!0,se.modified=K[9],L4(()=>n=!1)),!c&&J[0]&256&&(c=!0,se.value=K[8],L4(()=>c=!1)),o.$set(se);const ge={};!d&&J[0]&8192&&(d=!0,ge.modified=K[13],L4(()=>d=!1)),!x&&J[0]&4096&&(x=!0,ge.value=K[12],L4(()=>x=!1)),g.$set(ge)},i(K){m||(h1(e.$$.fragment,K),h1(o.$$.fragment,K),h1(g.$$.fragment,K),m=!0)},o(K){d1(e.$$.fragment,K),d1(o.$$.fragment,K),d1(g.$$.fragment,K),m=!1},d(K){p0(e,K),K&&Je(_),p0(o,K),K&&Je(u),p0(g,K)}}}function bq(s){let e,i,t,_,o,n,c,u,g,d,x,m,A,O,P,F,T,M,L,N;e=new vp({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",s[24]),e.$on("forwardClick",s[25]),t=new vs({});function W(be,ce){if(be[16]==="click")return oq;if(be[16]==="draw")return yq}let K=W(s),J=K&&K(s);A=new vs({});const ae=[nq,lq],se=[];function ge(be,ce){return be[0].length===0?0:1}return P=ge(s),F=se[P]=ae[P](s),{c(){g0(e.$$.fragment),i=l1(),g0(t.$$.fragment),_=l1(),o=Pe("div"),n=Pe("i"),n.textContent="Selection method",c=l1(),u=Pe("select"),g=Pe("option"),g.textContent="Click on map",d=Pe("option"),d.textContent="Freehand draw",x=l1(),J&&J.c(),m=l1(),g0(A.$$.fragment),O=l1(),F.c(),T=$i(),g.__value="click",g.value=g.__value,d.__value="draw",d.value=d.__value,ee(u,"id","oa-selection-method"),s[16]===void 0&&$4(()=>s[26].call(u)),ee(o,"id","selection-method-choice"),ee(o,"class","svelte-1392tz3")},m(be,ce){n0(e,be,ce),i1(be,i,ce),n0(t,be,ce),i1(be,_,ce),i1(be,o,ce),ne(o,n),ne(o,c),ne(o,u),ne(u,g),ne(u,d),e5(u,s[16],!0),i1(be,x,ce),J&&J.m(be,ce),i1(be,m,ce),n0(A,be,ce),i1(be,O,ce),se[P].m(be,ce),i1(be,T,ce),M=!0,L||(N=G1(u,"change",s[26]),L=!0)},p(be,ce){ce[0]&65536&&e5(u,be[16]),K!==(K=W(be))&&(J&&J.d(1),J=K&&K(be),J&&(J.c(),J.m(m.parentNode,m)));let me=P;P=ge(be),P===me?se[P].p(be,ce):(d4(),d1(se[me],1,1,()=>{se[me]=null}),f4(),F=se[P],F?F.p(be,ce):(F=se[P]=ae[P](be),F.c()),h1(F,1),F.m(T.parentNode,T))},i(be){M||(h1(e.$$.fragment,be),h1(t.$$.fragment,be),h1(A.$$.fragment,be),h1(F),M=!0)},o(be){d1(e.$$.fragment,be),d1(t.$$.fragment,be),d1(A.$$.fragment,be),d1(F),M=!1},d(be){p0(e,be),be&&Je(i),p0(t,be),be&&Je(_),be&&Je(o),be&&Je(x),J&&J.d(be),be&&Je(m),p0(A,be),be&&Je(O),se[P].d(be),be&&Je(T),L=!1,N()}}}function gq(s){let e,i;return e=new _r({props:{title:"Step 2: Modify output areas",$$slots:{default:[bq]},$$scope:{ctx:s}}}),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,_){const o={};_[0]&131071|_[1]&1048576&&(o.$$scope={dirty:_,ctx:t}),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function z9(s){return Math.round(s*100)/100}function hq(s,e,i){let t,_,o,n,c;q0(s,_i,p1=>i(0,t=p1)),q0(s,R5,p1=>i(37,_=p1)),q0(s,ys,p1=>i(38,o=p1)),q0(s,li,p1=>i(39,n=p1)),q0(s,Y8,p1=>i(16,c=p1));const u=vi();let{changes:g=_.get(n).changes}=e,{userChangesPresent:d}=e,x=!1;Ls(()=>{A0(ys,o=!0,o),i(23,x=!0)}),Rs(()=>{A0(ys,o=!1,o)});let m=null,A,O,P=null,F,T,M,L=null,N,W,K,J=null,ae,se=!1;function ge(p1){if(p1.length===0)return{kind:"None"};if(p1.length===1){const x1=p1[0].name,U=me(x1).get("signature_type");return U===null?{kind:"SinglePassive",oaName:x1,sigId:ce(x1)}:{kind:"SingleActive",oaName:x1,sigId:U}}else{const x1=p1.map(ye=>ye.name),$e=p1.map(ye=>me(ye.name)).map(ye=>ye.get("signature_type")),Ne=x1.map(ye=>ce(ye));if($e.every(ye=>ye===null))return Ne.every(ye=>ye===Ne[0])?{kind:"MultipleSamePassive",oaNames:x1,sigId:Ne[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:Ne};if($e.some(ye=>ye!==null)&&$e.some(ye=>ye===null)){const ye=$e.map((le,ve)=>le||Ne[ve]);return ye.every(le=>le===ye[0])?{kind:"MultipleSamePassive",oaNames:x1,sigId:ye[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:ye}}else return $e.every(ye=>ye===$e[0])?{kind:"MultipleSameActive",oaNames:x1,sigId:$e[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:$e}}}let be=ge(t);function ce(p1){return _.get(P1.referenceScenarioObject.metadata.name).values.get(p1).get("signature_type")}function me(p1){const x1=g.has(p1),U=g.get(p1);return new Map([["signature_type",x1?U.get("signature_type"):null],["job_types",x1?U.get("job_types"):null],["use",x1?U.get("use"):null],["greenspace",x1?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",m),!A&&!F&&!N&&!ae)t.forEach(p1=>{g.delete(p1.name)});else{const p1=new Map([["signature_type",A?m:null],["job_types",F?P:null],["use",N?L:null],["greenspace",ae?J:null]]);t.forEach(x1=>{g.set(x1.name,p1)})}u("changesUpdated"),i(21,d=!0)}function qe(p1,x1){i(4,P=me(p1).get("job_types")),i(8,L=me(p1).get("use")),i(12,J=me(p1).get("greenspace")),i(5,F=P!==null),i(9,N=L!==null),i(13,ae=J!==null),i(6,T=z9(P1.signatures[x1].job_d1)),i(7,M=z9(P1.signatures[x1].job_d9)),i(10,W=z9(P1.signatures[x1].use_d1)),i(11,K=z9(P1.signatures[x1].use_d9))}function Ee(p1,x1){const U=p1.map(Ne=>me(Ne));function $e(Ne){const ye=U.map(le=>le.get(Ne));return ye.every(le=>le===ye[0]&&le!==null)?ye[0]:null}i(4,P=$e("job_types")),i(5,F=P!==null),i(8,L=$e("use")),i(9,N=L!==null),i(12,J=$e("greenspace")),i(13,ae=J!==null),i(6,T=P1.signatures[x1].job_d1),i(7,M=P1.signatures[x1].job_d9),i(10,W=P1.signatures[x1].use_d1),i(11,K=P1.signatures[x1].use_d9)}function De(){switch(be.kind){case"None":return;case"SingleActive":i(1,m=be.sigId),i(2,A=!0),i(3,O=be.sigId);break;case"SinglePassive":i(1,m=null),i(2,A=!1),i(3,O=be.sigId);break;case"MultipleDifferent":i(1,m=null),i(2,A=!1),i(3,O=null);break;case"MultipleSameActive":i(1,m=be.sigId),i(2,A=!0),i(3,O=null);break;case"MultipleSamePassive":i(1,m=null),i(2,A=!1),i(3,O=be.sigId);break}Oe()}function Oe(){function p1(x1){i(6,T=z9(P1.signatures[x1].job_d1)),i(7,M=z9(P1.signatures[x1].job_d9)),i(10,W=z9(P1.signatures[x1].use_d1)),i(11,K=z9(P1.signatures[x1].use_d9))}switch(console.log(be),be.kind){case"None":i(14,se=!1);break;case"SingleActive":i(14,se=!0),qe(be.oaName,be.sigId),p1(be.sigId);break;case"SinglePassive":i(14,se=!0),qe(be.oaName,be.sigId),p1(be.sigId);break;case"MultipleSameActive":i(14,se=!0),Ee(be.oaNames,be.sigId),p1(be.sigId);break;case"MultipleSamePassive":i(14,se=!0),Ee(be.oaNames,be.sigId),p1(be.sigId);break;case"MultipleDifferent":i(14,se=!1),i(4,P=null),i(8,L=null),i(12,J=null),i(5,F=!1),i(9,N=!1),i(13,ae=!1),V();break}}const Se=()=>u("returnToSelection",{}),ze=()=>u("proceedToMetadata",{});function we(){c=js(this),Y8.set(c)}function ke(){A=this.checked,i(2,A)}const b1=()=>{A&&be.kind!=="MultipleDifferent"?i(1,m=O):(A&&be.kind,i(1,m=null)),V(),i(15,be=ge(t)),Oe()};function y1(){m=js(this),i(1,m)}const a1=()=>{V(),i(15,be=ge(t)),Oe()};function D1(p1){F=p1,i(5,F)}function U1(p1){P=p1,i(4,P)}function m1(p1){N=p1,i(9,N)}function T1(p1){L=p1,i(8,L)}function X1(p1){ae=p1,i(13,ae)}function Y1(p1){J=p1,i(12,J)}return s.$$set=p1=>{"changes"in p1&&i(22,g=p1.changes),"userChangesPresent"in p1&&i(21,d=p1.userChangesPresent)},s.$$.update=()=>{s.$$.dirty[0]&8388609&&(i(15,be=ge(t)),x&&De())},[t,m,A,O,P,F,T,M,L,N,W,K,J,ae,se,be,c,u,ge,V,Oe,d,g,x,Se,ze,we,ke,b1,y1,a1,D1,U1,m1,T1,X1,Y1]}class Eq extends W0{constructor(e){super(),$0(this,e,hq,gq,M0,{changes:22,userChangesPresent:21},null,[-1,-1])}}function jq(s){let e;return{c(){e=Pe("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(i,t){i1(i,e,t)},d(i){i&&Je(e)}}}function qq(s){let e,i,t;return{c(){e=L1("This uses the "),i=Pe("a"),i.textContent="Pyodide library",t=L1(" to run the calculation entirely in your browser."),ee(i,"href","https://pyodide.org/en/stable/"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function dq(s){let e,i,t;return{c(){e=L1("To use this option, the API must be running on port 5178. See the "),i=Pe("a"),i.textContent="developer notes",t=L1(" for details on how to set this up."),ee(i,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function fq(s){let e,i,t;return{c(){e=L1("This is an "),i=Pe("a"),i.textContent="Azure Functions",t=L1(" instance, i.e. a web service hosted on the cloud."),ee(i,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function mq(s){let e,i,t,_,o,n,c,u,g,d,x,m,A,O,P,F,T,M,L,N,W;e=new vp({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",s[7]),e.$on("forwardClick",s[8]),t=new vs({});let K=!s[6]&&jq();function J(ge,be){if(ge[2]==="azure")return fq;if(ge[2]==="local")return dq;if(ge[2]==="wasm")return qq}let ae=J(s),se=ae&&ae(s);return O=new vs({}),{c(){g0(e.$$.fragment),i=l1(),g0(t.$$.fragment),_=l1(),o=Pe("div"),n=Pe("i"),n.textContent="Calculation method",c=l1(),u=Pe("select"),g=Pe("option"),g.textContent="Azure REST API",K&&K.c(),d=Pe("option"),d.textContent="In-browser",x=l1(),m=Pe("div"),se&&se.c(),A=l1(),g0(O.$$.fragment),P=l1(),F=Pe("input"),T=l1(),M=Pe("textarea"),g.__value="azure",g.value=g.__value,d.__value="wasm",d.value=d.__value,s[2]===void 0&&$4(()=>s[9].call(u)),ee(o,"id","calculation-method-choice"),ee(o,"class","svelte-ygj49d"),ee(m,"class","smaller svelte-ygj49d"),ee(F,"type","text"),ee(F,"placeholder","Scenario title..."),ee(F,"class","svelte-ygj49d"),ee(M,"placeholder","A longer textual description..."),ee(M,"spellcheck","false"),ee(M,"class","svelte-ygj49d")},m(ge,be){n0(e,ge,be),i1(ge,i,be),n0(t,ge,be),i1(ge,_,be),i1(ge,o,be),ne(o,n),ne(o,c),ne(o,u),ne(u,g),K&&K.m(u,null),ne(u,d),e5(u,s[2],!0),i1(ge,x,be),i1(ge,m,be),se&&se.m(m,null),i1(ge,A,be),n0(O,ge,be),i1(ge,P,be),i1(ge,F,be),s[10](F),Si(F,s[0]),i1(ge,T,be),i1(ge,M,be),s[13](M),Si(M,s[1]),L=!0,N||(W=[G1(u,"change",s[9]),G1(F,"input",s[11]),G1(F,"input",s[12]),G1(M,"input",s[14]),G1(M,"input",s[15])],N=!0)},p(ge,be){be&4&&e5(u,ge[2]),ae!==(ae=J(ge))&&(se&&se.d(1),se=ae&&ae(ge),se&&(se.c(),se.m(m,null))),be&1&&F.value!==ge[0]&&Si(F,ge[0]),be&2&&Si(M,ge[1])},i(ge){L||(h1(e.$$.fragment,ge),h1(t.$$.fragment,ge),h1(O.$$.fragment,ge),L=!0)},o(ge){d1(e.$$.fragment,ge),d1(t.$$.fragment,ge),d1(O.$$.fragment,ge),L=!1},d(ge){p0(e,ge),ge&&Je(i),p0(t,ge),ge&&Je(_),ge&&Je(o),K&&K.d(),ge&&Je(x),ge&&Je(m),se&&se.d(),ge&&Je(A),p0(O,ge),ge&&Je(P),ge&&Je(F),s[10](null),ge&&Je(T),ge&&Je(M),s[13](null),N=!1,n4(W)}}}function xq(s){let e,i;return e=new _r({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[mq]},$$scope:{ctx:s}}}),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,[_]){const o={};_&65567&&(o.$$scope={dirty:_,ctx:t}),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function Qy(s){s.style.borderColor="#f26d88"}function vq(s,e,i){let{scenarioShort:t=""}=e,{scenarioDescription:_=""}=e,{calculationMethod:o="azure"}=e;const n=vi();let c,u;const g=window.location.href.toLowerCase().includes(P1.baseUrl.toLowerCase()),d=()=>n("returnToModify"),x=()=>{if(t===""){alert("Please enter a scenario title."),Qy(c);return}if(_===""){alert("Please enter a scenario description."),Qy(u);return}n("acceptChangesAndCalculate")};function m(){o=js(this),i(2,o)}function A(L){H0[L?"unshift":"push"](()=>{c=L,i(3,c)})}function O(){t=this.value,i(0,t)}const P=()=>{i(3,c.style.borderColor=t===""?"#f26d88":"#999",c)};function F(L){H0[L?"unshift":"push"](()=>{u=L,i(4,u)})}function T(){_=this.value,i(1,_)}const M=()=>{i(4,u.style.borderColor=_===""?"#f26d88":"#999",u)};return s.$$set=L=>{"scenarioShort"in L&&i(0,t=L.scenarioShort),"scenarioDescription"in L&&i(1,_=L.scenarioDescription),"calculationMethod"in L&&i(2,o=L.calculationMethod)},[t,_,o,c,u,n,g,d,x,m,A,O,P,F,T,M]}class Cq extends W0{constructor(e){super(),$0(this,e,vq,xq,M0,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Aq="modulepreload",Pq=function(s){return"/demoland-web/dev/tyne_and_wear/"+s},eo={},Dq=function(e,i,t){if(!i||i.length===0)return e();const _=document.getElementsByTagName("link");return Promise.all(i.map(o=>{if(o=Pq(o),o in eo)return;eo[o]=!0;const n=o.endsWith(".css"),c=n?'[rel="stylesheet"]':"";if(!!t)for(let d=_.length-1;d>=0;d--){const x=_[d];if(x.href===o&&(!n||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${c}`))return;const g=document.createElement("link");if(g.rel=n?"stylesheet":Aq,n||(g.as="script",g.crossOrigin=""),g.href=o,document.head.appendChild(g),n)return new Promise((d,x)=>{g.addEventListener("load",d),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=o,window.dispatchEvent(n),!n.defaultPrevented)throw o})};let Z6;const I8={};let b8=0;async function wq(){if(Z6)return Z6;const s=await Dq(()=>import("./pyodide_worker-27394862.js"),[]);return Z6=new s.default,Z6.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:i,...t}=e.data,_=I8[i];console.log(I8),delete I8[i],_(t)}},Z6}async function Oq(s,e){const i=await wq();return b8=(b8+1)%Number.MAX_SAFE_INTEGER,new Promise(t=>{I8[b8]=t,i.postMessage({...e,python:s,id:b8,pathname:window.location.pathname})})}async function Fq(s){const i=await Oq(` import pyodide_http - pyodide_http.patch_all() + pyodide_http.patch_all() print(globals()) from js import scenario_json import demoland_engine import json import time - + start = time.time() scenario = json.loads(scenario_json) - - df = demoland_engine.get_empty() + + df = demoland_engine.get_empty() for oa_code, vals in scenario["scenario_json"].items(): df.loc[oa_code] = list(vals.values()) pred = demoland_engine.get_indicators(df, random_seed=42) - sig = demoland_engine.sampling.oa_key.primary_type.copy() + sig = demoland_engine.data.FILEVAULT["oa_key"].primary_type.copy() mapping = { "Wild countryside": 0, diff --git a/dev/tyne_and_wear/index.html b/dev/tyne_and_wear/index.html index e7d2229..09827b1 100644 --- a/dev/tyne_and_wear/index.html +++ b/dev/tyne_and_wear/index.html @@ -7,7 +7,7 @@ - + diff --git a/dev/tyne_and_wear_hex/assets/index-282d7460.js b/dev/tyne_and_wear_hex/assets/index-6598e1e6.js similarity index 99% rename from dev/tyne_and_wear_hex/assets/index-282d7460.js rename to dev/tyne_and_wear_hex/assets/index-6598e1e6.js index 53f83d1..2974eb8 100644 --- a/dev/tyne_and_wear_hex/assets/index-282d7460.js +++ b/dev/tyne_and_wear_hex/assets/index-6598e1e6.js @@ -32,23 +32,23 @@ modelled development strategies on any of the four indicators. select all OAs within the region.`,e5(e,"class","smaller svelte-1392tz3")},m(t,r){t1(t,e,r)},d(t){t&&J5(e)}}}function Dh(i){let e;return{c(){e=S5("div"),e.textContent=`Click on the map to select an output area. You can shift-click to select multiple, or click anywhere outside the map to deselect all.`,e5(e,"class","smaller svelte-1392tz3")},m(t,r){t1(t,e,r)},d(t){t&&J5(e)}}}function Lh(i){let e,t=i[0].length+"",r,n,f=i[0].length===1?"":"s",y,o,u,d,P,F,v,w,C,S,T,A;P=new ql({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function z(K,J){return K[2]?Bh:Oh}let R=z(i),N=R(i),W=i[14]&&Qc(i);return{c(){e=S5("span"),r=R1(t),n=R1(" output area"),y=R1(f),o=R1(" selected."),u=p1(),d=S5("div"),d4(P.$$.fragment),F=p1(),v=S5("input"),w=p1(),N.c(),C=p1(),W&&W.c(),e5(v,"type","checkbox"),e5(v,"id","sig-modified"),e5(d,"id","changes-grid"),e5(d,"class","svelte-1392tz3")},m(K,J){t1(K,e,J),y5(e,r),y5(e,n),y5(e,y),y5(e,o),t1(K,u,J),t1(K,d,J),y4(P,d,null),y5(d,F),y5(d,v),v.checked=i[2],y5(d,w),N.m(d,null),y5(d,C),W&&W.m(d,null),S=!0,T||(A=[G1(v,"change",i[27]),G1(v,"change",i[28])],T=!0)},p(K,J){(!S||J[0]&1)&&t!==(t=K[0].length+"")&&_9(r,t),(!S||J[0]&1)&&f!==(f=K[0].length===1?"":"s")&&_9(y,f),J[0]&4&&(v.checked=K[2]),R===(R=z(K))&&N?N.p(K,J):(N.d(1),N=R(K),N&&(N.c(),N.m(d,C))),K[14]?W?(W.p(K,J),J[0]&16384&&g1(W,1)):(W=Qc(K),W.c(),g1(W,1),W.m(d,null)):W&&(P9(),P1(W,1,1,()=>{W=null}),x9())},i(K){S||(g1(P.$$.fragment,K),g1(W),S=!0)},o(K){P1(P.$$.fragment,K),P1(W),S=!1},d(K){K&&J5(e),K&&J5(u),K&&J5(d),l4(P),N.d(),W&&W.d(),T=!1,y9(A)}}}function Rh(i){let e;return{c(){e=S5("span"),e.textContent="No output areas selected."},m(t,r){t1(t,e,r)},p:t4,i:t4,o:t4,d(t){t&&J5(e)}}}function Oh(i){let e,t=[...S1.signatures.entries()],r=[];for(let n=0;ni[29].call(e))},m(y,o){t1(y,e,o);for(let u=0;uO9(e,"modified",w)),H4.push(()=>O9(e,"value",C)),e.$on("change",i[19]);function T(K){i[33](K)}function A(K){i[34](K)}let z={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:i[10],max:i[11],defaultVal:i[10],step:.01};i[9]!==void 0&&(z.modified=i[9]),i[8]!==void 0&&(z.value=i[8]),f=new Ns({props:z}),H4.push(()=>O9(f,"modified",T)),H4.push(()=>O9(f,"value",A)),f.$on("change",i[19]);function R(K){i[35](K)}function N(K){i[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return i[13]!==void 0&&(W.modified=i[13]),i[12]!==void 0&&(W.value=i[12]),d=new Ns({props:W}),H4.push(()=>O9(d,"modified",R)),H4.push(()=>O9(d,"value",N)),d.$on("change",i[19]),{c(){d4(e.$$.fragment),n=p1(),d4(f.$$.fragment),u=p1(),d4(d.$$.fragment)},m(K,J){y4(e,K,J),t1(K,n,J),y4(f,K,J),t1(K,u,J),y4(d,K,J),v=!0},p(K,J){const s5={};J[0]&64&&(s5.min=K[6]),J[0]&128&&(s5.max=K[7]),J[0]&64&&(s5.defaultVal=K[6]),!t&&J[0]&32&&(t=!0,s5.modified=K[5],R9(()=>t=!1)),!r&&J[0]&16&&(r=!0,s5.value=K[4],R9(()=>r=!1)),e.$set(s5);const i5={};J[0]&1024&&(i5.min=K[10]),J[0]&2048&&(i5.max=K[11]),J[0]&1024&&(i5.defaultVal=K[10]),!y&&J[0]&512&&(y=!0,i5.modified=K[9],R9(()=>y=!1)),!o&&J[0]&256&&(o=!0,i5.value=K[8],R9(()=>o=!1)),f.$set(i5);const d5={};!P&&J[0]&8192&&(P=!0,d5.modified=K[13],R9(()=>P=!1)),!F&&J[0]&4096&&(F=!0,d5.value=K[12],R9(()=>F=!1)),d.$set(d5)},i(K){v||(g1(e.$$.fragment,K),g1(f.$$.fragment,K),g1(d.$$.fragment,K),v=!0)},o(K){P1(e.$$.fragment,K),P1(f.$$.fragment,K),P1(d.$$.fragment,K),v=!1},d(K){l4(e,K),K&&J5(n),l4(f,K),K&&J5(u),l4(d,K)}}}function Nh(i){let e,t,r,n,f,y,o,u,d,P,F,v,w,C,S,T,A,z,R,N;e=new jl({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",i[24]),e.$on("forwardClick",i[25]),r=new j2({});function W(_5,o5){if(_5[16]==="click")return Dh;if(_5[16]==="draw")return zh}let K=W(i),J=K&&K(i);w=new j2({});const s5=[Rh,Lh],i5=[];function d5(_5,o5){return _5[0].length===0?0:1}return S=d5(i),T=i5[S]=s5[S](i),{c(){d4(e.$$.fragment),t=p1(),d4(r.$$.fragment),n=p1(),f=S5("div"),y=S5("i"),y.textContent="Selection method",o=p1(),u=S5("select"),d=S5("option"),d.textContent="Click on map",P=S5("option"),P.textContent="Freehand draw",F=p1(),J&&J.c(),v=p1(),d4(w.$$.fragment),C=p1(),T.c(),A=$e(),d.__value="click",d.value=d.__value,P.__value="draw",P.value=P.__value,e5(u,"id","oa-selection-method"),i[16]===void 0&&$9(()=>i[26].call(u)),e5(f,"id","selection-method-choice"),e5(f,"class","svelte-1392tz3")},m(_5,o5){y4(e,_5,o5),t1(_5,t,o5),y4(r,_5,o5),t1(_5,n,o5),t1(_5,f,o5),y5(f,y),y5(f,o),y5(f,u),y5(u,d),y5(u,P),e3(u,i[16],!0),t1(_5,F,o5),J&&J.m(_5,o5),t1(_5,v,o5),y4(w,_5,o5),t1(_5,C,o5),i5[S].m(_5,o5),t1(_5,A,o5),z=!0,R||(N=G1(u,"change",i[26]),R=!0)},p(_5,o5){o5[0]&65536&&e3(u,_5[16]),K!==(K=W(_5))&&(J&&J.d(1),J=K&&K(_5),J&&(J.c(),J.m(v.parentNode,v)));let v5=S;S=d5(_5),S===v5?i5[S].p(_5,o5):(P9(),P1(i5[v5],1,1,()=>{i5[v5]=null}),x9(),T=i5[S],T?T.p(_5,o5):(T=i5[S]=s5[S](_5),T.c()),g1(T,1),T.m(A.parentNode,A))},i(_5){z||(g1(e.$$.fragment,_5),g1(r.$$.fragment,_5),g1(w.$$.fragment,_5),g1(T),z=!0)},o(_5){P1(e.$$.fragment,_5),P1(r.$$.fragment,_5),P1(w.$$.fragment,_5),P1(T),z=!1},d(_5){l4(e,_5),_5&&J5(t),l4(r,_5),_5&&J5(n),_5&&J5(f),_5&&J5(F),J&&J.d(_5),_5&&J5(v),l4(w,_5),_5&&J5(C),i5[S].d(_5),_5&&J5(A),R=!1,N()}}}function Vh(i){let e,t;return e=new ca({props:{title:"Step 2: Modify output areas",$$slots:{default:[Nh]},$$scope:{ctx:i}}}),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,n){const f={};n[0]&131071|n[1]&1048576&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function L7(i){return Math.round(i*100)/100}function Uh(i,e,t){let r,n,f,y,o;m4(i,ne,l1=>t(0,r=l1)),m4(i,O3,l1=>t(37,n=l1)),m4(i,c2,l1=>t(38,f=l1)),m4(i,pe,l1=>t(39,y=l1)),m4(i,Yi,l1=>t(16,o=l1));const u=je();let{changes:d=n.get(y).changes}=e,{userChangesPresent:P}=e,F=!1;R2(()=>{w4(c2,f=!0,f),t(23,F=!0)}),O2(()=>{w4(c2,f=!1,f)});let v=null,w,C,S=null,T,A,z,R=null,N,W,K,J=null,s5,i5=!1;function d5(l1){if(l1.length===0)return{kind:"None"};if(l1.length===1){const F1=l1[0].name,U=v5(F1).get("signature_type");return U===null?{kind:"SinglePassive",oaName:F1,sigId:o5(F1)}:{kind:"SingleActive",oaName:F1,sigId:U}}else{const F1=l1.map(c5=>c5.name),$5=l1.map(c5=>v5(c5.name)).map(c5=>c5.get("signature_type")),N5=F1.map(c5=>o5(c5));if($5.every(c5=>c5===null))return N5.every(c5=>c5===N5[0])?{kind:"MultipleSamePassive",oaNames:F1,sigId:N5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:N5};if($5.some(c5=>c5!==null)&&$5.some(c5=>c5===null)){const c5=$5.map((p5,j5)=>p5||N5[j5]);return c5.every(p5=>p5===c5[0])?{kind:"MultipleSamePassive",oaNames:F1,sigId:c5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:c5}}else return $5.every(c5=>c5===$5[0])?{kind:"MultipleSameActive",oaNames:F1,sigId:$5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:$5}}}let _5=d5(r);function o5(l1){return n.get(S1.referenceScenarioObject.metadata.name).values.get(l1).get("signature_type")}function v5(l1){const F1=d.has(l1),U=d.get(l1);return new Map([["signature_type",F1?U.get("signature_type"):null],["job_types",F1?U.get("job_types"):null],["use",F1?U.get("use"):null],["greenspace",F1?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",v),!w&&!T&&!N&&!s5)r.forEach(l1=>{d.delete(l1.name)});else{const l1=new Map([["signature_type",w?v:null],["job_types",T?S:null],["use",N?R:null],["greenspace",s5?J:null]]);r.forEach(F1=>{d.set(F1.name,l1)})}u("changesUpdated"),t(21,P=!0)}function m5(l1,F1){t(4,S=v5(l1).get("job_types")),t(8,R=v5(l1).get("use")),t(12,J=v5(l1).get("greenspace")),t(5,T=S!==null),t(9,N=R!==null),t(13,s5=J!==null),t(6,A=L7(S1.signatures[F1].job_d1)),t(7,z=L7(S1.signatures[F1].job_d9)),t(10,W=L7(S1.signatures[F1].use_d1)),t(11,K=L7(S1.signatures[F1].use_d9))}function b5(l1,F1){const U=l1.map(N5=>v5(N5));function $5(N5){const c5=U.map(p5=>p5.get(N5));return c5.every(p5=>p5===c5[0]&&p5!==null)?c5[0]:null}t(4,S=$5("job_types")),t(5,T=S!==null),t(8,R=$5("use")),t(9,N=R!==null),t(12,J=$5("greenspace")),t(13,s5=J!==null),t(6,A=S1.signatures[F1].job_d1),t(7,z=S1.signatures[F1].job_d9),t(10,W=S1.signatures[F1].use_d1),t(11,K=S1.signatures[F1].use_d9)}function k5(){switch(_5.kind){case"None":return;case"SingleActive":t(1,v=_5.sigId),t(2,w=!0),t(3,C=_5.sigId);break;case"SinglePassive":t(1,v=null),t(2,w=!1),t(3,C=_5.sigId);break;case"MultipleDifferent":t(1,v=null),t(2,w=!1),t(3,C=null);break;case"MultipleSameActive":t(1,v=_5.sigId),t(2,w=!0),t(3,C=null);break;case"MultipleSamePassive":t(1,v=null),t(2,w=!1),t(3,C=_5.sigId);break}C5()}function C5(){function l1(F1){t(6,A=L7(S1.signatures[F1].job_d1)),t(7,z=L7(S1.signatures[F1].job_d9)),t(10,W=L7(S1.signatures[F1].use_d1)),t(11,K=L7(S1.signatures[F1].use_d9))}switch(console.log(_5),_5.kind){case"None":t(14,i5=!1);break;case"SingleActive":t(14,i5=!0),m5(_5.oaName,_5.sigId),l1(_5.sigId);break;case"SinglePassive":t(14,i5=!0),m5(_5.oaName,_5.sigId),l1(_5.sigId);break;case"MultipleSameActive":t(14,i5=!0),b5(_5.oaNames,_5.sigId),l1(_5.sigId);break;case"MultipleSamePassive":t(14,i5=!0),b5(_5.oaNames,_5.sigId),l1(_5.sigId);break;case"MultipleDifferent":t(14,i5=!1),t(4,S=null),t(8,R=null),t(12,J=null),t(5,T=!1),t(9,N=!1),t(13,s5=!1),V();break}}const I5=()=>u("returnToSelection",{}),L5=()=>u("proceedToMetadata",{});function E5(){o=h2(this),Yi.set(o)}function M5(){w=this.checked,t(2,w)}const _1=()=>{w&&_5.kind!=="MultipleDifferent"?t(1,v=C):(w&&_5.kind,t(1,v=null)),V(),t(15,_5=d5(r)),C5()};function c1(){v=h2(this),t(1,v)}const s1=()=>{V(),t(15,_5=d5(r)),C5()};function k1(l1){T=l1,t(5,T)}function U1(l1){S=l1,t(4,S)}function v1(l1){N=l1,t(9,N)}function A1(l1){R=l1,t(8,R)}function X1(l1){s5=l1,t(13,s5)}function Y1(l1){J=l1,t(12,J)}return i.$$set=l1=>{"changes"in l1&&t(22,d=l1.changes),"userChangesPresent"in l1&&t(21,P=l1.userChangesPresent)},i.$$.update=()=>{i.$$.dirty[0]&8388609&&(t(15,_5=d5(r)),F&&k5())},[r,v,w,C,S,T,A,z,R,N,W,K,J,s5,i5,_5,o,u,d5,V,C5,P,d,F,I5,L5,E5,M5,_1,c1,s1,k1,U1,v1,A1,X1,Y1]}class $h extends W4{constructor(e){super(),$4(this,e,Uh,Vh,z4,{changes:22,userChangesPresent:21},null,[-1,-1])}}function Wh(i){let e;return{c(){e=S5("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(t,r){t1(t,e,r)},d(t){t&&J5(e)}}}function Gh(i){let e,t,r;return{c(){e=R1("This uses the "),t=S5("a"),t.textContent="Pyodide library",r=R1(" to run the calculation entirely in your browser."),e5(t,"href","https://pyodide.org/en/stable/"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Zh(i){let e,t,r;return{c(){e=R1("To use this option, the API must be running on port 5178. See the "),t=S5("a"),t.textContent="developer notes",r=R1(" for details on how to set this up."),e5(t,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Hh(i){let e,t,r;return{c(){e=R1("This is an "),t=S5("a"),t.textContent="Azure Functions",r=R1(" instance, i.e. a web service hosted on the cloud."),e5(t,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Xh(i){let e,t,r,n,f,y,o,u,d,P,F,v,w,C,S,T,A,z,R,N,W;e=new jl({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",i[7]),e.$on("forwardClick",i[8]),r=new j2({});let K=!i[6]&&Wh();function J(d5,_5){if(d5[2]==="azure")return Hh;if(d5[2]==="local")return Zh;if(d5[2]==="wasm")return Gh}let s5=J(i),i5=s5&&s5(i);return C=new j2({}),{c(){d4(e.$$.fragment),t=p1(),d4(r.$$.fragment),n=p1(),f=S5("div"),y=S5("i"),y.textContent="Calculation method",o=p1(),u=S5("select"),d=S5("option"),d.textContent="Azure REST API",K&&K.c(),P=S5("option"),P.textContent="In-browser",F=p1(),v=S5("div"),i5&&i5.c(),w=p1(),d4(C.$$.fragment),S=p1(),T=S5("input"),A=p1(),z=S5("textarea"),d.__value="azure",d.value=d.__value,P.__value="wasm",P.value=P.__value,i[2]===void 0&&$9(()=>i[9].call(u)),e5(f,"id","calculation-method-choice"),e5(f,"class","svelte-ygj49d"),e5(v,"class","smaller svelte-ygj49d"),e5(T,"type","text"),e5(T,"placeholder","Scenario title..."),e5(T,"class","svelte-ygj49d"),e5(z,"placeholder","A longer textual description..."),e5(z,"spellcheck","false"),e5(z,"class","svelte-ygj49d")},m(d5,_5){y4(e,d5,_5),t1(d5,t,_5),y4(r,d5,_5),t1(d5,n,_5),t1(d5,f,_5),y5(f,y),y5(f,o),y5(f,u),y5(u,d),K&&K.m(u,null),y5(u,P),e3(u,i[2],!0),t1(d5,F,_5),t1(d5,v,_5),i5&&i5.m(v,null),t1(d5,w,_5),y4(C,d5,_5),t1(d5,S,_5),t1(d5,T,_5),i[10](T),Ie(T,i[0]),t1(d5,A,_5),t1(d5,z,_5),i[13](z),Ie(z,i[1]),R=!0,N||(W=[G1(u,"change",i[9]),G1(T,"input",i[11]),G1(T,"input",i[12]),G1(z,"input",i[14]),G1(z,"input",i[15])],N=!0)},p(d5,_5){_5&4&&e3(u,d5[2]),s5!==(s5=J(d5))&&(i5&&i5.d(1),i5=s5&&s5(d5),i5&&(i5.c(),i5.m(v,null))),_5&1&&T.value!==d5[0]&&Ie(T,d5[0]),_5&2&&Ie(z,d5[1])},i(d5){R||(g1(e.$$.fragment,d5),g1(r.$$.fragment,d5),g1(C.$$.fragment,d5),R=!0)},o(d5){P1(e.$$.fragment,d5),P1(r.$$.fragment,d5),P1(C.$$.fragment,d5),R=!1},d(d5){l4(e,d5),d5&&J5(t),l4(r,d5),d5&&J5(n),d5&&J5(f),K&&K.d(),d5&&J5(F),d5&&J5(v),i5&&i5.d(),d5&&J5(w),l4(C,d5),d5&&J5(S),d5&&J5(T),i[10](null),d5&&J5(A),d5&&J5(z),i[13](null),N=!1,y9(W)}}}function Yh(i){let e,t;return e=new ca({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[Xh]},$$scope:{ctx:i}}}),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,[n]){const f={};n&65567&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function ef(i){i.style.borderColor="#f26d88"}function Kh(i,e,t){let{scenarioShort:r=""}=e,{scenarioDescription:n=""}=e,{calculationMethod:f="azure"}=e;const y=je();let o,u;const d=window.location.href.toLowerCase().includes(S1.baseUrl.toLowerCase()),P=()=>y("returnToModify"),F=()=>{if(r===""){alert("Please enter a scenario title."),ef(o);return}if(n===""){alert("Please enter a scenario description."),ef(u);return}y("acceptChangesAndCalculate")};function v(){f=h2(this),t(2,f)}function w(R){H4[R?"unshift":"push"](()=>{o=R,t(3,o)})}function C(){r=this.value,t(0,r)}const S=()=>{t(3,o.style.borderColor=r===""?"#f26d88":"#999",o)};function T(R){H4[R?"unshift":"push"](()=>{u=R,t(4,u)})}function A(){n=this.value,t(1,n)}const z=()=>{t(4,u.style.borderColor=n===""?"#f26d88":"#999",u)};return i.$$set=R=>{"scenarioShort"in R&&t(0,r=R.scenarioShort),"scenarioDescription"in R&&t(1,n=R.scenarioDescription),"calculationMethod"in R&&t(2,f=R.calculationMethod)},[r,n,f,o,u,y,d,P,F,v,w,C,S,T,A,z]}class Jh extends W4{constructor(e){super(),$4(this,e,Kh,Yh,z4,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Qh="modulepreload",em=function(i){return"/demoland-web/dev/tyne_and_wear_hex/"+i},tf={},tm=function(e,t,r){if(!t||t.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(t.map(f=>{if(f=em(f),f in tf)return;tf[f]=!0;const y=f.endsWith(".css"),o=y?'[rel="stylesheet"]':"";if(!!r)for(let P=n.length-1;P>=0;P--){const F=n[P];if(F.href===f&&(!y||F.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${o}`))return;const d=document.createElement("link");if(d.rel=y?"stylesheet":Qh,y||(d.as="script",d.crossOrigin=""),d.href=f,document.head.appendChild(d),y)return new Promise((P,F)=>{d.addEventListener("load",P),d.addEventListener("error",()=>F(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=f,window.dispatchEvent(y),!y.defaultPrevented)throw f})};let Z0;const Di={};let _i=0;async function im(){if(Z0)return Z0;const i=await tm(()=>import("./pyodide_worker-419e5002.js"),[]);return Z0=new i.default,Z0.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:t,...r}=e.data,n=Di[t];console.log(Di),delete Di[t],n(r)}},Z0}async function rm(i,e){const t=await im();return _i=(_i+1)%Number.MAX_SAFE_INTEGER,new Promise(r=>{Di[_i]=r,t.postMessage({...e,python:i,id:_i,pathname:window.location.pathname})})}async function sm(i){const t=await rm(` import pyodide_http - pyodide_http.patch_all() + pyodide_http.patch_all() print(globals()) from js import scenario_json import demoland_engine import json import time - + start = time.time() scenario = json.loads(scenario_json) - - df = demoland_engine.get_empty() + + df = demoland_engine.get_empty() for oa_code, vals in scenario["scenario_json"].items(): df.loc[oa_code] = list(vals.values()) pred = demoland_engine.get_indicators(df, random_seed=42) - sig = demoland_engine.sampling.oa_key.primary_type.copy() + sig = demoland_engine.data.FILEVAULT["oa_key"].primary_type.copy() mapping = { "Wild countryside": 0, diff --git a/dev/tyne_and_wear_hex/index.html b/dev/tyne_and_wear_hex/index.html index 277c396..122ac22 100644 --- a/dev/tyne_and_wear_hex/index.html +++ b/dev/tyne_and_wear_hex/index.html @@ -7,7 +7,7 @@ - +