Skip to content

Commit

Permalink
updated space-time cube section
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Jul 15, 2014
1 parent 4dade5d commit 471e9aa
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 15 deletions.
61 changes: 46 additions & 15 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ <h2>NagsHead series</h2>
</pre>

<p>
Display 2D animation of space-time raster data set.
Display animation of space-time raster data set, first just in 2D.

<pre>
<code class="neutral">
Expand All @@ -654,18 +654,24 @@ <h2>NagsHead series</h2>
</code>
</pre>


<p>
To display animation in 3D, launch wxGUI,
add e.g. NH_1999_1m, go to 3D view, set view and resolution, save workspace file.
In Animation tool, edit animation, choose 3D mode, set workspace file,
We can also display 2D and 3D animation side by side. To display animation in 3D,
we first have to prepare and store 3D view parameters. To do that, launch GUI if not already launched,
add e.g. NH_1999_1m, go to 3D view, set view and resolution as desired
(see <a href="http://grass.osgeo.org/grass70/manuals/wxGUI.nviz.html#3d-view-layer-manager-toolbox">GUI manual</a>),
and save workspace file.
In Animation tool, add animation, choose 3D mode, set workspace file,
and leave there <tt>elevation_map</tt>.
Note that 3D in Animation tool (as well as m.nviz.image command bellow)
is not supported on MS Windows and Mac OS X version 10.7 and older.
is not supported on MS Windows.
<p>
<!-- got black box for 3D animation on 10.6, try it on Mac 10.8. -->
<img src="./pictures/anim4_result.png" alt="NagsHead series 2D and 3D animation" style="width: 600px;"></img>

<p>
For scripting or working in command line, you can save your 3D settings
as m.nviz.image command using the button on GIS Layer manager (second row).
Sidenote: for scripting or working in command line, you can save your 3D settings
as m.nviz.image command using the button on GIS Layer manager (second row) called 'Generate command for m.nviz.image'.
Here is an example of a saved command:

<!-- TODO: implement saving as python -->
Expand All @@ -675,8 +681,12 @@ <h2>NagsHead series</h2>
</code>
</pre>

<h3>Space-time cube representation</h3>
<p>
Space-time cube is 3-dimensional representation where z-coordinate is time.
We use 3D raster to represent space-time cube with z-coordinates as values of the 3D raster.
<p>
Create a 3D raster.
To create space-time cube we vertically stack the series of digital elevation models:

<pre>
<code>
Expand All @@ -686,23 +696,44 @@ <h2>NagsHead series</h2>
</code>
</pre>

<p>
If you are getting complaints about different type (FCELL and DCELL),
check if you did the interpolating and type conversion steps above correctly.

<!-- TODO: see how this is in 70 branch, display legend -->
<p>
Now, create a dummy 3D raster for coloring.
Now, create a new 3D raster which will be used for coloring isosurfaces by years.

<pre>
<code>
r3.mapcalc "color_vol = color_vol = if (depth()==1, 1999, if(depth()==2, 2000, if(depth()==3, 2001, if(depth()==4, 2002,if(depth()==5, 2003, if(depth()==6, 2004, if(depth()==7, 2005, if(depth()==8, 2006, if(depth()==9, 2007, 2008)))))))))"
t.rast.mapcalc inputs=NagsHead_99_08 expression="start_time() + 1999" output=NagsHead_years basename=NagsHead_years nprocs=4
t.rast.to.rast3 input=NagsHead_years output=NagsHead_years_vol

# set color table of the space-time cube 3D raster
r3.colors map=NagsHead_99_08_vol color=elevation
</code>
</pre>

<p>
Display in 3D, consider dividing elevation by 10 because we have to use big exaggeration for the 3D raster.
Now we will display the space-time cube in 3D. Follow the instructions below:
<pre>
<code class="gui">
# set lower resolution to speed up 3D rendering
g.region -p3 res3=3 tbres=1

