Skip to content

Commit 570f3cd

Browse files
committed
Fix bugs in ray traced forest tutorial
1 parent 4bffe37 commit 570f3cd

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

docs/src/tutorials/from_tree_forest/raytracedforest.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ function create_sky(;mesh, lat = 52.0*π/180.0, DOY = 182)
257257
Ig = getindex.(temp, 1)
258258
Idir = getindex.(temp, 2)
259259
Idif = getindex.(temp, 3)
260+
theta = getindex.(temp, 4)
261+
phi = getindex.(temp, 5)
260262
# Conversion factors to PAR for direct and diffuse irradiance
261263
f_dir = waveband_conversion(Itype = :direct, waveband = :PAR, mode = :power)
262264
f_dif = waveband_conversion(Itype = :diffuse, waveband = :PAR, mode = :power)
@@ -266,19 +268,19 @@ function create_sky(;mesh, lat = 52.0*π/180.0, DOY = 182)
266268
# Create the dome of diffuse light
267269
dome = sky(mesh,
268270
Idir = 0.0, ## No direct solar radiation
269-
Idif = sum(Idir_PAR)/10*DL, ## Daily Diffuse solar radiation
271+
Idif = sum(Idif_PAR)/10*DL, ## Daily Diffuse solar radiation
270272
nrays_dif = 1_000_000, ## Total number of rays for diffuse solar radiation
271273
sky_model = StandardSky, ## Angular distribution of solar radiation
272274
dome_method = equal_solid_angles, # Discretization of the sky dome
273275
ntheta = 9, ## Number of discretization steps in the zenith angle
274276
nphi = 12) ## Number of discretization steps in the azimuth angle
275277
# Add direct sources for different times of the day
276-
for I in Idir_PAR
277-
push!(dome, sky(mesh, Idir = I/10*DL, nrays_dir = 100_000, Idif = 0.0)[1])
278+
for i in eachindex(Idir_PAR)
279+
push!(dome, sky(mesh, Idir = Idir_PAR[i]/10*DL, nrays_dir = 100_000, Idif = 0.0,
280+
theta_dir = theta[i], phi_dir = phi[i])[1])
278281
end
279282
return dome
280283
end
281-
```
282284

283285
The 3D scene and the light sources are then combined into a `RayTracer` object,
284286
together with general settings for the ray tracing simulation chosen via `RTSettings()`.

0 commit comments

Comments
 (0)