Skip to content

Commit 8658c77

Browse files
committed
Fix #144 and add to tests
1 parent c1d7f12 commit 8658c77

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/run.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ function adjust_weather_timesteps_to_given_length(desired_length, meteo)
9595
meteo_adjusted = meteo
9696

9797
if DataFormat(meteo_adjusted) == TableAlike()
98+
if get_nsteps(meteo) == 1
99+
return Tables.rows(meteo_adjusted)[1]
100+
end
98101
return Tables.rows(meteo_adjusted)
99102
end
100103

test/helper-functions.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,13 @@ period = [Dates.Date("2021-01-01"), Dates.Date("2021-12-31")]
9292
meteo = get_weather(43.649777, 3.869889, period, sink = DataFrame)=#
9393

9494
function get_simple_meteo_bank()
95+
96+
df = CSV.read(joinpath(pkgdir(PlantSimEngine), "examples/meteo_day.csv"), DataFrame, header=18)
97+
98+
9599
meteos=
96100
[#=nothing,=# Atmosphere(T=20.0, Wind=1.0, P=101.3, Rh=0.65, Ri_PAR_f=300.0),
101+
Weather([Atmosphere(T=20.0, Wind=1.0, P=101.3, Rh=0.65)]),
97102
Weather(
98103
[
99104
Atmosphere(T=20.0, Wind=1.0, Rh=0.65, Ri_PAR_f=300.0),
@@ -107,9 +112,9 @@ function get_simple_meteo_bank()
107112
Atmosphere(T=20.0, Wind=1.0, Rh=0.6, Ri_PAR_f=200.0),
108113
Atmosphere(T=25.0, Wind=1.0, Rh=0.6, Ri_PAR_f=200.0),
109114
Atmosphere(T=10.0, Wind=0.5, Rh=0.6, Ri_PAR_f=200.0)]),
110-
111-
CSV.read(joinpath(pkgdir(PlantSimEngine), "examples/meteo_day.csv"), DataFrame, header=18),
112-
115+
df,
116+
df[1,:],
117+
DataFrame(df[1,:]),
113118
]
114119
return meteos
115120
end

0 commit comments

Comments
 (0)