# first we add DEM from 2008 which was divided by 20 for visualization purpose in 3D view
# because we have to use big exaggeration for the 3D raster
Add raster map layer -> select NH_2008_1m_0.05
Add various raster map layers -> Add 3D raster map layer -> select NagsHead_99_08_vol
Right click on 3D raster -> Zoom to selected map
Paste d.legend command into GUI Command console:
d.legend -f rast3d=NagsHead_years_vol at=5,50,7,10 use=1999,2000,2001,2002,2003,2004,2005,2006,2007,2008
Switch to 3D view (be patient)
On View page, set z-exaggeration to 20 and view height to 100.
On Data page -> Surface, lower fine mode resolution to 1 or 2
On Data page -> Volume, add isosurface and then change its value to 11 or similar
and change the color to use NagsHead_years_vol. Set the isosurface resolution to 1.
</code>
</pre>

<p>
<img src="./pictures/nags_head_nviz.png" alt="NagsHead space-time cube in wxNviz" style="width: 700px;"></img>

<h2>Visualization of solar radiation</h2>

Expand Down
156 changes: 156 additions & 0 deletions nagsHead1_workspace.gxw
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE gxw SYSTEM "grass-gxw.dtd">
<gxw>
<layer_manager dim="83,24,525,712">
</layer_manager>
<display name="Display 1" render="1" mode="0" showCompExtent="1" alignExtent="1" constrainRes="0" dim="564,24,785,680" extent="913257.756372,249729.264146,914454.822677,250666.098646,0.000000,1.000000" tbres="1.000000" viewMode="3d" >
<layer type="raster" name="NHcut_1998_1m@NagsHead_series" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NHcut_1998_1m@NagsHead_series</value>
</parameter>
</task>
</layer>
<layer type="raster" name="NHcut_1997_1m@NagsHead_series" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NHcut_1997_1m@NagsHead_series</value>
</parameter>
</task>
</layer>
<layer type="raster" name="NHcut_1996_1m@NagsHead_series" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NHcut_1996_1m@NagsHead_series</value>
</parameter>
</task>
</layer>
<layer type="raster" name="NH_2008_1m@NagsHead_series" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NH_2008_1m@NagsHead_series</value>
</parameter>
</task>
</layer>
<layer type="raster" name="NH_2007_1m@NagsHead_series" checked="1" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NH_2007_1m@NagsHead_series</value>
</parameter>
</task>
<nviz>
<surface>
<attribute name="shine" map="0">
<value>60.0</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="null@NagsHead_series" checked="0" opacity="1.000000">
<selected />
<task name="d.rast">
<parameter name="map">
<value>null@NagsHead_series</value>
</parameter>
</task>
</layer>
<layer type="raster" name="NH_2005_1m@NagsHead_series" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NH_2005_1m@NagsHead_series</value>
</parameter>
</task>
</layer>
<layer type="raster" name="NH_2004_1m@NagsHead_series" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NH_2004_1m@NagsHead_series</value>
</parameter>
</task>
</layer>
<layer type="raster" name="NH_2001_1m@NagsHead_series" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NH_2001_1m@NagsHead_series</value>
</parameter>
</task>
</layer>
<layer type="raster" name="NH_1999_1m@NagsHead_series" checked="0" opacity="1.000000">
<task name="d.rast">
<parameter name="map">
<value>NH_1999_1m@NagsHead_series</value>
</parameter>
</task>
</layer>
<nviz_state>
<view>
<v_position>
<x>0.50</x>
<y>0.87</y>
</v_position>
<persp>
<value>13</value>
<step>2</step>
<min>1</min>
<max>100</max>
</persp>
<v_height>
<value>839</value>
<min>-239</min>
<max>359</max>
</v_height>
<twist>
<value>0</value>
<min>-180</min>
<max>180</max>
</twist>
<z-exag>
<value>3.00</value>
<min>0</min>
<max>20</max>
<llRatio>1.00</llRatio>
</z-exag>
<focus>
<x>623</x>
<y>422</y>
<z>8</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>
Binary file added pictures/anim4_result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pictures/nags_head_nviz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 471e9aa

Please sign in to comment.