Skip to content

Commit

Permalink
rsun visualization section updated
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Jul 14, 2014
1 parent 373f395 commit 50f0908
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 21 deletions.
57 changes: 36 additions & 21 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -732,57 +732,72 @@ <h2>NagsHead series</h2>
<p>
Display in 3D, consider dividing elevation by 10 because we have to use big exaggeration for the 3D raster.

<h2>r.sun simulation</h2>

<h2>Visualization of solar radiation</h2>

<!-- TODO: here we have addons but they are linked,
moreover we have no way to say don't link -->
<p>
Choose a location where to run irradiance analysis
(Nags Head or Indian Hill should work).
Download extension (r.sun.hourly or r.sun.daily).
We will compute solar radiation during a day for a part of North Carolina State University Centennial Campus.
Then we will visualize the change of solar radiation as a 3D animation.
If you don't have r.sun.hourly, download it:

<pre><code>
g.extension extension=r.sun.hourly
</code></pre>

<p>
Example of running r.sun.hourly.
Get the today's date from runing this command in Python shell tab in wxGUI.
Convert the today's date (or any other date) to day of year by running this command in Python shell tab in GUI.

<pre>
<code class="python">
from datetime import datetime
datetime.now().timetuple().tm_yday
# or for an arbitrary day:
datetime.datetime(2014, 6, 21).timetuple().tm_yday
</code>
</pre>

<p>
And insert it in the command.
Export e.g. beam irradiance raster series (it can take some time).
Use this number for option <code>day</code>.
Export beam irradiance raster series (be patient).

<pre>
<code>
r.sun.hourly -t elev_in=lid640ground_bspline2 start_time=6 end_time=20 day=282 year=2013 beam_rad_basename=beam nprocs=4
t.rast.colors input=beam color=grey
r.sun.hourly -t elev_in=elev_lid_small start_time=6 end_time=20 day=200 year=2014 beam_rad_basename=beam nprocs=4
</code>
</pre>

<p>
Animate 2D.

Set custom color table:
<pre>
<code class="neutral">
g.gui.animation strds=beam
<code class="bash">
echo "0% 60:60:60
70% yellow
100% 255:70:0" > rules.txt
t.rast.colors input=beam rules=rules.txt
</code>
<code class="gui">
Use interactive input box in t.rast.colors dialog
or add the following line with coordinates to a newly created rules.txt file:
0% 60:60:60
70% yellow
100% 255:70:0

t.rast.colors input=beam rules=rules.txt
</code>
</pre>

<p>
Animate 3D.
Open wxGUI, load elevation map, go to 3D view, set view and other parameters as desired.
Save workspace file.
Launch animation tool, set 3D, space-time raster dataset,
set workspace file and choose color_map option.
Finally, we animate the series in 3D. To do that, we first add <code>elev_lid_small</code> map in GUI,
zoom to it, and swith to 3D view.
We set desired view and resolution and then change the color by draping
over one of the solar radiation maps (see <a href="http://grass.osgeo.org/grass70/manuals/wxGUI.nviz.html#3d-view-layer-manager-toolbox">GUI manual</a>).
We save workspace to a file.
Then we launch animation tool and add new animation. Choose 3D, add the computed space-time raster dataset,
set saved workspace file and choose color_map option to animate.
Note that 3D animation are not supported on MS Windows.
<p>
<img src="./pictures/anim3_result.png" alt="solar radiation animation in 3D"></img>

</p>
<!-- the last tag must be closed -->

Expand Down
Binary file added pictures/anim3_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 103 additions & 0 deletions rsun_workspace.gxw
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE gxw SYSTEM "grass-gxw.dtd">
<gxw>
<layer_manager dim="49,24,525,712">
</layer_manager>
<display name="Display 1" render="1" mode="0" showCompExtent="0" alignExtent="1" constrainRes="0" dim="564,24,785,680" extent="638926.707925,224024.420762,639608.577811,224679.783642,0.000000,1.000000" tbres="1.000000" viewMode="3d" >
<layer type="raster" name="elev_lid_small@centennial" checked="1" opacity="1.000000">
<selected />
<task name="d.rast">
<parameter name="map">
<value>elev_lid_small@centennial</value>
</parameter>
</task>
<nviz>
<surface>
<attribute name="shine" map="0">
<value>60.0</value>
</attribute>
<attribute name="color" map="1">
<value>beam_14.00@centennial</value>
</attribute>
<draw shading="gouraud" style="surface" mode="fine">
<resolution type="coarse">
<value>9</value>
</resolution>
<resolution type="fine">
<value>1</value>
</resolution>
<wire_color>
<value>136:136:136</value>
</wire_color>
</draw>
<position>
<x>0</x>
<y>0</y>
<z>0</z>
</position>
</surface>
</nviz>
</layer>
<layer type="raster" name="beam_09.00@centennial" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>beam_09.00@centennial</value>
</parameter>
</task>
</layer>
<nviz_state>
<view>
<v_position>
<x>0.73</x>
<y>0.93</y>
</v_position>
<persp>
<value>16</value>
<step>2</step>
<min>1</min>
<max>100</max>
</persp>
<v_height>
<value>1706</value>
<min>-1271</min>
<max>2137</max>
</v_height>
<twist>
<value>0</value>
<min>-180</min>
<max>180</max>
</twist>
<z-exag>
<value>1.00</value>
<min>0</min>
<max>10</max>
<llRatio>1.00</llRatio>
</z-exag>
<focus>
<x>346</x>
<y>313</y>
<z>110</z>
</focus>
<background_color>
<value>255:255:255</value>
</background_color>
</view>
<light>
<l_position>
<x>0.68</x>
<y>-0.68</y>
<z>80</z>
</l_position>
<bright>
<value>80</value>
</bright>
<ambient>
<value>20</value>
</ambient>
<color>
<value>255:255:255</value>
</color>
</light>
</nviz_state>
</display>
</gxw>

0 comments on commit 50f0908

Please sign in to comment.