- Working on diffuse PAR model. Who knew how simple it was to calculate Euclidean distances within a variable size array, meaning the diffuse model can be adjusted on the fly (using only the code below), and therefore much better parameterized to actual microclimate conditions. Joy!
x_2 = (findgen(nx) - xcen) ^ 2 ;X distances (squared)
y_2 = (findgen(ny) - ycen) ^ 2 ;Y distances (squared)
im = fltarr( nx, ny, /NOZERO) ;Make uninitialized output array
for i = 0L, ny-1 do begin ;Row loop
im[0,i] = sqrt(x_2 + y_2[i]) ;Euclidian distance
endfor
thanks to NASA GSFC for base code! Here’s a small example from the procedure…
Here is output in cell fractions for a 5x5 array.
2.82843 2.23607 2.00000 2.23607 2.82843
2.23607 1.41421 1.00000 1.41421 2.23607
2.00000 1.00000 0.000000 1.00000 2.00000
2.23607 1.41421 1.00000 1.41421 2.23607
2.82843 2.23607 2.00000 2.23607 2.82843
Now how to make this work except within a variable size cylinder?
excellent, here it is for 4 cells above our z base in meters, corrected for different x and z dimensions (0.56 and 0.15 m).
1.69375 1.38852 1.27059 1.38852 1.69375
1.38852 0.993579 0.820731 0.993579 1.38852
1.27059 0.820731 0.600000 0.820731 1.27059
1.38852 0.993579 0.820731 0.993579 1.38852
1.69375 1.38852 1.27059 1.38852 1.69375
On to the direct PAR model for a change of pace. Here is the preliminary brainstorm, a load of basic trig.