Skip to content

Instantly share code, notes, and snippets.

View dlebauer's full-sized avatar
😀

David LeBauer dlebauer

😀
View GitHub Profile
We can't make this file beautiful and searchable because it's too large.
lat,lon,yield,longitude_0,latitude_0,geojson
48.930439,-122.4427032,31.38,-122.4427032,48.930439,"{""type"":""Point"",""coordinates"":[-122.4427,48.93044]}"
33.79605865,-117.3647003,0.20,-117.3647003,33.79605865,"{""type"":""Point"",""coordinates"":[-117.3647,33.79606]}"
45.18630981,-119.2369003,2.35,-119.2369003,45.18630981,"{""type"":""Point"",""coordinates"":[-119.2369,45.18631]}"
48.11856842,-116.4271011,11.38,-116.4271011,48.11856842,"{""type"":""Point"",""coordinates"":[-116.4271,48.11857]}"
46.77112961,-114.8928986,1.55,-114.8928986,46.77112961,"{""type"":""Point"",""coordinates"":[-114.8929,46.77113]}"
47.70011902,-114.1678009,6.55,-114.1678009,47.70011902,"{""type"":""Point"",""coordinates"":[-114.1678,47.70012]}"
34.33436966,-110.25,0.02,-110.25,34.33436966,"{""type"":""Point"",""coordinates"":[-110.25,34.33437]}"
38.07836914,-108.2764969,0.04,-108.2764969,38.07836914,"{""type"":""Point"",""coordinates"":[-108.2765,38.07837]}"
39.52045059,-107.1908035,0.01,-107.1908035,39.52045059,"{""type"":""Point
int time(time) ;
time:long_name = "Time axis" ;
time:units = "seconds since YYYY-01-01 00:00:00" ;
time:calendar = "gregorian" ;
time:time_origin = "YYYY-01-01 00:00:00" ;
int timestp(time) ;
timestp:long_name = "Time step axis" ;
timestp:units = "timesteps since YYYY-01-01 00:00:00" ;
timestp:tstep_sec = 3600. ;
timestp:time_origin = "YYYY-01-01 00:00:00" ;
@dlebauer
dlebauer / rstudio.conf
Last active December 25, 2015 05:08
configuration file for rstudio-server on CentOS (tested on 5.9)
<VirtualHost *:80>
<Proxy *>
Allow from localhost
</Proxy>
ProxyPass /rstudio/ http://localhost:8787/
ProxyPassReverse /rstudio/ http://localhost:8787/
RedirectMatch permanent ^/rstudio$ /rstudio/
[dlebauer@biocluster vars2]$ ncdump -h all.nc
netcdf all {
dimensions:
lat = 360 ;
lon = 720 ;
time = 160708 ;
nv = 2 ;
points_terre = 62482 ;
variables:
int crs ;
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 1 column, instead of 2 in line 2.
"# David LeBauer, Dan Wang, and Michael Dietze, 2010. Biofuel Ecophysiological Traits and Yields Database Version 1.0. Energy Biosciences Institute, Urbana, IL"
#
# Contact:,[email protected]
#
# SQL query:,"SELECT ""traits_and_yields_view"".* FROM ""traits_and_yields_view"" WHERE (access_level >= 4) AND ((LOWER(traits_and_yields_view.scientificname) LIKE '%switchgrass%' OR LOWER(traits_and_yields_view.commonname) LIKE '%switchgrass%' OR LOWER(traits_and_yields_view.trait) LIKE '%switchgrass%' OR LOWER(traits_and_yields_view.trait_description) LIKE '%switchgrass%' OR LOWER(traits_and_yields_view.city) LIKE '%switchgrass%' OR LOWER(traits_and_yields_view.sitename) LIKE '%switchgrass%'))"
#
# Date of query:,2014-04-11 00:42:35 -0500
#
sitename,city,lat,lon,scientificname,commonname,genus,author,citation_year,treatment,date,month,year,dateloc,trait,mean,units,n,statname,stat,notes
Grassland Soil & Water Research Laboratory,Temple,31.05,-97.35,Panicum virgatum,switchgrass,Panicum,Kiniry,1999,Switch1,1995-06
@dlebauer
dlebauer / betydb_fk_constraints.sql
Created April 29, 2014 22:53
BETYdb Foreign Key Constraints
ALTER TABLE "traits" ADD CONSTRAINT "fk_traits_species_1" FOREIGN KEY ("specie_id") REFERENCES "species" ("id");
ALTER TABLE "yields" ADD CONSTRAINT "fk_yields_species_1" FOREIGN KEY ("specie_id") REFERENCES "species" ("id");
ALTER TABLE "traits" ADD CONSTRAINT "fk_traits_sites_1" FOREIGN KEY ("site_id") REFERENCES "sites" ("id");
ALTER TABLE "yields" ADD CONSTRAINT "fk_yields_sites_1" FOREIGN KEY ("site_id") REFERENCES "sites" ("id");
ALTER TABLE "traits" ADD CONSTRAINT "fk_traits_citations_1" FOREIGN KEY ("citation_id") REFERENCES "citations" ("id");
ALTER TABLE "yields" ADD CONSTRAINT "fk_yields_citations_1" FOREIGN KEY ("citation_id") REFERENCES "citations" ("id");
ALTER TABLE "traits" ADD CONSTRAINT "fk_traits_cultivars_1" FOREIGN KEY ("cultivar_id") REFERENCES "cultivars" ("id");
ALTER TABLE "yields" ADD CONSTRAINT "fk_yields_cultivars_1" FOREIGN KEY ("cultivar_id") REFERENCES "cultivars" ("id");
ALTER TABLE "traits" ADD CONSTRAINT "fk_traits_treatments_1" FOREIGN KEY ("treatment_id") REFERENCES "treatm
@dlebauer
dlebauer / betydb_schema.sql
Created April 30, 2014 14:37
BETYdb Schema With Uniqueness and Foreign Key Constraints
CREATE TABLE "citations" (
"id" int4 NOT NULL DEFAULT nextval('citations_id_seq'::regclass),
"author" varchar(255) COLLATE "default" NOT NULL,
"year" int4 NOT NULL,
"title" varchar(255) COLLATE "default" NOT NULL,
"journal" varchar(255) COLLATE "default",
"vol" int4,
"pg" varchar(255) COLLATE "default",
"url" varchar(512) COLLATE "default",
"pdf" varchar(255) COLLATE "default",
@dlebauer
dlebauer / update_sites_elevations.sql
Last active August 29, 2015 14:05
code used to update site records that had missing elevations in BETYdb
update sites set geometry=ST_SetSRID(ST_MakePoint(44.28, -96.68, 495), 4326), notes = 'elevation queried from lat lon using R geonames::GNstrm3', updated_at = now() where id= 12;
update sites set geometry=ST_SetSRID(ST_MakePoint(29.72, -95.4, 22), 4326), notes = 'elevation queried from lat lon using R geonames::GNstrm3', updated_at = now() where id= 100;
update sites set geometry=ST_SetSRID(ST_MakePoint(47.17, -122.17, 167), 4326), notes = 'elevation queried from lat lon using R geonames::GNstrm3', updated_at = now() where id= 156;
update sites set geometry=ST_SetSRID(ST_MakePoint(50.63, -3.45, 3), 4326), notes = 'elevation queried from lat lon using R geonames::GNstrm3', updated_at = now() where id= 186;
update sites set geometry=ST_SetSRID(ST_MakePoint(52.42, 0.11, -1), 4326), notes = 'experimental site; elevation queried from lat lon using R geonames::GNstrm3', updated_at = now() where id= 199;
update sites set geometry=ST_SetSRID(ST_MakePoint(52.79, 7.09, 13), 4326), notes = 'elevation qu
<?xml version="1.0"?>
<pecan>
<outdir>/tmp/biocrotest/</outdir>
<pfts>
<pft>
<name>salix</name>
</pft>
</pfts>
<database>
<bety>
Importing from production database
----------------------------------
```{bash}
mysql -u dlebauer -p"bety" ebi_production < ebi_productiondump.sql
```
```{sql}
delete from traits where user_id not = 15;
```