Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mayer
CircularGreenSimCity
Commits
6f4999f8
Commit
6f4999f8
authored
Jun 02, 2023
by
Eric Duminil
Browse files
Fixed locale for CSV, and no trailing ;
parent
5b161862
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
tree-water-demand/all_values.csv
View file @
6f4999f8
This diff is collapsed.
Click to expand it.
tree-water-demand/src/main/java/de/hft/stuttgart/water/TreeWaterDemand.java
View file @
6f4999f8
...
@@ -11,6 +11,7 @@ import java.time.LocalDateTime;
...
@@ -11,6 +11,7 @@ import java.time.LocalDateTime;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.opencsv.CSVReader
;
import
com.opencsv.CSVReader
;
import
com.opencsv.exceptions.CsvException
;
import
com.opencsv.exceptions.CsvException
;
...
@@ -78,6 +79,7 @@ public class TreeWaterDemand
...
@@ -78,6 +79,7 @@ public class TreeWaterDemand
int
startHours
=
(
int
)
Duration
.
between
(
startOfYear
,
start
).
toHours
();
int
startHours
=
(
int
)
Duration
.
between
(
startOfYear
,
start
).
toHours
();
int
hours
=
(
int
)
Duration
.
between
(
start
,
end
).
toHours
();
int
hours
=
(
int
)
Duration
.
between
(
start
,
end
).
toHours
();
DateTimeFormatter
f
=
DateTimeFormatter
.
ofPattern
(
"dd/MM/yyyy HH:mm"
);
DateTimeFormatter
f
=
DateTimeFormatter
.
ofPattern
(
"dd/MM/yyyy HH:mm"
);
Locale
.
setDefault
(
new
Locale
(
"en"
,
"US"
));
try
(
BufferedWriter
bw
=
Files
.
newBufferedWriter
(
Paths
.
get
(
"all_values.csv"
),
StandardCharsets
.
UTF_8
))
{
try
(
BufferedWriter
bw
=
Files
.
newBufferedWriter
(
Paths
.
get
(
"all_values.csv"
),
StandardCharsets
.
UTF_8
))
{
bw
.
write
(
"DateTime;Temperature;Humidity;GHI;WindSpeed;SaturationVaporPressure;ActualVaporPressure;ET0;ET0u\n"
);
bw
.
write
(
"DateTime;Temperature;Humidity;GHI;WindSpeed;SaturationVaporPressure;ActualVaporPressure;ET0;ET0u\n"
);
bw
.
write
(
"dd/mm/yyyy HH:MM;[°C];[%];[W/m²];[m/s];[?];[?];[l/h];[l/h]\n"
);
bw
.
write
(
"dd/mm/yyyy HH:MM;[°C];[%];[W/m²];[m/s];[?];[?];[l/h];[l/h]\n"
);
...
@@ -88,9 +90,9 @@ public class TreeWaterDemand
...
@@ -88,9 +90,9 @@ public class TreeWaterDemand
double
humidity
=
Double
.
parseDouble
(
row
[
humidityIndex
]);
double
humidity
=
Double
.
parseDouble
(
row
[
humidityIndex
]);
double
incomingRadiation
=
Double
.
parseDouble
(
row
[
irrIndex
]);
double
incomingRadiation
=
Double
.
parseDouble
(
row
[
irrIndex
]);
bw
.
write
(
String
.
format
(
"%.1f
;
"
,
temp
));
bw
.
write
(
String
.
format
(
"%.1f"
,
temp
));
bw
.
write
(
String
.
format
(
"%.0f
;
"
,
humidity
));
bw
.
write
(
String
.
format
(
"
;
%.0f"
,
humidity
));
bw
.
write
(
String
.
format
(
"%.0f
;
"
,
incomingRadiation
));
bw
.
write
(
String
.
format
(
"
;
%.0f"
,
incomingRadiation
));
// convert to MJ/h - 1 W = 0.0036 MJ/h
// convert to MJ/h - 1 W = 0.0036 MJ/h
incomingRadiation
*=
0.0036
;
incomingRadiation
*=
0.0036
;
...
@@ -103,11 +105,11 @@ public class TreeWaterDemand
...
@@ -103,11 +105,11 @@ public class TreeWaterDemand
hourOfDay
,
lz
,
lm
);
hourOfDay
,
lz
,
lm
);
double
et0u
=
et0u
(
svf
,
advection
,
et0
);
double
et0u
=
et0u
(
svf
,
advection
,
et0
);
bw
.
write
(
String
.
format
(
"%.1f
;
"
,
windSpeed
));
bw
.
write
(
String
.
format
(
"
;
%.1f"
,
windSpeed
));
bw
.
write
(
String
.
format
(
"%.3f
;
"
,
saturationVaporPressure
));
bw
.
write
(
String
.
format
(
"
;
%.3f"
,
saturationVaporPressure
));
bw
.
write
(
String
.
format
(
"%.3f
;
"
,
actualVaporPressure
));
bw
.
write
(
String
.
format
(
"
;
%.3f"
,
actualVaporPressure
));
bw
.
write
(
String
.
format
(
"%.3f
;
"
,
et0
));
bw
.
write
(
String
.
format
(
"
;
%.3f"
,
et0
));
bw
.
write
(
String
.
format
(
"%.3f
;
"
,
et0u
));
bw
.
write
(
String
.
format
(
"
;
%.3f"
,
et0u
));
et0s
.
add
(
et0
);
et0s
.
add
(
et0
);
// System.out.println("et0: " + et0);
// System.out.println("et0: " + et0);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment