Created
March 28, 2019 21:10
-
-
Save peteWT/ab0241b62c660cfc82cb7dbfd826a662 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.mode csv | |
.header on | |
--CREATE INDEX tl_caseid_idx ON FVS_TreeList(caseid); | |
--CREATE INDEX tl_standid_idx ON FVS_TreeList(standid); | |
--CREATE INDEX tl_year_idx ON FVS_TreeList(year); | |
--CREATE INDEX tl_treeid_idx ON FVS_TreeList(treeid); | |
--CREATE INDEX tl_species_idx ON FVS_TreeList(species); | |
--CREATE INDEX el_treeid_idx ON elTrees(treeid); | |
--CREATE INDEX el_casaeid_idx ON elTrees(caseid); | |
--CREATE INDEX el_tpa_idx ON elTrees(tpa); | |
--CREATE INDEX el_dbh_idx ON elTrees(dbh); | |
CREATE INDEX hc_cut_co_idx ON harvestCarbon(cut_co2); | |
CREATE INDEX hc_cut_co_idx ON harvestCarbon(cut_co2); | |
CREATE INDEX el_year_idx ON elTrees(year); | |
CREATE INDEX el_kwfile_idx ON elTrees(keywordfile); | |
CREATE INDEX tl_mortpa_idx ON FVS_TreeList(mortpa); | |
.once harvestCarbon.csv | |
select standid, | |
substr(rx,8) "RX", | |
Year, | |
cut_co2, | |
CUT_BOLE_CO2, | |
SWAKEXP_CO2e, | |
SWLUM_CO2E, | |
SWPAPER_CO2E, | |
LF_SWAKEXP_CO2e, | |
LF_SWLUM_CO2E, | |
LF_SWPAPER_CO2E | |
from harvestCarbon | |
where cut_co2 > 0; | |
--order by cast(standid as int); | |
.once onsiteCarbon.csv | |
select StandID, | |
substr(rx,8) as "RX", | |
Year, | |
LIVE_AG_CO2 | |
from onsiteCarbon; | |
--order by cast(standid as integer); | |
.once TreeData.csv | |
select e.caseid, | |
e.standid, | |
e.year, | |
e.treeid, | |
e.species, | |
1 "Live/Dead", | |
s.tpa "TPA", | |
e.dbh, | |
e.ht | |
from elTrees e | |
join FVS_treelist s using(caseid, standid, year, treeid) | |
where e.year = 2017 and | |
e.keywordfile = 'NF_CAC_GROW' and | |
mortpa = 0; | |
--order by cast(standid as integer); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment