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
begin; | |
rollback; | |
insert into sites (sitename, geometry) VALUES ('MAC Field Scanner Season 4 Irrigation Zone 1', | |
(select st_union(geometry) as geometry | |
from sites | |
where sitename ~ 'Column (1|2|3|4)$' | |
and sitename like 'MAC Field Scanner Season 4%')); | |
/*Zone 2*/ | |
insert into sites (sitename, geometry) VALUES |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
\copy (select raw_date, sitename, cultivar, trait, method, mean | |
from traits_and_yields_view_private | |
sitename like '%Season 4%' and sitename ~ 'Range (20|30)$') | |
to ~/season4traits.csv delimiter ',' csv header; | |
\copy (select raw_date, sitename, cultivar, trait, method, mean | |
from traits_and_yields_view_private | |
sitename like '%Season 6%' and sitename ~ 'Range (20|30)$') | |
to ~/season6traits.csv delimiter ',' csv header; |
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
pft | variable | phylogeny | distn | parama | paramb | n | citation | |
---|---|---|---|---|---|---|---|---|
forb_priors | mort2 | plants | gamma | 1.47 | 0.0578 | 0 | LeBauer 2010 Expert Prior | |
forb_priors | growth_resp_factor | grass | beta | 2.63 | 6.52 | 0 | LeBauer 2010 Expert Prior | |
forb_priors | fineroot2leaf | grass | lnorm | 0.811 | 0.843 | 0 | Chapin 2002 Principles of Terrestrial Ecosystem Ecology | |
forb_priors | root_turnover_rate | grass | weibull | 1.67 | 0.657 | 66 | Gill 2000 Global patterns of root turnover for terrestrial ecosystems | |
forb_priors | seedling_mortality | monocots | beta | 3.61 | 0.433 | 0 | LeBauer 2010 Expert Prior | |
forb_priors | Vcmax | lnorm | 4.51 | 0.64 | 19 | Wullschleger 1993 Biochemical Limitations to Carbon Assimilation in C3 Plants: A Retrospective Analysis of the A/Ci Curves from 109 Species | ||
forb_priors | root_respiration_rate | angiosperm | gamma | 4.95 | 0.762 | 36 | George 2003 Fine-root respiration in a loblolly pine and sweetgum forest growing in elevated CO2 | |
forb_priors | r_fract | plants | beta | 2 | 4 | 0 | LeBauer 2010 Expert Prior | |
forb_priors | c2n_leaf | grass | gamma | 4.18 | 0.13 | 95 | Wright 2004 The world-wide leaf economics spectr |
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
sum_out <- broom.mixed::tidyMCMC(coda_out, conf.int = TRUE, conf.level = 0.95) %>% | |
rename(mean = estimate, sd = std.error, pc2.5 = conf.low, pc97.5 = conf.high) %>% | |
mutate(sig = if_else(pc2.5 * pc97.5 > 0, TRUE, FALSE)) # test if UCL and LCL both have the same sign | |
years <- data.frame(year_index = 1:length(unique(x$year)), year = unique(x$year)) | |
states <- data.frame(state_index = 1:length(unique(x$state)), state = unique(x$state)) | |
sum_rep <- broom.mixed::tidyMCMC(coda_rep, conf.int = TRUE, conf.level = 0.95) %>% | |
rename(mean = estimate, sd = std.error, pc2.5 = conf.low, pc97.5 = conf.high) %>% | |
separate(term, sep = '\\[|\\]|,', into = c('term', 'i', 'j', 'other'), convert = TRUE) %>% |
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
#CSV downloaded from https://quickstats.nass.usda.gov/results/12827E57-2B20-368C-A91F-1B97FF8F7B35#E2E0BF24-9F88-35DB-8526-8E47D941FDBF | |
library(dplyr) | |
library(tidyr) | |
nass_data <- readr::read_csv("raw_data/E2E0BF24-9F88-35DB-8526-8E47D941FDBF.csv",na = '(D)', | |
skip = 1, | |
col_names = c( | |
"program", "period", "week_ending", "geo_level", "state", "state_ansi", | |
"ag_district", "ag_district_code", "county", "county_ansi", "zip_code", | |
"region", "watershed_code", "watershed", "commodity", "data_item", |
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
library(ggplot2) | |
library(dplyr) | |
download.file(url = 'https://datadryad.org/stash/downloads/file_stream/624637', destfile = 'trait_data.zip', mode = 'wb') | |
unzip(zipfile = 'trait_data.zip', unzip = 'unzip') | |
s6heights <- readr::read_csv('traits/season_6_traits/season_6_canopy_height_sensor.csv') | |
s4heights <- readr::read_csv('traits/season_4_traits/season_4_canopy_height_sensor.csv') | |
heights <- bind_rows(s4heights, s6heights) |
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
library(data.table) | |
species <- fread('species.csv') | |
## identify and remove records that were present when we imported the table | |
usdaplants <- species[!is.na(NativeStatus) ] | |
## data table method of renaming columns | |
setnames(usdaplants, | |
old = c('id', 'genus', 'species', 'scientificname', 'commonname'), | |
new = c('betydb.species.id', 'Genus', 'Species', 'ScientificName', 'CommonName')) |
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
select | |
t.treatment_id :: text as treatmentDbId, | |
t.site_id :: text as observationUnitDbId, | |
t.variable_id :: text as observationVariableDbId, | |
v.name as observationVariableName, | |
t.id :: text as observationDbId, | |
t.mean :: text as value, | |
t.date as observationTimeStamp, | |
s.sitename as observationUnitName, | |
t.cultivar_id :: text as germplasmDbId, |