Created
May 1, 2017 11:37
-
-
Save panmasuo/a4d95916b0e512550a106443463561d2 to your computer and use it in GitHub Desktop.
Creating table for Wind Direction impact
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
Table tableHum, tableSolar, tableTemp, MineTable, tablePres, tableWS, tableWD; | |
IntList humIdList; | |
float[] sredniaSolar; | |
float sumaSolar; | |
float k, x, z; | |
void setup() { | |
MineTable = new Table(); | |
MineTable.addColumn("id"); | |
MineTable.addColumn("srednia"); | |
sumaSolar = 0; | |
k = 0; | |
z = 30; | |
tableWD = loadTable("wind direction in degrees.csv"); | |
tableSolar = loadTable("solar radiation.csv"); | |
for (int i = 0; i < 360; i++) { | |
z = (float)i; | |
println("z: " + z); | |
for(int j = 0; j < (tableWD.getRowCount() - 1); j++) { | |
if ((tableWD.getFloat(j, 4) > z - 0.5) && (tableWD.getFloat(j, 4) < z + 1.5)) { | |
sumaSolar = sumaSolar + tableSolar.getFloat(tableWD.getInt(j, 0), 4); | |
k++; | |
println("add " + j); | |
} | |
} | |
if(!(k == 0)) { | |
println(sumaSolar); | |
println(k); | |
x = sumaSolar / k; | |
println(x); | |
TableRow newRow = MineTable.addRow(); | |
newRow.setFloat("id", z); | |
newRow.setFloat("srednia", x); | |
k = 0; | |
sumaSolar = 0; | |
} else | |
k = 0; | |
sumaSolar = 0; | |
} | |
saveTable(MineTable, "daneWD.csv"); | |
} | |
void draw() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment