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::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],
{"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::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
@chrispahm
chrispahm / gist:4804fd4e22cd0fbd293f659530c2271d
Last active September 27, 2019 13:37
R lm() poly output to JS function
var coeff = [
[1,0],
[2,0],
[3,0],
[4,0],
[0,1],
[1,1],
[2,1],
[3,1],
[0,2],
@chrispahm
chrispahm / optimise-images-terminal.md
Last active August 18, 2019 10:41 — forked from gielcobben/optimise-images-terminal.md
Optimise your pngs from the terminal in OSX

JPG:
$ brew install jpegoptim
$ mkdir lowRes
$ sips -Z 1024 *.jpg --out lowRes
$ cd lowRes
$ find . -name "*.jpg" -exec jpegoptim -m80 -o -p --strip-all {} \;

- PNG:
$ brew install optipng
$ mkdir lowRes

@chrispahm
chrispahm / show_params_currently_in_gms_model.js
Created August 9, 2019 12:52
Find out all active parameters currently used in a GAMS model (using Atom linter-gams)
// open the developer console in Atom (ctrl-shift-i on Windows)
// and paste the following code in order to get a list of all
// active parameters currently used in the GAMS model
global.gamsView.filter(elem => {
function checkRef(ref) {
let flag = false
ref.forEach(ref => {
if (ref.file.includes('templ.gms') || ref.file.includes('model')) flag = true
})
return flag
/*************************************************************
* Method: lstParse
* Scope: Public:
* Agruments: listingFile: The GAMS listingFile file to interpreted
model: The model we want solver to operate on
* Purpose: Convert the results of a GAMS CPLEX solve to a
* friendly JSON similar to the one generated by
* the jsLPsolver
**************************************************************/
// Check model status, and only proceed if status code is in modelStatus-Array
/*************************************************************
* Method: reformatGAMS
* Scope: Public:
* Agruments: model: The model we want solver to operate on
optcr: Termination tolerance
* Purpose: Convert a friendly JSON model into a model for a
* real solving library...in this case
* GAMS
**************************************************************/
// this.reformatGAMS = function (model, optcr) {
@chrispahm
chrispahm / init.coffee
Last active February 19, 2018 09:35
Init script to run GAMS file through Atom command palette
# GAMS run init script
#
# This atom init script will execute the current GAMS file
# and subsequently open the according listing (.lst) file
# An example hack to log to the console when each text editor is saved.
# You would need to have linter-gams installed and adjust the below filepaths
# to your needs
atom.commands.add 'atom-text-editor', 'gams:run', =>
return unless editor = atom.workspace.getActiveTextEditor()
var resizedPoly = turf.transformScale(polygon, 1000)
Draw.add(resizedPoly)
Draw.add(turf.simplify(resizedPoly, {tolerance: 0.05, highQuality: true}))
Draw.add(turf.simplify(resizedPoly, {tolerance: 0.4, highQuality: true}))
vorgewende.lineString(turf.simplify(resizedPoly, {tolerance: 0.05, highQuality: true}),38)
map.fitBounds(turf.bbox(resizedPoly))