Skip to content

Commit

Permalink
updated units
Browse files Browse the repository at this point in the history
  • Loading branch information
moisbo committed Nov 27, 2023
1 parent 09069b1 commit bb93fe4
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 24 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "socrates-web",
"private": true,
"version": "1.0.5",
"version": "1.0.6",
"type": "module",
"homepage": "https://soil-and-land.github.io/socrates-web/",
"scripts": {
Expand Down
52 changes: 31 additions & 21 deletions src/components/ResultsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,48 @@ const data = computed(() => {
<el-table :data="data" border style="width: 100%">
<el-table-column prop="year" label="Year"/>
<el-table-column prop="crop" label="Crop"/>
<el-table-column prop="rain" label="Rain"/>
<el-table-column prop="yields" label="Yield"/>
<el-table-column prop="rain">
<template #header>Rain <br/>mm</template>
</el-table-column>
<el-table-column prop="yields" min-width="90px">
<template #header>Yield <br/>kg DM/ha</template>
</el-table-column>
<el-table-column prop="biomass" min-width="90px">
<template #header>Biomass</template>
<template #header>Biomass <br/>kg C/ha</template>
</el-table-column>
<el-table-column prop="nitrogen" min-width="90px">
<template #header>Fert <br/>kg N/ha</template>
</el-table-column>
<el-table-column prop="urine" min-width="90px">
<template #header>Urine <br/>kg N/ha</template>
</el-table-column>
<el-table-column prop="nitrogen" label="Fert"/>
<el-table-column prop="urine" label="Urine"/>
<el-table-column prop="oc" min-width="100px">
<template #header>OC<br/>(0-10 cm)</template>
<template #header>OC<br/>(0-10 cm)<br/>%</template>
</el-table-column>
<el-table-column prop="co2" min-width="130px">
<template #header>Soil C <br/>(0-30 cm)<br/>kg CO<sub>2</sub>-eq/Ha</template>
</el-table-column>
<el-table-column prop="co2" min-width="100px">
<template #header>Soil C <br/>(0-30 cm)</template>
<el-table-column prop="n2o_fert" min-width="130px">
<template #header>N<sub>2</sub>O<br/>(Fertiliser)<br/>kg CO<sub>2</sub>-eq/Ha</template>
</el-table-column>
<el-table-column prop="n2o_fert" min-width="100px">
<template #header>N<sub>2</sub>O<br/>(Fertiliser)</template>
<el-table-column prop="n2o_min" min-width="130px">
<template #header>N<sub>2</sub>O<br/>(Mineralised)<br/>kg CO<sub>2</sub>-eq/Ha</template>
</el-table-column>
<el-table-column prop="n2o_min" min-width="120px">
<template #header>N<sub>2</sub>O<br/>(Mineralised)</template>
<el-table-column prop="n2o_res" min-width="130px">
<template #header>N<sub>2</sub>O<br/>(Residues)<br/>kg CO<sub>2</sub>-eq/Ha</template>
</el-table-column>
<el-table-column prop="n2o_res" min-width="110px">
<template #header>N<sub>2</sub>O<br/>(Residues)</template>
<el-table-column prop="n2o_indirect" min-width="130px">
<template #header>N<sub>2</sub>O<br/>(Indirect)<br/>kg CO<sub>2</sub>-eq/Ha</template>
</el-table-column>
<el-table-column prop="n2o_indirect" min-width="100px">
<template #header>N<sub>2</sub>O<br/>(Indirect)</template>
<el-table-column prop="n2o_urine" min-width="130px">
<template #header>N<sub>2</sub>O<br/>(Urine)<br/>kg CO<sub>2</sub>-eq/Ha</template>
</el-table-column>
<el-table-column prop="n2o_urine" min-width="90px">
<template #header>N<sub>2</sub>O<br/>(Urine)</template>
<el-table-column prop="ch4_animal" min-width="130px">
<template #header>CH<sub>4</sub><br/>(Animal)<br/>kg CO<sub>2</sub>-eq/Ha</template>
</el-table-column>
<el-table-column prop="ch4_animal" min-width="90px">
<template #header>CH<sub>4</sub><br/>(Animal)</template>
<el-table-column prop="total" min-width="130px">
<template #header>TOTAL<br/>kg CO<sub>2</sub>-eq/Ha</template>
</el-table-column>
<el-table-column prop="total" label="TOTAL"/>
</el-table>
<div class="table-error"></div>
</el-row>
Expand Down
18 changes: 18 additions & 0 deletions src/export.service.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
import * as converter from 'json-2-csv';
export async function toCSV({results, initialOC}) {
const data = [];
data.push({
year: '',
crop: '',
rain: 'mm',
yields: 'kg DM/ha',
biomass: 'kg C/ha',
nitrogen: 'kg N/ha',
urine: 'kg N/ha',
oc: '%',
co2: 'kg CO2e/ha',
n2o_fert: 'kg CO2e/ha',
n2o_min: 'kg CO2e/ha',
n2o_res: 'kg CO2e/ha',
n2o_indirect: 'kg CO2e/ha',
n2o_urine: 'kg CO2e/ha',
ch4_animal: 'kg CO2e/ha',
total: 'kg CO2e/ha',
});
data.push({
year: results.years[0] - 1,
crop: '',
Expand Down

0 comments on commit bb93fe4

Please sign in to comment.