Skip to content

Instantly share code, notes, and snippets.

View chrispahm's full-sized avatar
🌻
https://fruchtfolge.agp.uni-bonn.de/

Christoph Pahmeyer chrispahm

🌻
https://fruchtfolge.agp.uni-bonn.de/
View GitHub Profile
{"konventionell/integriert::Sommerackerbohnen - Körnergewinnung::wendend, gezogene Saatbettbereitung, Saat":[{"year":2018,"yield":35.8,"price":17.91,"revenue":641,"seeds":93,"fertilizer":45,"pesticides":119,"others":83,"sdb":301,"varCosts":340},{"year":2017,"yield":34.1,"price":17.79,"revenue":607,"seeds":99,"fertilizer":45,"pesticides":115,"others":79,"sdb":269,"varCosts":338},{"year":2016,"yield":35.1,"price":17.16,"revenue":602,"seeds":128,"fertilizer":62,"pesticides":113,"others":81,"sdb":217,"varCosts":385},{"year":2015,"yield":38,"price":19.3,"revenue":734,"seeds":131,"fertilizer":65,"pesticides":113,"others":89,"sdb":336,"varCosts":398},{"year":2014,"yield":34.4,"price":20.82,"revenue":717,"seeds":126,"fertilizer":49,"pesticides":112,"others":82,"sdb":347,"varCosts":369},{"year":2013,"yield":32.2,"price":24.32,"revenue":783,"seeds":129,"fertilizer":53,"pesticides":112,"others":78,"sdb":411,"varCosts":373},{"year":2012,"yield":28.9,"price":19.49,"revenue":563,"seeds":119,"fertilizer":56,"pesticides":109
{"konventionell/integriert::Sommerackerbohnen - Körnergewinnung::wendend, gezogene Saatbettbereitung, Saat":{"varCosts":[212.028611980753,-4.68966868737025,0.0488360857650367,2.91253832080648,-0.0284166263449593,-0.00618019572180368],"fixCosts":[321.038508396658,-6.61332451954161,0.0663431421309443,1.93204071200841,-0.012795353655188,0.00778511329712469],"JAN":[0,0,0,0,0,0],"FEB":[0,0,0,0,0,0],"MRZ":[2.80509595582486,-0.146695350409434,0.00156690523636225,0.108294573638782,-0.00123831574877968,-0.00061945243526232],"APR":[0,0,0,0,0,0],"MAI":[0.769781312041604,-0.0529379530852461,0.000585216504612539,0.0546266750575244,-0.000640613220174498,-0.000406597232317381],"JUN":[0,0,0,0,0,0],"JUL":[0,0,0,0,0,0],"AUG":[1.86633079569951,-0.0572765991525298,0.000582771489512085,0.0236532608257089,-0.000127973685059161,-0.000084942909915301],"SEP":[0.925680932233967,-0.0309942393637948,0.000308753108504588,0.00952975868691227,-0.0000713385421707318,0.0000301986540459087],"OKT":[2.48797194677527,-0.0598464953546542,0.000577
{
"konventionell/integriert::Mais - Körnermais::wendend, gezogene Saatbettbereitung, Saat": {
"varCosts": [429.2100054682, -2.15585823294687, 0.0113375527390382, 4.67166502967974, -0.0335173702325071, 0.0108466768551407],
"fixCosts": [404.644339578215, -2.99848438883808, 0.0126061380285447, 3.57776575875562, -0.030297488509476, 0.0154255499402457],
"diesel": [87.6239368617408, -0.970760779480302, 0.00596949331439337, 2.51384452879148, -0.0162398685694236, 0.00415596692077977],
"kea": [40012.9253842185, -63.8546762633683, 0.408415311367651, 143.360060954624, -0.962513851783179, 0.282736820138856],
"JAN": [0, 0, 0, 0, 0, 0],
"FEB": [0, 0, 0, 0, 0, 0],
"MRZ": [0.22692954207248, -0.0135910629678798, 0.000262785707520569, 0.000888304021087536, -0.00000830077546462287, 0.0000543155715838675],
"APR": [3.37830550032205, -0.245688387844083, 0.00497703379193492, 0.138751083557847, -0.00128187705085698, -0.000338751739448481],
This file has been truncated, but you can view the full file.
{"konventionell/integriert::Sommerackerbohnen - Körnergewinnung::wendend, gezogene Saatbettbereitung, Saat":[{"year":2019,"region":"Arnsberg","yield":39.7,"byPrdouctYield":0,"byProductPrice":0,"price":17.14,"revenue":680,"seeds":86,"fertilizer":58,"pesticides":125,"others":77,"sdb":335},{"year":2018,"region":"Arnsberg","yield":49.4,"byPrdouctYield":0,"byProductPrice":0,"price":15.64,"revenue":773,"seeds":100,"fertilizer":85,"pesticides":125,"others":95,"sdb":368},{"year":2017,"region":"Arnsberg","yield":48,"byPrdouctYield":0,"byProductPrice":0,"price":14.86,"revenue":714,"seeds":103,"fertilizer":75,"pesticides":124,"others":91,"sdb":321},{"year":2016,"region":"Arnsberg","yield":35.9,"byPrdouctYield":0,"byProductPrice":0,"price":15.05,"revenue":541,"seeds":125,"fertilizer":62,"pesticides":122,"others":69,"sdb":163},{"year":2015,"region":"Arnsberg","yield":47.4,"byPrdouctYield":0,"byProductPrice":0,"price":19.34,"revenue":917,"seeds":135,"fertilizer":87,"pesticides":122,"others":95,"sdb":479},{"year":2014,"regi
{
"_id": "rfid_string::timestamp_iso8601::amountDiesel",
"rfid": "rfid_string",
"time": "timestamp_iso8601",
"amount": 420.24
}
// Source: https://stats.stackexchange.com/questions/83826/is-a-weighted-r2-in-robust-linear-model-meaningful-for-goodness-of-fit-analys/375752#375752
// Article: Willet and Singer (1988): https://gseacademic.harvard.edu/~willetjo/pdf%20files/Willett_Singer_AS88.pdf
function weightedRsquared(x, func, weights) {
if (!weights) weights = x.map(v => 1);
// Compute the weighted average y value for the actual
// data set in order to compute the
// _total sum of squares_
let sum = 0;
for (let i = 0; i < x.length; i++) {
sum += x[i][1] * weights[i];
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrispahm
chrispahm / stream_geojson_start_byte_end_byte.js
Created January 24, 2022 19:28
Stream GeoJSON file and get startByte and endByte of each JSON record in the file
import { open } from 'fs/promises'
import { Buffer } from 'buffer'
const HIGHWATERMARK = 64 * 1024 / 8
function getFeaturePositionsInFile(fd) {
return new Promise((resolve,reject) => {
const featurePositionsInFile = []
const stream = fd.createReadStream({highWaterMark: HIGHWATERMARK, autoClose: false});
// this RegEx will solely work with standard GeoJSON without any foreign members: