[grass] 02/09: Imported Upstream version 7.2.0
Bas Couwenberg
sebastic at debian.org
Wed Dec 28 18:40:58 UTC 2016
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository grass.
commit 533f29dce22fb5c336cb7966bbb72979e7cd86b2
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Wed Dec 28 18:14:19 2016 +0100
Imported Upstream version 7.2.0
---
ChangeLog_7.2.0.gz | Bin 0 -> 854955 bytes
ChangeLog_7.2.0RC2.gz | Bin 852441 -> 0 bytes
display/d.geodesic/d.geodesic.html | 5 +-
display/d.rhumbline/d.rhumbline.html | 5 +-
doc/.howto_release.txt.swp | Bin 20480 -> 0 bytes
doc/howto_release.txt | 4 +-
gui/icons/grass.desktop | 95 ++++---
gui/wxpython/lmgr/frame.py | 13 +-
gui/wxpython/lmgr/pyshell.py | 30 +--
gui/wxpython/lmgr/toolbars.py | 2 +-
gui/wxpython/nviz/wxnviz.py | 2 +
gui/wxpython/vdigit/toolbars.py | 11 +-
gui/wxpython/xml/toolboxes.xml | 24 ++
imagery/i.atcorr/README | 4 +-
imagery/i.atcorr/create_iwave.py | 86 ++++--
imagery/i.atcorr/geomcond.h | 2 +-
imagery/i.atcorr/iwave.cpp | 313 ++++++++++++++++------
imagery/i.atcorr/sensors_csv/quickbird2.csv | 162 +++++++++++
imagery/i.modis.qc/i.modis.qc.html | 219 ++++++++++-----
imagery/i.vi/main.c | 3 +-
include/VERSION | 2 +-
lib/gis/find_file.c | 6 +-
lib/gis/gisinit.c | 4 +
lib/init/grass.py | 2 +-
lib/init/grass7.html | 61 ++++-
lib/python/docs/src/pygrass_gis.rst | 29 +-
lib/python/docs/src/pygrass_index.rst | 44 +--
lib/python/docs/src/pygrass_messages.rst | 14 +-
lib/python/docs/src/pygrass_modules.rst | 17 +-
lib/python/docs/src/pygrass_raster.rst | 40 +--
lib/python/docs/src/pygrass_vector.rst | 66 +++--
lib/python/pygrass/modules/interface/module.py | 2 +
lib/python/temporal/mapcalc.py | 10 +-
lib/raster/gdal.c | 1 +
lib/vector/dglib/avl.c | 139 ++++++----
lib/vector/dglib/avl.h | 42 ++-
lib/vector/dglib/tavl.c | 163 ++++++-----
lib/vector/dglib/tavl.h | 40 ++-
misc/m.measure/m.measure.html | 45 +++-
misc/m.measure/m_measure_distance.png | Bin 0 -> 70996 bytes
mswindows/GRASS-Installer.nsi.tmpl | 68 ++++-
mswindows/external/README.license | 2 +-
mswindows/osgeo4w/env.bat.tmpl | 3 +
mswindows/osgeo4w/setup.hint.tmpl | 4 +-
raster/r.category/r.category.html | 55 ++--
raster/r.contour/r.contour.html | 30 ++-
raster/r.contour/r_contour_using_levels.png | Bin 0 -> 201246 bytes
raster/r.fill.dir/main.c | 3 +
raster/r.fill.dir/r.fill.dir.html | 81 ++++--
raster/r.fill.dir/r_fill_dir.png | Bin 0 -> 360040 bytes
raster/r.param.scale/r.param.scale.html | 18 +-
raster/r.quantile/main.c | 2 +
raster/r.stats.quantile/main.c | 2 +
raster/r.texture/r.texture.html | 158 ++++++++---
raster/r.texture/r_texture_directions_example.png | Bin 0 -> 20692 bytes
raster/r.univar/r.univar.html | 38 +--
raster/r.viewshed/r.viewshed.html | 4 +-
scripts/d.correlate/d.correlate.py | 15 +-
scripts/i.in.spotvgt/i.in.spotvgt.py | 2 +
scripts/r.in.aster/r.in.aster.py | 9 +-
scripts/r.out.xyz/r.out.xyz.html | 10 +-
scripts/r.out.xyz/r.out.xyz.py | 11 +-
scripts/v.rast.stats/v.rast.stats.py | 4 +-
vector/v.in.ogr/main.c | 2 +-
vector/v.net.visibility/v.net.visibility.html | 74 ++++-
vector/v.net.visibility/v_net_visibility.png | Bin 0 -> 78892 bytes
vector/v.qcount/v.qcount.html | 125 ++++++---
vector/v.qcount/v_qcount_1.png | Bin 0 -> 5929 bytes
vector/v.qcount/v_qcount_2.png | Bin 0 -> 7942 bytes
vector/v.qcount/v_qcount_3.png | Bin 0 -> 6351 bytes
vector/v.qcount/v_qcount_4.png | Bin 0 -> 24326 bytes
vector/v.qcount/v_qcount_5.png | Bin 0 -> 20950 bytes
72 files changed, 1724 insertions(+), 703 deletions(-)
diff --git a/ChangeLog_7.2.0.gz b/ChangeLog_7.2.0.gz
new file mode 100644
index 0000000..5e8566d
Binary files /dev/null and b/ChangeLog_7.2.0.gz differ
diff --git a/ChangeLog_7.2.0RC2.gz b/ChangeLog_7.2.0RC2.gz
deleted file mode 100644
index a0f8e78..0000000
Binary files a/ChangeLog_7.2.0RC2.gz and /dev/null differ
diff --git a/display/d.geodesic/d.geodesic.html b/display/d.geodesic/d.geodesic.html
index 6143818..80188c8 100644
--- a/display/d.geodesic/d.geodesic.html
+++ b/display/d.geodesic/d.geodesic.html
@@ -46,11 +46,12 @@ coordinate system.
<em>
<a href="d.rhumbline.html">d.rhumbline</a>,
-<a href="d.grid.html">d.grid</a>
+<a href="d.grid.html">d.grid</a>,
+<a href="m.measure.html">m.measure</a>
</em>
<h2>AUTHOR</h2>
Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
-<p><i>Last changed: $Date: 2014-12-28 14:22:50 +0100 (Sun, 28 Dec 2014) $</i>
+<p><i>Last changed: $Date: 2016-12-17 13:29:46 +0100 (Sat, 17 Dec 2016) $</i>
diff --git a/display/d.rhumbline/d.rhumbline.html b/display/d.rhumbline/d.rhumbline.html
index a716f62..8fbac48 100644
--- a/display/d.rhumbline/d.rhumbline.html
+++ b/display/d.rhumbline/d.rhumbline.html
@@ -47,11 +47,12 @@ coordinate system.
<em>
<a href="d.geodesic.html">d.geodesic</a>,
-<a href="d.grid.html">d.grid</a>
+<a href="d.grid.html">d.grid</a>,
+<a href="m.measure.html">m.measure</a>
</em>
<h2>AUTHOR</h2>
Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
-<p><i>Last changed: $Date: 2014-12-19 22:17:36 +0100 (Fri, 19 Dec 2014) $</i>
+<p><i>Last changed: $Date: 2016-12-17 13:29:46 +0100 (Sat, 17 Dec 2016) $</i>
diff --git a/doc/.howto_release.txt.swp b/doc/.howto_release.txt.swp
deleted file mode 100644
index 3428a4f..0000000
Binary files a/doc/.howto_release.txt.swp and /dev/null differ
diff --git a/doc/howto_release.txt b/doc/howto_release.txt
index 1c133af..1e8e87b 100644
--- a/doc/howto_release.txt
+++ b/doc/howto_release.txt
@@ -1,6 +1,6 @@
How to release GRASS GIS binaries and source code
-$Date: 2016-10-02 23:08:51 +0200 (Sun, 02 Oct 2016) $
+$Date: 2016-11-29 00:02:11 +0100 (Tue, 29 Nov 2016) $
Note: This text contains *some* rules only applicable to the
development coordinator (currently Markus Neteler, PSC Chair).
@@ -21,6 +21,8 @@ Contents
( cd doc/raster/r.example/ ; make clean ; make )
( cd doc/vector/v.example/ ; make clean ; make )
still compile; fix otherwise
+
+ - fix typos with tools/fix_typos.sh
- Check that autoconf scripts are up-to-date (to do only in RC cycle!):
diff --git a/gui/icons/grass.desktop b/gui/icons/grass.desktop
index 580949a..b0a6860 100644
--- a/gui/icons/grass.desktop
+++ b/gui/icons/grass.desktop
@@ -2,54 +2,53 @@
Type=Application
Name=GRASS GIS 7
GenericName=Geographic Information System
-Comment=Geographic Information System
-Comment[cs]=Geografický Informační Systém
-Comment[de]=Geoinformationssystem
-Comment[es]=Sistema de Información Geográfica
-Comment[fi]=Maantieteellinen Tietojärjestelmä
-Comment[fr]=Système d'Information Géographique
-Comment[it]=Sistema Informativo Geografico
-Comment[pl]=System Informacji Geograficznej
-Comment[pt]=Sistema de Informação Geoáfic
-Comment[sv]=Geografiskt Informationssystem
-Comment[ar]=نظام المعلومات الجغرافي
-Comment[az]=Coğrafi informasiya sistemi
-Comment[bg]=Географска информационна система
-Comment[bs]=Geografski informacioni sistem
-Comment[ca]=Sistema d'informació geogràfica
-Comment[el]=Σύστημα Γεωγραφικών Πληροφοριών
-Comment[et]=Geoinfosüsteem
-Comment[eu]=Geografia-informazioko sistemen
-Comment[fa]=سامانه اطلاعات مکانی
-Comment[gl]=Sistema de información xeográfica
-Comment[he]=מערכת מידע גאוגרפית
-Comment[hi]=भूगोलीय_सूचना_प्रणाली
-Comment[hr]=Geografski informacijski sustav
-Comment[hu]=Földrajzi információs rendszer
-Comment[hy]=Աշխարհագրական տեղեկատվական համակարգ
-Comment[id]=Sistem informasi geografis
-Comment[is]=Landfræðilegt upplýsingakerfi
-Comment[ka]=გეოინფორმაციული სისტემა
-Comment[lt]=Geografinė informacinė sistema
-Comment[lv]=Ģeogrāfiskā informācijas sistēma
-Comment[mk]=Географски информационен систем
-Comment[ml]=ജി.ഐ.എസ്.
-Comment[nl]=Geografisch informatiesysteem
-Comment[nn]=Geografiske informasjonssystem
-Comment[no]=Geografiske informasjonssystemer
-Comment[ro]=Sistem Informatic Geografic
-Comment[ru]=Геоинформационная система
-Comment[sh]=Geografski informacijski sistem
-Comment[sk]=Geografický informačný systém
-Comment[sl]=Geografski informacijski sistem
-Comment[sr]=Географски информациони систем
-Comment[th]=ระบบสารสนเทศภูมิศาสตร์
-Comment[tr]=Coğrafi bilgi sistemi
-Comment[uk]=Геоінформаційна система
-Comment[uz]=Geografik axborot tizimi
-Categories=Education;Science;Geoscience;Geography;
+GenericName[ar]=نظام المعلومات الجغرافي
+GenericName[az]=Coğrafi informasiya sistemi
+GenericName[bg]=Географска информационна система
+GenericName[bs]=Geografski informacioni sistem
+GenericName[ca]=Sistema d'informació geogràfica
+GenericName[cs]=Geografický Informační Systém
+GenericName[de]=Geographisches Informationssystem
+GenericName[el]=Σύστημα Γεωγραφικών Πληροφοριών
+GenericName[es]=Sistema de Información Geográfica
+GenericName[et]=Geoinfosüsteem
+GenericName[eu]=Geografia-informazioko sistemen
+GenericName[fa]=سامانه اطلاعات مکانی
+GenericName[fi]=Maantieteellinen Tietojärjestelmä
+GenericName[fr]=Système d'Information Géographique
+GenericName[gl]=Sistema de información xeográfica
+GenericName[he]=מערכת מידע גאוגרפית
+GenericName[hi]=भूगोलीय_सूचना_प्रणाली
+GenericName[hr]=Geografski informacijski sustav
+GenericName[hu]=Földrajzi információs rendszer
+GenericName[hy]=Աշխարհագրական տեղեկատվական համակարգ
+GenericName[id]=Sistem informasi geografis
+GenericName[is]=Landfræðilegt upplýsingakerfi
+GenericName[it]=Sistema Informativo Geografico
+GenericName[ka]=გეოინფორმაციული სისტემა
+GenericName[lt]=Geografinė informacinė sistema
+GenericName[lv]=Ģeogrāfiskā informācijas sistēma
+GenericName[mk]=Географски информационен систем
+GenericName[ml]=ജി.ഐ.എസ്.
+GenericName[nl]=Geografisch informatiesysteem
+GenericName[nn]=Geografiske informasjonssystem
+GenericName[no]=Geografiske informasjonssystemer
+GenericName[pl]=System Informacji Geograficznej
+GenericName[pt]=Sistema de Informação Geográfica
+GenericName[ro]=Sistem Informatic Geografic
+GenericName[ru]=Геоинформационная система
+GenericName[sh]=Geografski informacijski sistem
+GenericName[sk]=Geografický informačný systém
+GenericName[sl]=Geografski informacijski sistem
+GenericName[sr]=Географски информациони систем
+GenericName[sv]=Geografiskt Informationssystem
+GenericName[th]=ระบบสารสนเทศภูมิศาสตร์
+GenericName[tr]=Coğrafi bilgi sistemi
+GenericName[uk]=Геоінформаційна система
+GenericName[uz]=Geografik axborot tizimi
+Icon=grass
+TryExec=/usr/bin/grass72
Exec=grass72
-Icon=grass72
Terminal=true
-URL=https://grass.osgeo.org/
Keywords=gis;spatial;geospatial;database;remote sensing;hydrology;vector;raster;visualization;maps;wms;wfs;ogc;osgeo;
+Categories=Education;Science;Geoscience;Geography;
diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py
index d9cd169..7f0ff5d 100644
--- a/gui/wxpython/lmgr/frame.py
+++ b/gui/wxpython/lmgr/frame.py
@@ -382,7 +382,7 @@ class GMFrame(wx.Frame):
if not UserSettings.Get(
group='manager', key='hideTabs', subkey='pyshell'):
self.pyshell = PyShellWindow(
- parent=self.notebook, giface=self._giface)
+ parent=self.notebook, giface=self._giface, simpleEditorHandler=self.OnSimpleEditor)
self.notebook.AddPage(
page=self.pyshell,
text=_("Python"),
@@ -1930,6 +1930,17 @@ class GMFrame(wx.Frame):
dlg.SetPosition((x, y - 200))
dlg.Show()
+ def OnSimpleEditor(self, event):
+ # import on demand
+ from gui_core.pyedit import PyEditFrame
+
+ # we don't keep track of them and we don't care about open files
+ # there when closing the main GUI
+ simpleEditor = PyEditFrame(parent=self, giface=self._giface)
+ simpleEditor.SetSize(self.GetSize())
+ simpleEditor.CenterOnScreen()
+ simpleEditor.Show()
+
def OnShowAttributeTable(self, event, selection=None):
"""Show attribute table of the given vector map layer
"""
diff --git a/gui/wxpython/lmgr/pyshell.py b/gui/wxpython/lmgr/pyshell.py
index 9141949..31a883c 100644
--- a/gui/wxpython/lmgr/pyshell.py
+++ b/gui/wxpython/lmgr/pyshell.py
@@ -33,7 +33,7 @@ from core.utils import _
class PyShellWindow(wx.Panel):
"""Python Shell Window"""
- def __init__(self, parent, giface, id=wx.ID_ANY, **kwargs):
+ def __init__(self, parent, giface, id=wx.ID_ANY, simpleEditorHandler=None, **kwargs):
self.parent = parent
self.giface = giface
@@ -53,11 +53,13 @@ class PyShellWindow(wx.Panel):
self.btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
self.btnClear.SetToolTipString(_("Delete all text from the shell"))
- self.btnSimpleEditor = wx.Button(
- self, id=wx.ID_ANY, label=_("Simple &editor"))
- self.btnSimpleEditor.Bind(wx.EVT_BUTTON, self.OnSimpleEditor)
- self.btnSimpleEditor.SetToolTipString(
- _("Open a simple Python code editor"))
+ self.simpleEditorHandler = simpleEditorHandler
+ if simpleEditorHandler:
+ self.btnSimpleEditor = wx.Button(
+ self, id=wx.ID_ANY, label=_("Simple &editor"))
+ self.btnSimpleEditor.Bind(wx.EVT_BUTTON, simpleEditorHandler)
+ self.btnSimpleEditor.SetToolTipString(
+ _("Open a simple Python code editor"))
self._layout()
@@ -71,8 +73,9 @@ class PyShellWindow(wx.Panel):
flag=wx.EXPAND)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
- btnSizer.Add(item=self.btnSimpleEditor, proportion=0,
- flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
+ if self.simpleEditorHandler:
+ btnSizer.Add(item=self.btnSimpleEditor, proportion=0,
+ flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
btnSizer.AddStretchSpacer()
btnSizer.Add(item=self.btnClear, proportion=0,
flag=wx.EXPAND | wx.ALIGN_RIGHT, border=5)
@@ -127,14 +130,3 @@ class PyShellWindow(wx.Panel):
self.shell.clear()
self.shell.showIntro(self.intro)
self.shell.prompt()
-
- def OnSimpleEditor(self, event):
- # import on demand
- from gui_core.pyedit import PyEditFrame
-
- # we don't keep track of them and we don't care about open files
- # there when closing the main GUI
- simpleEditor = PyEditFrame(parent=self, giface=self.giface)
- simpleEditor.SetSize(self.parent.GetSize())
- simpleEditor.CenterOnScreen()
- simpleEditor.Show()
diff --git a/gui/wxpython/lmgr/toolbars.py b/gui/wxpython/lmgr/toolbars.py
index b190035..0c1f000 100644
--- a/gui/wxpython/lmgr/toolbars.py
+++ b/gui/wxpython/lmgr/toolbars.py
@@ -180,7 +180,7 @@ class LMToolsToolbar(BaseToolbar):
('script-load', icons['script-load'],
self.parent.OnRunScript),
('python', icons['python'],
- self.parent.pyshell.OnSimpleEditor),
+ self.parent.OnSimpleEditor),
))
diff --git a/gui/wxpython/nviz/wxnviz.py b/gui/wxpython/nviz/wxnviz.py
index 94f777a..30bd7c8 100644
--- a/gui/wxpython/nviz/wxnviz.py
+++ b/gui/wxpython/nviz/wxnviz.py
@@ -50,6 +50,7 @@ from grass.lib.raster import *
from core.debug import Debug
from core.utils import _, autoCropImageFromFile
+from core.gcmd import EncodeString
import grass.script as grass
log = None
@@ -1832,6 +1833,7 @@ class Nviz(object):
"""
widthOrig = self.width
heightOrig = self.height
+ filename = EncodeString(filename)
self.ResizeWindow(width, height)
GS_clear(Nviz_get_bgcolor(self.data))
diff --git a/gui/wxpython/vdigit/toolbars.py b/gui/wxpython/vdigit/toolbars.py
index a2ec340..f51bbe8 100644
--- a/gui/wxpython/vdigit/toolbars.py
+++ b/gui/wxpython/vdigit/toolbars.py
@@ -817,15 +817,14 @@ class VDigitToolbar(BaseToolbar):
disableAdd=True)
if dlg and dlg.GetName():
- # add layer to map layer tree
- if self._giface.GetLayerTree():
- mapName = dlg.GetName() + '@' + grass.gisenv()['MAPSET']
- self._giface.GetLayerList().AddLayer(
+ # add layer to map layer tree/map display
+ mapName = dlg.GetName() + '@' + grass.gisenv()['MAPSET']
+ self._giface.GetLayerList().AddLayer(
ltype='vector', name=mapName, checked=True,
cmd=['d.vect', 'map=%s' % mapName])
- vectLayers = self.UpdateListOfLayers(updateTool=True)
- selection = vectLayers.index(mapName)
+ vectLayers = self.UpdateListOfLayers(updateTool=True)
+ selection = vectLayers.index(mapName)
# create table ?
if dlg.IsChecked('table'):
diff --git a/gui/wxpython/xml/toolboxes.xml b/gui/wxpython/xml/toolboxes.xml
index 26e654e..76b7634 100644
--- a/gui/wxpython/xml/toolboxes.xml
+++ b/gui/wxpython/xml/toolboxes.xml
@@ -103,6 +103,7 @@
<module-item name="v.buffer">
<label>Buffer vectors</label>
</module-item>
+ <subtoolbox name="PointAnalysis"/>
<subtoolbox name="LidarAnalysis"/>
<subtoolbox name="LinearReferencing"/>
<module-item name="v.distance">
@@ -1232,6 +1233,29 @@
</module-item>
</items>
</toolbox>
+ <toolbox name="PointAnalysis">
+ <label>Point analysis</label>
+ <items>
+ <module-item name="v.outlier">
+ <label>Identify and remove outliers</label>
+ </module-item>
+ <module-item name="v.cluster">
+ <label>Identify point clusters</label>
+ </module-item>
+ <module-item name="v.qcount">
+ <label>Indices for quadrat counts of vector point lists</label>
+ </module-item>
+ <module-item name="v.perturb">
+ <label>Perturb points</label>
+ </module-item>
+ <module-item name="v.kcv">
+ <label>Test/training point sets</label>
+ </module-item>
+ <module-item name="v.normal">
+ <label>Tests for normality for vector points</label>
+ </module-item>
+ </items>
+ </toolbox>
<toolbox name="LidarAnalysis">
<label>Lidar analysis</label>
<items>
diff --git a/imagery/i.atcorr/README b/imagery/i.atcorr/README
index a58cd76..91cba04 100644
--- a/imagery/i.atcorr/README
+++ b/imagery/i.atcorr/README
@@ -13,11 +13,11 @@ Adding new band filters (see also Iwave.h):
one after the other.
Example Lsat TM: (435-250) / 2.5 = 74
- o add filter function to Iwave.cpp, before IWave::equivwl()
+ o run create_iwave.py and add new filter function to Iwave.cpp, before IWave::equivwl()
o add else-if in IWave::parse() in Iwave.cpp
o add print strings in Iwave.cpp
- o add iwave values and signature in Iwave.h
+ o add satellite sensor to Iwave.h
o add to GeomCond.cpp and GeomCond.h
o add to i.atcorr.html
diff --git a/imagery/i.atcorr/create_iwave.py b/imagery/i.atcorr/create_iwave.py
index f99bf9f..51cda5c 100644
--- a/imagery/i.atcorr/create_iwave.py
+++ b/imagery/i.atcorr/create_iwave.py
@@ -32,17 +32,20 @@ from scipy import interpolate
def usage():
"""How to use this..."""
print "create_iwave.py <csv file>"
- print "Generate filter function IWave.cpp template from csv file"
- print "csv file must have wl response for each band in each column"
- print "first line must be a header with wl followed by band names"
- print "following lines will be the data."
- print "If response is null, leave empty in csv file. Ex.:"
+ print
+ print "Generates filter function template for iwave.cpp from csv file. Note:"
+ print "- csv file must have wl response for each band in each column"
+ print "- first line must be a header with wl followed by band names"
+ print "- all following lines will be the data."
+ print "If spectral response is null, leave field empty in csv file. Example:"
+ print
print "WL(nm),band 1,band 2,band 3,band 4"
print "455,0.93,,,"
print "485,0.94,0.00,,"
print "545,0.00,0.87,0.00,"
- print "Program will interpolate filter function to 2.5 nm steps"
- print "and output a cpp template file in the IWave format"
+ print
+ print "This script will interpolate the filter functions to 2.5 nm steps"
+ print "and output a cpp template file in the IWave format to be added to iwave.cpp"
def read_input(csvfile):
"""
@@ -51,29 +54,30 @@ def read_input(csvfile):
should be a .csv file with the values
of the filter function for each band in the sensor
one column for band
- first line must have a header with sensor band name
+ first line must have a header with sensor band names
first column is wavelength
+ values are those of the discrete band filter functions
"""
infile = open(csvfile, 'r')
-
+
# get number of bands and band names
bands = infile.readline().split(',')
bands.remove(bands[0])
bands[-1] = bands[-1].strip()
-
+ print " > Number of bands found: %d" % len(bands)
infile.close()
-
+
# create converter dictionary for import
# fix nodata or \n
conv = {}
for b in range(len(bands)):
conv[b+1] = lambda s: float(s or -99)
-
+
values = np.loadtxt(csvfile, delimiter=',', skiprows=1, converters = conv)
-
+
return (bands, values)
-def interpolate_band(values):
+def interpolate_band(values, step = 2.5):
"""
Receive wavelength and response for one band
interpolate at 2.5 nm steps
@@ -84,19 +88,47 @@ def interpolate_band(values):
# These 2 lines select the subarray
# remove nodata (-99) lines in values array
# where response is nodata?
+
w = values[:,1] >= 0
response = values[w]
-
+
+ wavelengths = response[:,0] # 1st column of input array
+ spectral_response = response[:,1] # 2nd column
+ assert len(wavelengths) == len(spectral_response), "Number of wavelength slots and spectral responses are not equal!"
# interpolating
- f = interpolate.interp1d(response[:,0],response[:,1])
-
- filter_f = f(np.arange(response[0,0], response[-1,0] + 2.5, 2.5))
-
+ f = interpolate.interp1d(wavelengths, spectral_response)
+ start = wavelengths[0]
+
+ # considering last entry for np.arange
+ input_step = wavelengths[-1] - wavelengths[-2]
+
+ # if wavelength step in input data is 1 nm
+ # print " > Wavelength step in input data is", input_step, "nm"
+ if input_step == 1:
+ addendum = 0
+ # print " i No need to modify the stop value for the np.arrange function."
+
+ # what if input step != 1 and input step != 2.5?
+ else:
+ addendum = step
+ # print " ! Wavelength step in input data is nor 1 nm, neither 2.5 nm.",
+ # print "Internally setting the \"stop\" value for the np.arrange()",
+ # print "function so as to not exceed the end value", wavelengths[-1],
+ # print "of the open half ended range."
+
+ stop = wavelengths[-1] + addendum
+
+ filter_f = f(np.arange(start, stop, step))
+
+ # how many spectral responses?
+ expected = np.ceil((stop - start) / step)
+ assert len(filter_f) == expected, "Number of interpolated spectral responses not equal to expected number of interpolations"
+
# convert limits from nanometers to micrometers
- lowerlimit = response[0,0]/1000
- upperlimit = response[-1,0]/1000
-
+ lowerlimit = wavelengths[0]/1000
+ upperlimit = wavelengths[-1]/1000
+
return(filter_f, (lowerlimit, upperlimit))
def plot_filter(values):
@@ -228,7 +260,8 @@ def main():
# getting sensor name from full csv file name
sensor = os.path.splitext(os.path.basename(inputfile))[0]
- print "Getting sensor name from csv file: %s" % (sensor)
+ print
+ print " > Getting sensor name from csv file: %s" % (sensor)
# getting data from file
bands, values = read_input(inputfile)
@@ -236,9 +269,10 @@ def main():
# writing file in same folder of input file
write_cpp(bands, values, sensor, os.path.dirname(inputfile))
- print "Filter function written to %s" % (sensor+"_cpp_template.txt")
- print "Please check file for possible errors before inserting into IWave.cpp"
- print "Don't forget to add necessary data to IWave.h"
+ print " > Filter functions exported to %s" % ("sensors_csv/"+sensor+"_cpp_template.txt")
+ print " > Please check this file for possible errors before inserting the code into file iwave.cpp"
+ print " > Don't forget to add the necessary data to the files iwave.h, geomcond.h, geomcond.cpp, and to i.atcorr.html"
+ print
return
diff --git a/imagery/i.atcorr/geomcond.h b/imagery/i.atcorr/geomcond.h
index 318ecef..dfa48dc 100644
--- a/imagery/i.atcorr/geomcond.h
+++ b/imagery/i.atcorr/geomcond.h
@@ -61,7 +61,7 @@
/* c */
/* 16 worldview2 * enter month,day,hh.ddd,long.,lat.c */
/* c */
-/* 17 quickbird * enter month,day,hh.ddd,long.,lat. c */
+/* 17 quickbird2 * enter month,day,hh.ddd,long.,lat. c */
/* c */
/* 18 Landsat 8 * enter month,day,hh.ddd,long.,lat. c */
/* c */
diff --git a/imagery/i.atcorr/iwave.cpp b/imagery/i.atcorr/iwave.cpp
index ef661be..1afdeab 100644
--- a/imagery/i.atcorr/iwave.cpp
+++ b/imagery/i.atcorr/iwave.cpp
@@ -2872,94 +2872,231 @@ void IWave::worldview2(int iwa)
void IWave::quickbird2(int iwa)
{
-
- /* QuickBird Pan of quickbird2 */
- static const float sr1[65] = {
- 300.0000, 312.5000, 325.0000, 337.5000, 350.0000, 362.5000, 375.0000, 387.5000,
- 400.0000, 412.5000, 425.0000, 437.5000, 450.0000, 462.5000, 475.0000, 487.5000,
- 500.0000, 512.5000, 525.0000, 537.5000, 550.0000, 562.5000, 575.0000, 587.5000,
- 600.0000, 612.5000, 625.0000, 637.5000, 650.0000, 662.5000, 675.0000, 687.5000,
- 700.0000, 712.5000, 725.0000, 737.5000, 750.0000, 762.5000, 775.0000, 787.5000,
- 800.0000, 812.5000, 825.0000, 837.5000, 850.0000, 862.5000, 875.0000, 887.5000,
- 900.0000, 912.5000, 925.0000, 937.5000, 950.0000, 962.5000, 975.0000, 987.5000,
- 1000.0000, 1012.5000, 1025.0000, 1037.5000, 1050.0000, 1062.5000, 1075.0000, 1087.5000,
- 1100.0000
- };
-
- /* QuickBird Blue of quickbird2 */
- static const float sr2[65] = {
- .0000, .0000, .0000, .0000, .0014, .0010, .0020, .0138,
- .0362, .0758, .1219, .1789, .2198, .2854, .3364, .3579,
- .3781, .4276, .4982, .5925, .7051, .8105, .8911, .9426,
- .9598, .9922, .9876, .9573, .9183, .8831, .8893, .8848,
- .8888, .8677, .8625, .8897, .9295, .9130, .9039, .8761,
- .8457, .8582, .8339, .8526, .8394, .7850, .7342, .6788,
- .6186, .5832, .4969, .4305, .3738, .3035, .2567, .2162,
- .1776, .1421, .1085, .0773, .0548, .0050, .0000, .0000,
- .0000
- };
-
- /* QuickBird Green of quickbird2 */
- static const float sr3[65] = {
- .0000, .0000, .0010, .0037, .0053, .0030, .0013, .0023,
- .0025, .0053, .0284, .2164, .6299, .8176, .9178, .9801,
- .9179, .4787, .1592, .0663, .0293, .0126, .0126, .0098,
- .0098, .0091, .0036, .0025, .0028, .0030, .0089, .0256,
- .0083, .0086, .0091, .0028, .0031, .0034, .0036, .0033,
- .0030, .0035, .0040, .0042, .0048, .0057, .0052, .0052,
- .0068, .0101, .0093, .0056, .0035, .0019, .0014, .0012,
- .0011, .0012, .0015, .0015, .0012, .0000, .0000, .0000,
- .0000
- };
-
- /* QuickBird Red of quickbird2 */
- static const float sr4[65] = {
- .0000, .0000, .0000, .0000, .0031, .0023, .0014, .0012,
- .0012, .0013, .0023, .0046, .0178, .0356, .0982, .2739,
- .5277, .8005, .8705, .9640, .9934, .9733, .9652, .7230,
- .3124, .1139, .0365, .0268, .0242, .0140, .0132, .0076,
- .0032, .0035, .0076, .0047, .0022, .0029, .0034, .0041,
- .0038, .0031, .0031, .0035, .0051, .0084, .0090, .0078,
- .0076, .0081, .0067, .0043, .0027, .0016, .0013, .0010,
- .0008, .0009, .0013, .0010, .0009, .0000, .0000, .0000,
- .0000
- };
-
- /* QuickBird NIR of quickbird2 */
- static const float sr5[65] = {
- .0000, .0000, .0000, .0000, .0037, .0018, .0011, .0009,
- .0007, .0013, .0010, .0024, .0029, .0032, .0032, .0023,
- .0031, .0036, .0053, .0065, .0078, .0110, .0177, .0399,
- .0872, .2675, .6620, .8976, .9798, .9961, .8726, .5119,
- .1651, .0417, .0201, .0205, .0095, .0048, .0045, .0063,
- .0045, .0026, .0025, .0025, .0025, .0024, .0022, .0019,
- .0021, .0028, .0015, .0010, .0010, .0008, .0007, .0006,
- .0008, .0007, .0008, .0009, .0008, .0000, .0000, .0000,
- .0000
- };
-
- static const float wli[5] = {0.001, 0.001, 0.001, 0.001, 0.001};
- static const float wls[5] = {0.161, 0.161, 0.161, 0.161, 0.161};
-
- ffu.wlinf = (float)wli[iwa-1];
- ffu.wlsup = (float)wls[iwa-1];
-
- int i;
- for(i = 0; i < 1501; i++) ffu.s[i] = 0;
-
- switch(iwa)
- {
- case 1: for(i = 0; i < 65; i++) ffu.s[-99+i] = sr1[i];
- break;
- case 2: for(i = 0; i < 65; i++) ffu.s[-99+i] = sr2[i];
- break;
- case 3: for(i = 0; i < 65; i++) ffu.s[-99+i] = sr3[i];
- break;
- case 4: for(i = 0; i < 65; i++) ffu.s[-99+i] = sr4[i];
- break;
- case 5: for(i = 0; i < 65; i++) ffu.s[-99+i] = sr5[i];
- break;
- }
+
+ /* pan of quickbird2 */
+ static const float sr1[285] = {
+ .0014, .0013, .0012, .0011, .0011, .0010, .0009, .0010,
+ .0012, .0016, .0020, .0044, .0069, .0089, .0109, .0138,
+ .0167, .0213, .0259, .0311, .0362, .0434, .0506, .0588,
+ .0669, .0758, .0846, .0939, .1032, .1125, .1219, .1334,
+ .1450, .1567, .1684, .1789, .1895, .2011, .2127, .2163,
+ .2198, .2392, .2586, .2669, .2753, .2854, .2955, .3055,
+ .3154, .3259, .3364, .3410, .3456, .3501, .3546, .3579,
+ .3611, .3648, .3685, .3733, .3781, .3875, .3969, .4055,
+ .4141, .4276, .4410, .4543, .4676, .4829, .4982, .5167,
+ .5352, .5532, .5712, .5925, .6137, .6382, .6627, .6839,
+ .7051, .7275, .7499, .7705, .7910, .8105, .8301, .8465,
+ .8629, .8770, .8911, .9081, .9251, .9293, .9335, .9426,
+ .9518, .9570, .9621, .9610, .9598, .9753, .9907, .9941,
+ .9975, .9922, .9869, .9935, 1.0000, .9938, .9876, .9877,
+ .9878, .9770, .9662, .9573, .9483, .9340, .9197, .9190,
+ .9183, .9063, .8944, .8912, .8880, .8831, .8781, .8865,
+ .8949, .8921, .8893, .8858, .8823, .8869, .8916, .8848,
+ .8780, .8879, .8978, .8933, .8888, .8801, .8714, .8690,
+ .8667, .8677, .8687, .8699, .8712, .8668, .8625, .8718,
+ .8810, .8814, .8818, .8897, .8976, .9024, .9072, .9183,
+ .9295, .9311, .9326, .9198, .9070, .9130, .9191, .9173,
+ .9155, .9097, .9039, .8988, .8936, .8871, .8805, .8761,
+ .8717, .8605, .8493, .8475, .8457, .8505, .8553, .8568,
+ .8582, .8582, .8583, .8627, .8671, .8505, .8339, .8390,
+ .8440, .8470, .8500, .8526, .8553, .8447, .8341, .8368,
+ .8394, .8235, .8076, .8091, .8106, .7850, .7594, .7616,
+ .7638, .7490, .7342, .7204, .7066, .7003, .6941, .6788,
+ .6634, .6589, .6545, .6365, .6186, .6094, .6003, .5961,
+ .5919, .5832, .5744, .5527, .5309, .5139, .4969, .4883,
+ .4798, .4630, .4463, .4305, .4147, .4097, .4048, .3893,
+ .3738, .3593, .3448, .3283, .3118, .3035, .2952, .2840,
+ .2729, .2648, .2567, .2498, .2428, .2322, .2216, .2162,
+ .2107, .2039, .1971, .1874, .1776, .1703, .1630, .1557,
+ .1485, .1421, .1358, .1299, .1240, .1162, .1085, .1020,
+ .0954, .0893, .0831, .0773, .0715, .0675, .0634, .0591,
+ .0548, .0512, .0476, .0288, .0101
+ };
+
+ /* blue of quickbird2 */
+ static const float sr2[291] = {
+ .0010, .0015, .0021, .0026, .0031, .0037, .0042, .0044,
+ .0045, .0049, .0053, .0047, .0041, .0037, .0033, .0030,
+ .0027, .0025, .0023, .0018, .0013, .0015, .0018, .0020,
+ .0022, .0023, .0024, .0025, .0026, .0025, .0025, .0027,
+ .0029, .0035, .0040, .0053, .0066, .0098, .0131, .0208,
+ .0284, .0483, .0681, .1116, .1552, .2164, .2776, .3544,
+ .4313, .5306, .6299, .6770, .7241, .7577, .7914, .8176,
+ .8439, .8667, .8896, .9037, .9178, .9235, .9293, .9447,
+ .9602, .9801, 1.0000, .9958, .9916, .9548, .9179, .8452,
+ .7724, .6729, .5734, .4787, .3840, .3247, .2653, .2123,
+ .1592, .1204, .0816, .0754, .0692, .0663, .0633, .0551,
+ .0469, .0381, .0293, .0235, .0176, .0152, .0127, .0126,
+ .0125, .0127, .0129, .0128, .0126, .0119, .0111, .0106,
+ .0101, .0098, .0096, .0094, .0093, .0095, .0098, .0102,
+ .0106, .0105, .0104, .0091, .0079, .0066, .0054, .0045,
+ .0036, .0031, .0026, .0026, .0025, .0025, .0025, .0025,
+ .0025, .0027, .0028, .0027, .0027, .0027, .0027, .0030,
+ .0033, .0039, .0044, .0067, .0089, .0125, .0162, .0202,
+ .0242, .0256, .0271, .0231, .0191, .0137, .0083, .0070,
+ .0056, .0063, .0070, .0086, .0102, .0111, .0121, .0106,
+ .0091, .0064, .0037, .0032, .0027, .0028, .0029, .0028,
+ .0027, .0029, .0031, .0032, .0032, .0034, .0036, .0034,
+ .0033, .0034, .0036, .0036, .0036, .0034, .0031, .0032,
+ .0034, .0033, .0032, .0031, .0031, .0031, .0030, .0031,
+ .0033, .0033, .0033, .0035, .0036, .0036, .0037, .0039,
+ .0040, .0041, .0041, .0042, .0043, .0042, .0042, .0046,
+ .0050, .0049, .0048, .0053, .0059, .0058, .0057, .0057,
+ .0056, .0055, .0053, .0053, .0052, .0052, .0052, .0052,
+ .0052, .0052, .0053, .0055, .0057, .0063, .0068, .0075,
+ .0083, .0090, .0098, .0101, .0105, .0107, .0109, .0101,
+ .0093, .0085, .0076, .0069, .0061, .0056, .0050, .0046,
+ .0042, .0039, .0035, .0032, .0029, .0025, .0021, .0019,
+ .0017, .0016, .0016, .0015, .0014, .0013, .0012, .0012,
+ .0012, .0012, .0012, .0012, .0011, .0011, .0011, .0011,
+ .0010, .0011, .0011, .0012, .0012, .0012, .0012, .0013,
+ .0015, .0016, .0018, .0017, .0015, .0015, .0015, .0015,
+ .0014, .0013, .0012
+ };
+
+ /* green of quickbird2 */
+ static const float sr3[281] = {
+ .0031, .0036, .0040, .0031, .0022, .0023, .0023, .0019,
+ .0015, .0015, .0014, .0011, .0008, .0010, .0011, .0012,
+ .0012, .0012, .0012, .0012, .0012, .0012, .0011, .0012,
+ .0012, .0013, .0014, .0016, .0019, .0021, .0023, .0026,
+ .0028, .0033, .0037, .0046, .0055, .0077, .0098, .0138,
+ .0178, .0206, .0234, .0268, .0301, .0356, .0412, .0504,
+ .0597, .0789, .0982, .1274, .1566, .1924, .2282, .2739,
+ .3196, .3686, .4175, .4726, .5277, .5928, .6579, .7138,
+ .7698, .8005, .8312, .8378, .8445, .8575, .8705, .8893,
+ .9082, .9271, .9460, .9640, .9819, .9910, 1.0000, .9967,
+ .9934, .9876, .9818, .9755, .9691, .9733, .9774, .9822,
+ .9869, .9761, .9652, .9316, .8979, .8445, .7910, .7230,
+ .6551, .5687, .4822, .3973, .3124, .2579, .2033, .1706,
+ .1378, .1139, .0901, .0729, .0557, .0461, .0365, .0322,
+ .0278, .0270, .0262, .0268, .0274, .0275, .0275, .0259,
+ .0242, .0214, .0186, .0167, .0148, .0140, .0132, .0132,
+ .0132, .0132, .0132, .0124, .0116, .0104, .0092, .0076,
+ .0061, .0052, .0043, .0038, .0032, .0030, .0029, .0029,
+ .0029, .0035, .0040, .0051, .0062, .0069, .0076, .0076,
+ .0076, .0067, .0057, .0047, .0037, .0032, .0026, .0024,
+ .0022, .0024, .0026, .0028, .0030, .0029, .0028, .0030,
+ .0031, .0032, .0034, .0037, .0040, .0039, .0038, .0041,
+ .0044, .0043, .0041, .0040, .0038, .0036, .0035, .0034,
+ .0032, .0031, .0030, .0030, .0030, .0031, .0031, .0032,
+ .0032, .0033, .0033, .0035, .0037, .0041, .0044, .0048,
+ .0051, .0060, .0069, .0073, .0078, .0084, .0091, .0091,
+ .0092, .0091, .0090, .0088, .0086, .0083, .0080, .0078,
+ .0076, .0075, .0075, .0075, .0076, .0077, .0078, .0080,
+ .0081, .0081, .0082, .0080, .0078, .0072, .0067, .0061,
+ .0056, .0051, .0046, .0043, .0039, .0035, .0031, .0029,
+ .0027, .0023, .0020, .0018, .0017, .0016, .0015, .0014,
+ .0012, .0012, .0013, .0012, .0011, .0010, .0009, .0010,
+ .0010, .0009, .0009, .0008, .0008, .0008, .0009, .0009,
+ .0009, .0009, .0010, .0010, .0011, .0012, .0013, .0012,
+ .0011, .0011, .0011, .0010, .0009, .0009, .0010, .0009,
+ .0009
+ };
+
+ /* red of quickbird2 */
+ static const float sr4[281] = {
+ .0037, .0031, .0024, .0020, .0016, .0018, .0019, .0016,
+ .0012, .0011, .0011, .0010, .0009, .0009, .0010, .0009,
+ .0009, .0011, .0013, .0010, .0007, .0009, .0012, .0012,
+ .0013, .0013, .0013, .0012, .0012, .0011, .0010, .0013,
+ .0015, .0018, .0021, .0024, .0028, .0029, .0031, .0030,
+ .0029, .0029, .0028, .0029, .0030, .0032, .0035, .0036,
+ .0037, .0034, .0032, .0026, .0021, .0021, .0022, .0023,
+ .0024, .0025, .0027, .0029, .0031, .0032, .0033, .0034,
+ .0035, .0036, .0037, .0041, .0046, .0049, .0053, .0056,
+ .0060, .0061, .0063, .0065, .0066, .0068, .0069, .0073,
+ .0078, .0084, .0090, .0096, .0102, .0110, .0118, .0128,
+ .0139, .0158, .0177, .0207, .0238, .0286, .0334, .0399,
+ .0464, .0548, .0631, .0751, .0872, .1077, .1281, .1666,
+ .2050, .2675, .3301, .4130, .4960, .5790, .6620, .7337,
+ .8054, .8447, .8840, .8976, .9112, .9265, .9418, .9608,
+ .9798, .9878, .9958, .9979, 1.0000, .9961, .9923, .9723,
+ .9524, .9125, .8726, .8128, .7530, .6767, .6004, .5119,
+ .4235, .3520, .2806, .2228, .1651, .1304, .0957, .0744,
+ .0531, .0417, .0302, .0261, .0220, .0210, .0201, .0204,
+ .0207, .0211, .0215, .0205, .0196, .0172, .0148, .0121,
+ .0095, .0081, .0066, .0058, .0050, .0048, .0045, .0043,
+ .0042, .0043, .0045, .0048, .0051, .0055, .0060, .0063,
+ .0067, .0064, .0062, .0053, .0045, .0038, .0031, .0029,
+ .0027, .0026, .0024, .0025, .0025, .0025, .0025, .0024,
+ .0024, .0025, .0026, .0025, .0024, .0025, .0026, .0026,
+ .0025, .0026, .0026, .0026, .0025, .0024, .0023, .0024,
+ .0024, .0023, .0022, .0022, .0021, .0021, .0020, .0019,
+ .0019, .0019, .0020, .0021, .0021, .0023, .0025, .0026,
+ .0028, .0028, .0028, .0027, .0025, .0020, .0015, .0013,
+ .0012, .0011, .0011, .0010, .0010, .0010, .0010, .0010,
+ .0010, .0009, .0008, .0008, .0008, .0008, .0007, .0007,
+ .0007, .0007, .0007, .0007, .0007, .0006, .0006, .0006,
+ .0006, .0007, .0007, .0007, .0008, .0007, .0007, .0007,
+ .0006, .0007, .0009, .0009, .0009, .0008, .0008, .0008,
+ .0008, .0009, .0009, .0009, .0009, .0008, .0006, .0007,
+ .0008
+ };
+
+ /* nir of quickbird2 */
+ static const float sr5[291] = {
+ .0014, .0021, .0029, .0036, .0044, .0051, .0059, .0061,
+ .0063, .0062, .0060, .0057, .0054, .0045, .0035, .0028,
+ .0021, .0023, .0024, .0021, .0017, .0020, .0023, .0021,
+ .0019, .0017, .0016, .0018, .0019, .0019, .0018, .0017,
+ .0015, .0015, .0015, .0017, .0019, .0018, .0017, .0021,
+ .0024, .0025, .0025, .0028, .0031, .0036, .0040, .0044,
+ .0047, .0047, .0047, .0048, .0049, .0045, .0042, .0043,
+ .0044, .0046, .0048, .0050, .0052, .0054, .0056, .0054,
+ .0052, .0047, .0042, .0036, .0030, .0028, .0026, .0026,
+ .0026, .0026, .0025, .0027, .0029, .0027, .0026, .0030,
+ .0034, .0043, .0053, .0066, .0079, .0089, .0099, .0101,
+ .0102, .0090, .0079, .0064, .0049, .0049, .0048, .0056,
+ .0063, .0070, .0077, .0078, .0079, .0072, .0065, .0054,
+ .0044, .0041, .0038, .0038, .0037, .0037, .0036, .0036,
+ .0036, .0038, .0039, .0042, .0045, .0047, .0049, .0053,
+ .0057, .0059, .0061, .0064, .0068, .0070, .0073, .0079,
+ .0086, .0093, .0100, .0106, .0112, .0117, .0122, .0126,
+ .0129, .0132, .0135, .0140, .0144, .0150, .0156, .0164,
+ .0172, .0184, .0196, .0218, .0241, .0268, .0294, .0319,
+ .0343, .0375, .0407, .0448, .0490, .0545, .0599, .0664,
+ .0729, .0817, .0905, .1050, .1195, .1410, .1625, .2024,
+ .2424, .3015, .3606, .4268, .4930, .5640, .6350, .7166,
+ .7983, .8726, .9469, .9735, 1.0000, .9986, .9971, .9837,
+ .9702, .9526, .9350, .9179, .9009, .8853, .8698, .8606,
+ .8515, .8449, .8382, .8352, .8322, .8289, .8256, .8230,
+ .8204, .8137, .8070, .7957, .7844, .7669, .7495, .7267,
+ .7040, .6911, .6782, .6638, .6494, .6313, .6132, .5900,
+ .5669, .5493, .5317, .5117, .4917, .4644, .4371, .3943,
+ .3515, .3134, .2753, .2485, .2216, .1910, .1604, .1385,
+ .1166, .1003, .0840, .0756, .0672, .0540, .0409, .0307,
+ .0205, .0170, .0135, .0118, .0100, .0089, .0078, .0071,
+ .0064, .0059, .0054, .0050, .0046, .0040, .0035, .0031,
+ .0028, .0026, .0024, .0023, .0022, .0022, .0021, .0020,
+ .0019, .0018, .0018, .0019, .0019, .0018, .0016, .0017,
+ .0017, .0017, .0017, .0019, .0020, .0021, .0021, .0021,
+ .0020, .0020, .0019, .0018, .0017, .0018, .0018, .0018,
+ .0017, .0018, .0020
+ };
+
+ static const float wli[5] = {0.350, 0.325, 0.350, 0.350, 0.325};
+ static const float wls[5] = {1.060, 1.050, 1.050, 1.050, 1.050};
+
+ ffu.wlinf = (float)wli[iwa-1];
+ ffu.wlsup = (float)wls[iwa-1];
+
+ int i;
+ for(i = 0; i < 1501; i++) ffu.s[i] = 0;
+
+ switch(iwa)
+ {
+ case 1: for(i = 0; i < 285; i++) ffu.s[40+i] = sr1[i];
+ break;
+ case 2: for(i = 0; i < 291; i++) ffu.s[30+i] = sr2[i];
+ break;
+ case 3: for(i = 0; i < 281; i++) ffu.s[40+i] = sr3[i];
+ break;
+ case 4: for(i = 0; i < 281; i++) ffu.s[40+i] = sr4[i];
+ break;
+ case 5: for(i = 0; i < 291; i++) ffu.s[30+i] = sr5[i];
+ break;
+ }
}
void IWave::landsat_8(int iwa)
diff --git a/imagery/i.atcorr/sensors_csv/quickbird2.csv b/imagery/i.atcorr/sensors_csv/quickbird2.csv
new file mode 100644
index 0000000..e642f83
--- /dev/null
+++ b/imagery/i.atcorr/sensors_csv/quickbird2.csv
@@ -0,0 +1,162 @@
+nm,pan,blue,green,red,nir
+300,,,,,
+305,,,,,
+310,,,,,
+315,,,,,
+320,,,,,
+325,,0.0010102,,,0.0014092
+330,,0.0020510,,,0.0028608
+335,,0.0031232,,,0.0043557
+340,,0.0042264,,,0.0058950
+345,,0.0045373,,,0.0063290
+350,0.0014033,0.0053218,0.0030856,0.0037148,0.0060022
+355,0.0011790,0.0040570,0.0040267,0.0024430,0.0053844
+360,0.0011042,0.0032654,0.0021878,0.0016479,0.0035169
+365,0.0009189,0.0027029,0.0023189,0.0019254,0.0021084
+370,0.0011777,0.0023032,0.0014787,0.0011810,0.0024355
+375,0.0020335,0.0012599,0.0014276,0.0010728,0.0017002
+380,0.0068664,0.0018015,0.0008263,0.0009032,0.0022714
+385,0.0108822,0.0022036,0.0011403,0.0009703,0.0018699
+390,0.0167311,0.0023949,0.0012422,0.0009224,0.0016207
+395,0.0259192,0.0025521,0.0011512,0.0013128,0.0019495
+400,0.0361999,0.0024719,0.0012394,0.0006770,0.0018310
+405,0.0506315,0.0029075,0.0011408,0.0012157,0.0015098
+410,0.0669468,0.0040027,0.0011869,0.0012567,0.0014986
+415,0.0845848,0.0065597,0.0013912,0.0013207,0.0019432
+420,0.1031961,0.0131362,0.0018941,0.0011522,0.0017185
+425,0.1218670,0.0283802,0.0023351,0.0009955,0.0024463
+430,0.1449896,0.0681350,0.0028135,0.0015190,0.0025377
+435,0.1683812,0.1551567,0.0037063,0.0020873,0.0031280
+440,0.1895051,0.2775976,0.0055455,0.0028027,0.0040500
+445,0.2127200,0.4312732,0.0098195,0.0030937,0.0047331
+450,0.2198261,0.6299497,0.0178466,0.0028875,0.0047484
+455,0.2585699,0.7240532,0.0234254,0.0028213,0.0049004
+460,0.2752517,0.7913620,0.0300974,0.0029808,0.0041819
+465,0.2955355,0.8438716,0.0411627,0.0034599,0.0044438
+470,0.3153968,0.8895741,0.0596683,0.0036881,0.0047788
+475,0.3364159,0.9177772,0.0981647,0.0031561,0.0052347
+480,0.3456366,0.9293006,0.1566285,0.0020766,0.0055566
+485,0.3546477,0.9601538,0.2281920,0.0021746,0.0052475
+490,0.3611199,1.0000000,0.3196465,0.0023823,0.0041908
+495,0.3684864,0.9916359,0.4174751,0.0026856,0.0029904
+500,0.3781246,0.9178985,0.5276728,0.0030709,0.0026452
+505,0.3969294,0.7724284,0.6578772,0.0032914,0.0025776
+510,0.4141351,0.5734303,0.7697888,0.0035025,0.0025379
+515,0.4410028,0.3840363,0.8311977,0.0037279,0.0028625
+520,0.4676101,0.2653482,0.8444885,0.0045702,0.0025801
+525,0.4981964,0.1591609,0.8704719,0.0053096,0.0033657
+530,0.5351925,0.0816323,0.9081774,0.0059502,0.0052825
+535,0.5711692,0.0692367,0.9459902,0.0063230,0.0078701
+540,0.6137484,0.0633006,0.9819400,0.0065926,0.0098718
+545,0.6627288,0.0469325,1.0000000,0.0069161,0.0102328
+550,0.7050662,0.0293462,0.9933748,0.0077701,0.0078634
+555,0.7499391,0.0176386,0.9818187,0.0089839,0.0048711
+560,0.7909615,0.0127288,0.9691108,0.0102276,0.0048416
+565,0.8301127,0.0124551,0.9774484,0.0117892,0.0063449
+570,0.8628948,0.0128916,0.9868932,0.0138696,0.0076518
+575,0.8910690,0.0126216,0.9652411,0.0176781,0.0079247
+580,0.9250918,0.0111146,0.8979307,0.0237713,0.0064695
+585,0.9334622,0.0100924,0.7909738,0.0334155,0.0043683
+590,0.9518124,0.0095605,0.6550701,0.0464361,0.0037961
+595,0.9620912,0.0092837,0.4822322,0.0630683,0.0037400
+600,0.9598312,0.0097672,0.3124203,0.0871887,0.0035986
+605,0.9907370,0.0106390,0.2033228,0.1281145,0.0036339
+610,0.9974814,0.0103876,0.1378029,0.2050211,0.0039231
+615,0.9869457,0.0078934,0.0900831,0.3300581,0.0045064
+620,1.0000000,0.0053712,0.0557136,0.4959814,0.0048696
+625,0.9875694,0.0035571,0.0364832,0.6620421,0.0056710
+630,0.9878027,0.0026321,0.0278317,0.8053931,0.0060849
+635,0.9662325,0.0025031,0.0261576,0.8839703,0.0067965
+640,0.9483100,0.0024856,0.0273810,0.9112235,0.0072915
+645,0.9197402,0.0025446,0.0275229,0.9418237,0.0085610
+650,0.9183001,0.0027851,0.0241831,0.9798105,0.0100233
+655,0.8943635,0.0026625,0.0185783,0.9958087,0.0112326
+660,0.8880265,0.0027425,0.0147736,1.0000000,0.0122499
+665,0.8781178,0.0032880,0.0131941,0.9922692,0.0129368
+670,0.8949128,0.0044459,0.0132372,0.9523635,0.0135234
+675,0.8892688,0.0088555,0.0131760,0.8725920,0.0143963
+680,0.8822929,0.0161798,0.0116350,0.7530428,0.0155814
+685,0.8915592,0.0241669,0.0091548,0.6004284,0.0172409
+690,0.8780062,0.0270878,0.0060522,0.4234650,0.0195995
+695,0.8977610,0.0190696,0.0043438,0.2806013,0.0240677
+700,0.8888378,0.0083030,0.0032056,0.1650672,0.0294353
+705,0.8713531,0.0056106,0.0028550,0.0957075,0.0343437
+710,0.8667318,0.0069981,0.0028712,0.0531459,0.0406824
+715,0.8687264,0.0101687,0.0040500,0.0302447,0.0489796
+720,0.8711503,0.0120955,0.0061748,0.0219501,0.0599240
+725,0.8624942,0.0091411,0.0076270,0.0200762,0.0728935
+730,0.8810285,0.0036613,0.0076368,0.0207290,0.0905184
+735,0.8818450,0.0026953,0.0056925,0.0214752,0.1194788
+740,0.8976004,0.0029290,0.0037252,0.0196225,0.1624776
+745,0.9071913,0.0026597,0.0026429,0.0147560,0.2423822
+750,0.9295069,0.0030559,0.0021649,0.0095228,0.3605570
+755,0.9326408,0.0032472,0.0026131,0.0066320,0.4930289
+760,0.9069580,0.0035759,0.0030395,0.0050248,0.6349644
+765,0.9191317,0.0032778,0.0028270,0.0045135,0.7983151
+770,0.9155077,0.0036130,0.0030903,0.0041632,0.9469408
+775,0.9038986,0.0036439,0.0033719,0.0045270,1.0000000
+780,0.8936451,0.0030898,0.0039527,0.0050636,0.9971452
+785,0.8805316,0.0033737,0.0038226,0.0060180,0.9701849
+790,0.8717182,0.0031601,0.0043911,0.0066649,0.9349833
+795,0.8492843,0.0031390,0.0041374,0.0062010,0.9008774
+800,0.8457008,0.0029854,0.0038086,0.0044550,0.8697601
+805,0.8553407,0.0032930,0.0034867,0.0030630,0.8515358
+810,0.8581889,0.0033344,0.0032214,0.0027053,0.8382033
+815,0.8582515,0.0035658,0.0030436,0.0024349,0.8322304
+820,0.8671206,0.0037282,0.0030211,0.0024710,0.8256435
+825,0.8339193,0.0039858,0.0031200,0.0024841,0.8203544
+830,0.8440240,0.0041173,0.0032130,0.0023666,0.8069696
+835,0.8499554,0.0042771,0.0033022,0.0026162,0.7843730
+840,0.8553289,0.0041750,0.0036992,0.0024444,0.7494696
+845,0.8341391,0.0049540,0.0044282,0.0026118,0.7040130
+850,0.8393621,0.0047827,0.0050802,0.0025035,0.6782487
+855,0.8075909,0.0058532,0.0068986,0.0025965,0.6493954
+860,0.8105692,0.0057233,0.0077976,0.0025047,0.6131506
+865,0.7594286,0.0056168,0.0090757,0.0023465,0.5668747
+870,0.7638184,0.0053032,0.0092009,0.0023744,0.5316688
+875,0.7341904,0.0052007,0.0090439,0.0022134,0.4916918
+880,0.7065537,0.0051649,0.0086195,0.0021206,0.4371382
+885,0.6941130,0.0051542,0.0079798,0.0019849,0.3515431
+890,0.6634336,0.0052812,0.0076004,0.0018715,0.2753125
+895,0.6544530,0.0056987,0.0074959,0.0020090,0.2215915
+900,0.6185557,0.0068015,0.0076005,0.0021329,0.1604435
+905,0.6002698,0.0082558,0.0078219,0.0024529,0.1165635
+910,0.5918959,0.0097551,0.0081012,0.0027978,0.0839996
+915,0.5744231,0.0105366,0.0081533,0.0027873,0.0671801
+920,0.5309092,0.0109482,0.0077694,0.0025152,0.0408550
+925,0.4968949,0.0093236,0.0067075,0.0015319,0.0204820
+930,0.4797736,0.0076207,0.0055921,0.0011564,0.0135345
+935,0.4463188,0.0061257,0.0046417,0.0010802,0.0100320
+940,0.4147031,0.0050368,0.0038590,0.0009794,0.0077714
+945,0.4047691,0.0042263,0.0030915,0.0009748,0.0063828
+950,0.3738311,0.0035359,0.0026681,0.0010349,0.0053660
+955,0.3448050,0.0029168,0.0020248,0.0008131,0.0045550
+960,0.3117545,0.0021153,0.0016715,0.0008282,0.0034837
+965,0.2951745,0.0017263,0.0014821,0.0007164,0.0028074
+970,0.2728967,0.0015684,0.0012420,0.0006983,0.0024346
+975,0.2567351,0.0013848,0.0012525,0.0007062,0.0022279
+980,0.2427786,0.0012033,0.0010517,0.0006728,0.0020881
+985,0.2216402,0.0012069,0.0009425,0.0005846,0.0018583
+990,0.2107166,0.0012223,0.0009661,0.0006290,0.0018199
+995,0.1971150,0.0011194,0.0008666,0.0006789,0.0019029
+1000,0.1775850,0.0011202,0.0007896,0.0007596,0.0016151
+1005,0.1629801,0.0010435,0.0008717,0.0006784,0.0017322
+1010,0.1484601,0.0010853,0.0008884,0.0006441,0.0017250
+1015,0.1357785,0.0012269,0.0009619,0.0008511,0.0020431
+1020,0.1239647,0.0012386,0.0011177,0.0009305,0.0021422
+1025,0.1085287,0.0014607,0.0012735,0.0007567,0.0020229
+1030,0.0954432,0.0018346,0.0010511,0.0008329,0.0019033
+1035,0.0831004,0.0014991,0.0010623,0.0009111,0.0017056
+1040,0.0715127,0.0015231,0.0008597,0.0008798,0.0018068
+1045,0.0634132,0.0014061,0.0009766,0.0006438,0.0016984
+1050,0.0548069,0.0012190,0.0008612,0.0008323,0.0020005
+1055,0.0475781,,,,
+1060,0.0100588,,,,
+1065,,,,,
+1070,,,,,
+1075,,,,,
+1080,,,,,
+1085,,,,,
+1090,,,,,
+1095,,,,,
+1100,,,,,
diff --git a/imagery/i.modis.qc/i.modis.qc.html b/imagery/i.modis.qc/i.modis.qc.html
index 20981c2..14b8e52 100644
--- a/imagery/i.modis.qc/i.modis.qc.html
+++ b/imagery/i.modis.qc/i.modis.qc.html
@@ -1,9 +1,10 @@
<h2>DESCRIPTION</h2>
<em>i.modis.qc</em> extracts Requested Quality Assessment flags from the
-following MODIS products: MOD09A1, MOD09Q1, MOD11A1, MOD11A2, MOD13A2,
+following MODIS products: MOD09A1, MOD09Q1, MOD11A1, MOD11A2, MOD13A2, MOD13Q1,
MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
+<h3>MOD09A1 and MOD09Q1</h3>
<pre>
<em>MOD09A1/Q1: MODLAND QA Bits. bits=[0-1]</em>
</pre>
@@ -68,6 +69,108 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
+<em>MOD09A1s: Cloud State bits=[0-1]</em>
+</pre>
+<ul>
+ <li>[00]= class 0: clear</li>
+ <li>[01]= class 1: cloudy</li>
+ <li>[10]= class 2: mixed</li>
+ <li>[11]= class 3: not set, assumed clear</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: Cloud shadow bits=[2]</em>
+</pre>
+<ul>
+ <li>[0]= class 0: no</li>
+ <li>[1]= class 1: yes</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: Land/Water Flag bits=[3-5]</em>
+</pre>
+<ul>
+ <li>[000]= class 0: Shallow ocean</li>
+ <li>[001]= class 1: Land</li>
+ <li>[010]= class 2: Ocean coastlines and lake shorelines</li>
+ <li>[011]= class 3: Shallow inland water</li>
+ <li>[100]= class 4: Ephemeral water</li>
+ <li>[101]= class 5: Deep inland water</li>
+ <li>[110]= class 6: Continental/moderate ocean</li>
+ <li>[111]= class 7: Deep ocean</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: Aerosol Quantity bits=[6-7]</em>
+</pre>
+<ul>
+ <li>[00]= class 0: Climatology</li>
+ <li>[01]= class 1: Low</li>
+ <li>[10]= class 2: Average</li>
+ <li>[11]= class 3: High</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: Cirrus detected bits=[8-9]</em>
+</pre>
+<ul>
+ <li>[00]= class 0: None</li>
+ <li>[01]= class 1: Small</li>
+ <li>[10]= class 2: Average</li>
+ <li>[11]= class 3: High</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: Internal Cloud Algorithm Flag bits=[10]</em>
+</pre>
+<ul>
+ <li>[0]= class 0: No cloud</li>
+ <li>[1]= class 1: Cloud</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: Internal Fire Algorithm Flag bits=[11]</em>
+</pre>
+<ul>
+ <li>[0]= class 0: No fire</li>
+ <li>[1]= class 1: Fire</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: MOD35 snow/ice flag bits=[12]</em>
+</pre>
+<ul>
+ <li>[0]= class 0: No</li>
+ <li>[1]= class 1: Yes</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: Pixel adjacent to cloud bits=[13]</em>
+</pre>
+<ul>
+ <li>[0]= class 0: No</li>
+ <li>[1]= class 1: Yes</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: BRDF correction performed bits=[14]</em>
+</pre>
+<ul>
+ <li>[0]= class 0: No</li>
+ <li>[1]= class 1: Yes</li>
+</ul>
+
+<pre>
+<em>MOD09A1s: Internal Snow Mask bits=[15]</em>
+</pre>
+<ul>
+ <li>[0]= class 0: No snow</li>
+ <li>[1]= class 1: Snow</li>
+</ul>
+
+
+<h3>MOD11A1</h3>
+<pre>
<em>MOD11A1: Mandatory QA Flags bits=[0-1]</em>
</pre>
<ul>
@@ -106,8 +209,9 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
<li>[10]= class 2: Average LST error ≤ 3</li>
<li>[11]= class 3: Average LST error > 3</li>
</ul>
-<pre>
+<h3>MOD11A2</h3>
+<pre>
<em>MOD11A2: Mandatory QA Flags bits=[0-1]</em>
</pre>
<ul>
@@ -147,40 +251,36 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
<li>[11]= class 3: Average LST error > 3</li>
</ul>
+<h3>MOD13A2</h3>
<pre>
-<em>MOD09A1s: Cloud State bits=[0-1]</em>
-</pre>
-<ul>
- <li>[00]= class 0: clear</li>
- <li>[01]= class 1: cloudy</li>
- <li>[10]= class 2: mixed</li>
- <li>[11]= class 3: not set, assumed clear</li>
-</ul>
-
-<pre>
-<em>MOD09A1s: Cloud shadow bits=[2]</em>
+<em>MOD13A2: Mandatory QA Flags 1km bits[0-1]</em>
</pre>
<ul>
- <li>[0]= class 0: no</li>
- <li>[1]= class 1: yes</li>
+ <li>[00]= class 0: VI produced, good quality</li>
+ <li>[01]= class 1: VI produced, but check other QA</li>
+ <li>[10]= class 2: Pixel produced, but most probably cloud</li>
+ <li>[11]= class 3: Pixel not produced due to other reasons than clouds</li>
</ul>
<pre>
-<em>MOD09A1s: Land/Water Flag bits=[3-5]</em>
+<em>MOD13A2: VI Usefulness Flag bits[2-5]</em>
</pre>
<ul>
- <li>[000]= class 0: Shallow ocean</li>
- <li>[001]= class 1: Land</li>
- <li>[010]= class 2: Ocean coastlines and lake shorelines</li>
- <li>[011]= class 3: Shallow inland water</li>
- <li>[100]= class 4: Ephemeral water</li>
- <li>[101]= class 5: Deep inland water</li>
- <li>[110]= class 6: Continental/moderate ocean</li>
- <li>[111]= class 7: Deep ocean</li>
+ <li>[0000]= class 0: Highest quality</li>
+ <li>[0001]= class 1: Lower quality</li>
+ <li>[0010]= class 2: Decreasing quality</li>
+ <li>[0100]= class 3: Decreasing quality</li>
+ <li>[1000]= class 4: Decreasing quality</li>
+ <li>[1001]= class 5: Decreasing quality</li>
+ <li>[1010]= class 6: Decreasing quality</li>
+ <li>[1100]= class 7: Lowest quality</li>
+ <li>[1101]= class 8: Quality so low that it is not useful</li>
+ <li>[1110]= class 9: L1B data faulty</li>
+ <li>[1111]= class 10: Not useful for any other reason/not processed</li>
</ul>
<pre>
-<em>MOD09A1s: Aerosol Quantity bits=[6-7]</em>
+<em>MOD13A2: Aerosol quantity Flags 1km bits[6-7]</em>
</pre>
<ul>
<li>[00]= class 0: Climatology</li>
@@ -190,41 +290,45 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD09A1s: Cirrus detected bits=[8-9]</em>
+<em>MOD13A2: Adjacent cloud detected 1km bit[8]</em>
</pre>
<ul>
- <li>[00]= class 0: None</li>
- <li>[01]= class 1: Small</li>
- <li>[10]= class 2: Average</li>
- <li>[11]= class 3: High</li>
+ <li>[00]= class 0: No</li>
+ <li>[01]= class 1: Yes</li>
</ul>
<pre>
-<em>MOD09A1s: Internal Cloud Algorithm Flag bits=[10]</em>
+<em>MOD13A2: Atmosphere BRDF correction performed 1km bit[9]</em>
</pre>
<ul>
- <li>[0]= class 0: No cloud</li>
- <li>[1]= class 1: Cloud</li>
+ <li>[00]= class 0: No</li>
+ <li>[01]= class 1: Yes</li>
</ul>
<pre>
-<em>MOD09A1s: Internal Fire Algorithm Flag bits=[11]</em>
+<em>MOD13A2: Mixed clouds 1km bit[10]</em>
</pre>
<ul>
- <li>[0]= class 0: No fire</li>
- <li>[1]= class 1: Fire</li>
+ <li>[00]= class 0: No</li>
+ <li>[01]= class 1: Yes</li>
</ul>
<pre>
-<em>MOD09A1s: MOD35 snow/ice flag bits=[12]</em>
+<em>MOD13A2: Land/Water Flags 1km bits[11-13]</em>
</pre>
<ul>
- <li>[0]= class 0: No</li>
- <li>[1]= class 1: Yes</li>
+ <li>[000]= class 0: Shallow Ocean</li>
+ <li>[001]= class 1: Land (Nothing else but land)</li>
+ <li>[010]= class 2: Ocean Coastlines and lake shorelines</li>
+ <li>[011]= class 3: Shallow inland water</li>
+ <li>[100]= class 4: Ephemeral water</li>
+ <li>[101]= class 5: Deep inland water</li>
+ <li>[110]= class 6: Moderate or continental ocean</li>
+ <li>[111]= class 7: Deep ocean</li>
</ul>
<pre>
-<em>MOD09A1s: Pixel adjacent to cloud bits=[13]</em>
+<em>MOD13A2: Possible Snow/Ice 1km bits[14]</em>
</pre>
<ul>
<li>[0]= class 0: No</li>
@@ -232,23 +336,16 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD09A1s: BRDF correction performed bits=[14]</em>
+<em>MOD13A2: Possible Shadow 1km bits[15]</em>
</pre>
<ul>
<li>[0]= class 0: No</li>
<li>[1]= class 1: Yes</li>
</ul>
+<h3>MOD13Q1</h3>
<pre>
-<em>MOD09A1s: Internal Snow Mask bits=[15]</em>
-</pre>
-<ul>
- <li>[0]= class 0: No snow</li>
- <li>[1]= class 1: Snow</li>
-</ul>
-
-<pre>
-<em>MOD13A2: Mandatory QA Flags 1km bits[0-1]</em>
+<em>MOD13Q1: Mandatory QA Flags 250m bits[0-1]</em>
</pre>
<ul>
<li>[00]= class 0: VI produced, good quality</li>
@@ -258,7 +355,7 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD13A2: VI Usefulness Flag bits[2-5]</em>
+<em>MOD13Q1: VI Usefulness Flag 250m bits[2-5]</em>
</pre>
<ul>
<li>[0000]= class 0: Highest quality</li>
@@ -275,7 +372,7 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD13A2: Aerosol quantity Flags 1km bits[6-7]</em>
+<em>MOD13Q1: Aerosol quantity Flags 250m bits[6-7]</em>
</pre>
<ul>
<li>[00]= class 0: Climatology</li>
@@ -285,7 +382,7 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD13A2: Adjacent cloud detected 1km bit[8]</em>
+<em>MOD13Q1: Adjacent cloud detected 250m bit[8]</em>
</pre>
<ul>
<li>[00]= class 0: No</li>
@@ -293,7 +390,7 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD13A2: Atmosphere BRDF correction performed 1km bit[9]</em>
+<em>MOD13Q1: Atmosphere BRDF correction performed 250m bit[9]</em>
</pre>
<ul>
<li>[00]= class 0: No</li>
@@ -301,7 +398,7 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD13A2: Mixed clouds 1km bit[10]</em>
+<em>MOD13Q1: Mixed clouds 250m bit[10]</em>
</pre>
<ul>
<li>[00]= class 0: No</li>
@@ -309,7 +406,7 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD13A2: Land/Water Flags 1km bits[11-13]</em>
+<em>MOD13Q1: Land/Water Flags 250m bits[11-13]</em>
</pre>
<ul>
<li>[000]= class 0: Shallow Ocean</li>
@@ -323,7 +420,7 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD13A2: Possible Snow/Ice 1km bits[14]</em>
+<em>MOD13Q1: Possible Snow/Ice 250m bits[14]</em>
</pre>
<ul>
<li>[0]= class 0: No</li>
@@ -331,14 +428,14 @@ MCD43B2. This does include MOD09A1 QA_state_500m layer (see Notes).
</ul>
<pre>
-<em>MOD13A2: Possible Shadow 1km bits[15]</em>
+<em>MOD13Q1: Possible Shadow 250m bits[15]</em>
</pre>
<ul>
<li>[0]= class 0: No</li>
<li>[1]= class 1: Yes</li>
</ul>
-
+<h3>MCD43B2</h3>
<pre>
<em>MCD43B2: Albedo Quality Ancillary Platform Data 1km bits[0-3]</em>
<em>SDS: BRDF_Albedo_Ancillary</em>
@@ -410,7 +507,7 @@ Add more daily products.
<h2>REFERENCES</h2>
<ul>
-<li> <a href="https://lpdaac.usgs.gov/products/modis_products_table">MODIS Products</a>
+<li> <a href="https://lpdaac.usgs.gov/dataset_discovery/modis/modis_products_table">MODIS Products</a>
<li> Vermote E.F., Kotchenova S.Y., Ray J.P. MODIS Surface Reflectance User's Guide.
Version 1.2. June 2008. MODIS Land Surface Reflectance Science Computing Facility.
<a href="http://modis-sr.ltdri.org">Homepage</a>
@@ -420,4 +517,4 @@ Add more daily products.
Yann Chemin
<p>
-<i>Last changed: $Date: 2014-12-12 00:12:46 +0100 (Fri, 12 Dec 2014) $</i>
+<i>Last changed: $Date: 2016-06-15 20:57:15 +0200 (Wed, 15 Jun 2016) $</i>
diff --git a/imagery/i.vi/main.c b/imagery/i.vi/main.c
index 1118d1e..e5ebb0b 100644
--- a/imagery/i.vi/main.c
+++ b/imagery/i.vi/main.c
@@ -508,7 +508,8 @@ int main(int argc, char *argv[])
}
Rast_put_d_row(outfd, outrast);
}
-
+ G_percent(1, 1, 1);
+
G_free(inrast_redchan);
Rast_close(infd_redchan);
if (nirchan) {
diff --git a/include/VERSION b/include/VERSION
index 59430c2..fdeccaa 100644
--- a/include/VERSION
+++ b/include/VERSION
@@ -1,4 +1,4 @@
7
2
-0RC2
+0
2016
diff --git a/lib/gis/find_file.c b/lib/gis/find_file.c
index 2727e92..201bd86 100644
--- a/lib/gis/find_file.c
+++ b/lib/gis/find_file.c
@@ -111,8 +111,8 @@ static const char *find_file(int misc, const char *dir,
if (!pselmapset)
pselmapset = pmapset;
else if (element == pelement)
- G_warning(_("'%s/%s' was found in more mapsets (also found in <%s>)"),
- element, pname, pmapset);
+ G_important_message(_("Data element '%s/%s' was found in more mapsets (also found in <%s>)"),
+ element, pname, pmapset);
cnt++;
}
}
@@ -124,7 +124,7 @@ static const char *find_file(int misc, const char *dir,
if (access(path, 0) == 0) {
/* If the same name exists in more mapsets and print a warning */
if (cnt > 1 && element == pelement)
- G_warning(_("Using <%s@%s>"),
+ G_important_message(_("Using <%s@%s>..."),
pname, pselmapset);
return G_store(pselmapset);
diff --git a/lib/gis/gisinit.c b/lib/gis/gisinit.c
index a3340b8..5469271 100644
--- a/lib/gis/gisinit.c
+++ b/lib/gis/gisinit.c
@@ -119,6 +119,10 @@ static int gisinit(void)
G__.little_endian = G_is_little_endian();
zlib = getenv("GRASS_ZLIB_LEVEL");
+ /* Valid zlib compression levels -1 - 9 */
+ /* zlib default: Z_DEFAULT_COMPRESSION = -1, equivalent to 6
+ * level 0 means no compression
+ * as used here, 1 gives the best compromise between speed and compression */
G__.compression_level = (zlib && *zlib && isdigit(*zlib)) ? atoi(zlib) : 1;
if (G__.compression_level < -1 || G__.compression_level > 9)
G__.compression_level = 1;
diff --git a/lib/init/grass.py b/lib/init/grass.py
index ad38ab1..13d8173 100644
--- a/lib/init/grass.py
+++ b/lib/init/grass.py
@@ -1857,7 +1857,7 @@ def main():
message(_("Starting GRASS GIS..."))
# Ensure GUI is set
- if batch_job:
+ if batch_job or params.exit_grass:
grass_gui = 'text'
else:
if not grass_gui:
diff --git a/lib/init/grass7.html b/lib/init/grass7.html
index 6b9eda0..b27e677 100644
--- a/lib/init/grass7.html
+++ b/lib/init/grass7.html
@@ -285,14 +285,14 @@ r.out.gdal input=basin_50K output=basins.tiff
Region issues ignored.
-->
-Create a new Location based on a geodata file's projection (<b>-c</b>)
-and exit (<b>-e</b>):
+Creating a new Location based on a geodata file's projection (<b>-c</b>)
+and exit (<b>-e</b>) immediately:
<div class="code"><pre>
grass72 -c elevation.tiff -e /path/to/grassdata/test1/
</pre></div>
-Link external raster data to PERMANENT Mapset:
+Linking external raster data to PERMANENT Mapset:
<div class="code"><pre>
grass72 /path/to/grassdata/test1/PERMANENT/ --exec r.external input=basins.tiff output=basins
@@ -311,14 +311,61 @@ Compare the rasters visually:
grass72 /path/to/grassdata/test1/PERMANENT/ --exec g.gui.mapswipe first=elevation second=basins
</pre></div>
+<h4>Execution of shell and Python scripts instead of single commands</h4>
+
+A sequence of commands can be bundled in a script and executed using the
+exec interface.
+<p>
+<b>Shell script example:</b> the command to execute a shell script might be:
+
+<div class="code"><pre>
+grass72 /path/to/grassdata/test1/PERMANENT/ --exec sh test.sh
+</pre></div>
+
+A very simple bash script ("test.sh") may look like this:
+
+<div class="code"><pre>
+#!/bin/bash
+
+g.region -p
+g.list type=raster
+r.info elevation
+</pre></div>
+
<p>
-Note: The exec interface is also able to execute entire scripts.
+<b>Python script example:</b> the command to execute a Python script might be:
+
+<div class="code"><pre>
+grass72 /path/to/grassdata/test1/PERMANENT/ --exec python test.py
+</pre></div>
+
+A very simple Python script ("test.py") may look like this:
+
+<div class="code"><pre>
+#!/usr/bin/env python
+
+# import GRASS Python bindings (see also pygrass)
+import grass.script as gscript
+import grass.script.setup as gsetup
+
+gscript.message('Current GRASS GIS 7 environment:')
+print(gscript.gisenv())
+
+gscript.message('Available raster maps:')
+for raster in gscript.list_strings(type='raster'):
+ print(raster)
+
+gscript.message('Available vector maps:')
+for vector in gscript.list_strings(type='vector'):
+ print(vector)
+</pre></div>
-<p><b>Troubleshooting</b>:
+<h4>Troubleshooting</h4>
Importantly, to avoid an <tt>"[Errno 8] Exec format error"</tt> there must be a
<a href="https://en.wikipedia.org/wiki/Shebang_%28Unix%29">shebang</a> line at the top of
the script (like <tt>#!/bin/sh</tt>, <tt>#!/bin/bash</tt>, or <tt>#!/usr/bin/env python</tt>)
-indicating which interpreter to be used for the script.
+indicating which interpreter to be used for the script. The script file must
+have its executable bit set.
<h3>Other examples</h3>
@@ -422,4 +469,4 @@ Hamish Bowman<br>
Martin Landa, Czech Technical University in Prague, Czech Republic
<p>
-<i>Last changed: $Date: 2016-10-02 21:17:10 +0200 (Sun, 02 Oct 2016) $</i>
+<i>Last changed: $Date: 2016-12-07 11:24:08 +0100 (Wed, 07 Dec 2016) $</i>
diff --git a/lib/python/docs/src/pygrass_gis.rst b/lib/python/docs/src/pygrass_gis.rst
index e5a01fe..fbf6432 100644
--- a/lib/python/docs/src/pygrass_gis.rst
+++ b/lib/python/docs/src/pygrass_gis.rst
@@ -1,21 +1,30 @@
.. _GRASSdatabase-label:
GRASS database management
-===============================
+=========================
-These classes are used to manage the infrastructure
-of GRASS database: Gisdbase, Location and Mapset
+PyGRASS imlements the classes described bellow:
-Details about the GRASS GIS database management (locations and mapsets)
-can be found in the `GRASS GIS 7 User's Manual: GRASS GIS Quickstart <http://grass.osgeo.org/grass72/manuals/helptext.html>`_
+* :class:`~pygrass.gis.Gisdbase`
+* :class:`~pygrass.gis.Location`
+* :class:`~pygrass.gis.Mapset`
+* :class:`~pygrass.gis.VisibleMapset`
+
+These classes are used to manage the infrastructure of GRASS database:
+GIS data directory, Location and Mapset. Details about the GRASS GIS
+database management (locations and mapsets) can be found in the `GRASS
+GIS 7 User's Manual: GRASS GIS Quickstart
+<http://grass.osgeo.org/grass72/manuals/helptext.html>`_.
.. _Region-label:
Region management
-======================
+=================
-The Region class it is useful to obtain information
-about the computational region and to change it.
+The :class:`~pygrass.gis.region.Region` class it is useful to obtain
+information about the computational region and to change it. Details
+about the GRASS GIS computational region management can be found in
+the `GRASS GIS Wiki: Computational region
+<http://grasswiki.osgeo.org/wiki/Computational_region>`_.
-Details about the GRASS GIS computational region management can be found
-in the `GRASS GIS Wiki: Computational region <http://grasswiki.osgeo.org/wiki/Computational_region>`_
+The classes are part of the :mod:`~pygrass.gis` module.
diff --git a/lib/python/docs/src/pygrass_index.rst b/lib/python/docs/src/pygrass_index.rst
index 180cebd..20944d4 100644
--- a/lib/python/docs/src/pygrass_index.rst
+++ b/lib/python/docs/src/pygrass_index.rst
@@ -1,12 +1,12 @@
PyGRASS documentation
-===================================
+=====================
Python is a programming language which is more powerful than shell
-scripting but easier and more forgiving than C. ``PyGRASS`` is an
+scripting but easier and more forgiving than C. *PyGRASS* is an
object-oriented Python Application Programming Interface (API) for
-GRASS GIS. ``PyGRASS`` offers interfaces to GRASS modules and
+GRASS GIS. *PyGRASS* offers interfaces to GRASS modules and
functionality, as well as to vector and raster data. For details,
-see Zambelli et al. (2013) in the references below. ``PyGRASS``
+see Zambelli et al. (2013) in the references below. *PyGRASS*
improves the integration between GRASS GIS and Python, making the
use of Python under GRASS more consistent with the language itself.
Furthermore, it simplifies GRASS scripting and programming and more
@@ -17,15 +17,15 @@ for the new GUI. Due to this Python became more and more important
and developers converted all shell scripts from GRASS GIS 6 to Python
for GRASS GIS 7.
-To work with ``PyGRASS`` you need an up-to-date version of GRASS
-GIS 7. The only action before starting to work with ``PyGRASS`` is
-to launch GRASS GIS 7 and from the console launch ``python`` or
-``ipython`` (the second one is the recommended way).
+To work with *PyGRASS* you need an up-to-date version of GRASS
+GIS 7. The only action before starting to work with *PyGRASS* is
+to launch GRASS GIS 7 and from the console launch *python* or
+*ipython* (the second one is the recommended way).
-Read more about how to work with ``pygrass`` in this documentation.
+Read more about how to work with *PyGRASS* in this documentation.
-Contents:
+**Contents:**
.. toctree::
:maxdepth: 2
@@ -39,14 +39,22 @@ Contents:
References
-^^^^^^^^^^^^^
-
-* Zambelli P, Gebbert S, Ciolli M., 2013. *Pygrass: An Object Oriented Python Application Programming Interface (API) for Geographic Resources Analysis Support System (GRASS) Geographic Information System (GIS)*. ISPRS International Journal of Geo-Information. 2(1):201-219. `doi:10.3390/ijgi2010201 <http://dx.doi.org/10.3390/ijgi2010201>`_
-* `Python related articles in the GRASS GIS Wiki <http://grasswiki.osgeo.org/wiki/Category:Python>`_
-* `GRASS GIS 7 Programmer's Manual <http://grass.osgeo.org/programming7/>`_
-
-This project has been funded with support from the `Google Summer of Code 2012 <http://trac.osgeo.org/grass/wiki/GSoC#PythonhighlevelmapinteractionforGRASSGIS>`_
-
+^^^^^^^^^^
+
+* Zambelli P, Gebbert S, Ciolli M., 2013. *Pygrass: An Object Oriented
+ Python Application Programming Interface (API) for Geographic
+ Resources Analysis Support System (GRASS) Geographic Information
+ System (GIS)*. ISPRS International Journal of
+ Geo-Information. 2(1):201-219. `doi:10.3390/ijgi2010201
+ <http://dx.doi.org/10.3390/ijgi2010201>`_
+* `Python related articles in the GRASS GIS Wiki
+ <http://grasswiki.osgeo.org/wiki/Category:Python>`_
+* `GRASS GIS 7 Programmer's Manual
+ <http://grass.osgeo.org/programming7/>`_
+
+This project has been funded with support from the `Google Summer of
+Code 2012
+<http://trac.osgeo.org/grass/wiki/GSoC#PythonhighlevelmapinteractionforGRASSGIS>`_
..
Indices and tables
diff --git a/lib/python/docs/src/pygrass_messages.rst b/lib/python/docs/src/pygrass_messages.rst
index 1d358fe..354c200 100644
--- a/lib/python/docs/src/pygrass_messages.rst
+++ b/lib/python/docs/src/pygrass_messages.rst
@@ -1,12 +1,14 @@
PyGRASS message interface
=========================
-The PyGRASS message interface is a fast and exit-safe
-interface to the `GRASS C-library message functions <http://grass.osgeo.org/programming7/gis_2error_8c.html>`_.
-
-This class implements a fast and exit-safe interface to the GRASS
-C-library message functions like: G_message(), G_warning(),
-G_important_message(), G_verbose_message(), G_percent() and G_debug().
+The PyGRASS message interface is a fast and exit-safe interface to the
+`GRASS C-library message functions
+<http://grass.osgeo.org/programming7/gis_2error_8c.html>`_.
+
+The :class:`~pygrass.messages.Messenger` class implements a fast and
+exit-safe interface to the GRASS C-library message functions like:
+``G_message()``, ``G_warning()``, ``G_important_message()``,
+``G_verbose_message()``, ``G_percent()`` and ``G_debug()``.
Usage:
diff --git a/lib/python/docs/src/pygrass_modules.rst b/lib/python/docs/src/pygrass_modules.rst
index bb219e8..23d7752 100644
--- a/lib/python/docs/src/pygrass_modules.rst
+++ b/lib/python/docs/src/pygrass_modules.rst
@@ -1,9 +1,11 @@
Interface to GRASS GIS modules
==============================
-In "modules", GRASS GIS modules are represented as objects. These objects
-are generated based on the XML module description that is used also for
-the generation of the graphical user interface (GUI). ::
+In :mod:`~pygrass.modules` module, GRASS GIS modules are represented
+by :class:`~pygrass.modules.interface.module.Module` class
+objects. These objects are generated based on the XML module
+description that is used also for the generation of the graphical user
+interface (GUI). ::
>>> from grass.pygrass.modules import Module
>>> slope_aspect = Module("r.slope.aspect", elevation='elevation',
@@ -138,7 +140,7 @@ For each input and output parameter it is possible to obtain specific
information. To see all module inputs, just type: ::
>>> slope_aspect.inputs #doctest: +NORMALIZE_WHITESPACE
- TypeDict([('elevation', Parameter <elevation> (required:yes, type:raster, multiple:no)), ('format', Parameter <format> (required:no, type:string, multiple:no)), ('prec', Parameter <prec> (required:no, type:string, multiple:no)), ('zfactor', Parameter <zfactor> (required:no, type:float, multiple:no)), ('min_slp_allowed', Parameter <min_slp_allowed> (required:no, type:float, multiple:no))])
+ TypeDict([('elevation', Parameter <elevation> (required:yes, type:raster, multiple:no)), ('format', Parameter <format> ...)])
To get information for each parameter: ::
@@ -204,6 +206,13 @@ Another example of use: ::
>>> category = Module("r.category", map="elevation",
... stdin_=info.popen.stdout, finish_=True)
+Launching GRASS GIS modules in parallel
+---------------------------------------
+PyGRASS implements simple mechanism for launching GRASS modules in
+parallel. See
+:class:`~pygrass.modules.interface.module.ParallelModuleQueue` class
+for details.
+
.. _Popen: http://docs.python.org/library/subprocess.html#Popen
diff --git a/lib/python/docs/src/pygrass_raster.rst b/lib/python/docs/src/pygrass_raster.rst
index 79a179b..f1d169f 100644
--- a/lib/python/docs/src/pygrass_raster.rst
+++ b/lib/python/docs/src/pygrass_raster.rst
@@ -4,18 +4,20 @@ Introduction to Raster classes
==============================
Details about the GRASS GIS raster architecture can be found in the
-`GRASS GIS 7 Programmer's Manual: GRASS Raster Library <http://grass.osgeo.org/programming7/rasterlib.html>`_
-
-PyGRASS uses 3 different Raster classes, that respect the 3 different approaches
-of GRASS-C API. The classes use a standardized interface to keep methods
-consistent between them. The read access is row wise for :ref:`RasterRow-label`
-and :ref:`RasterRowIO-label` and additionally
-cached in the RowIO class. Both classes write sequentially.
-RowIO is row cached, :ref:`RasterSegment-label`
-is tile cached for reading and writing; therefore, random access is possible.
-Hence RasterRow and RasterRowIO should be used for fast (cached)
-row read access and RasterRow for fast sequential writing.
-RasterSegment should be used for random access.
+`GRASS GIS 7 Programmer's Manual: GRASS Raster Library
+<http://grass.osgeo.org/programming7/rasterlib.html>`_.
+
+PyGRASS uses 3 different raster classes, that respect the 3 different
+approaches of GRASS-C API. The classes use a standardized interface to
+keep methods consistent between them. The read access is row wise for
+:ref:`RasterRow-label` and :ref:`RasterRowIO-label` and additionally
+cached in the RowIO class. Both classes write sequentially. RowIO is
+row cached, :ref:`RasterSegment-label` is tile cached for reading and
+writing; therefore, random access is possible. Hence RasterRow and
+RasterRowIO should be used for fast (cached) row read access and
+RasterRow for fast sequential writing. RasterSegment should be used
+for random access. The classes are part of the :mod:`~pygrass.raster`
+module.
========================== ======================= ======== ============
@@ -64,12 +66,12 @@ We can rename the map: ::
RasterRow
---------
-The PyGrass :class:`~pygrass.raster.RasterRow` class allow user to open maps row
+The PyGRASS :class:`~pygrass.raster.RasterRow` class allow user to open maps row
by row in either read or write mode using the `Raster library`_. Reading and writing
to the same map at the same time is not supported. For this functionality,
please see the :ref:`RasterSegment-label` class.
The RasterRow class allows map rows to be read in any order, but map rows can
-only be written in sequential order. Therefore, each now row written to a map is
+only be written in sequential order. Therefore, each row written to a map is
added to the file as the last row. ::
>>> raster = reload(raster)
@@ -124,7 +126,7 @@ RasterRowIO
The :class:`~pygrass.raster.RasterRowIO` class uses the GRASS `RowIO library`_, and implements a row
cache. The RasterRowIO class only supports reading rasters; because raster rows
can only be written in sequential order, writing by row id is not
-supported by design. Hence, the rowio lib can only be used to cache rows
+supported by design. Hence, the RowIO lib can only be used to cache rows
for reading, and any write access should use the :ref:`RasterRow-label` class. ::
>>> raster = reload(raster)
@@ -174,7 +176,7 @@ opening maps in a read-write mode. ::
Due to the unique behavior of this class, the RasterSegment class defines two
methods to read a map:
- * ``get_row`` calls the C function ``Segment_get_row`` and returns a buffer
+ * ``get_row`` calls the C function ``Segment_get_row()`` and returns a buffer
object with the row. ::
>>> # call explicitly the method
@@ -182,7 +184,7 @@ methods to read a map:
>>> # call implicitly the method
>>> elev_row0 = elev[0]
- * ``get`` calls the C function ``Segment_get`` and returns the value of the
+ * ``get`` calls the C function ``Segment_get()`` and returns the value of the
map cell. ::
>>> # call explicitly the method
@@ -190,8 +192,8 @@ methods to read a map:
>>> # call implicitly the method
>>> elev_val_0_0 = elev[0, 0]
-Similarly, writing to a map uses two methods: ``put_row`` to write a row and
-``put`` to write a single value to the map. ::
+Similarly, writing to a map uses two methods: ``put_row()`` to write a row and
+``put()`` to write a single value to the map. ::
>>> # compare the cell value get using the ``get`` method, and take the first
>>> # value of the row with the ``get_row`` method
diff --git a/lib/python/docs/src/pygrass_vector.rst b/lib/python/docs/src/pygrass_vector.rst
index 77bc546..5c13e0d 100644
--- a/lib/python/docs/src/pygrass_vector.rst
+++ b/lib/python/docs/src/pygrass_vector.rst
@@ -2,21 +2,25 @@ Introduction to Vector classes
==============================
Details about the GRASS GIS vector architecture can be found in the
-`GRASS GIS 7 Programmer's Manual: GRASS Vector Library <http://grass.osgeo.org/programming7/vectorlib.html>`_
+`GRASS GIS 7 Programmer's Manual: GRASS Vector Library
+<http://grass.osgeo.org/programming7/vectorlib.html>`_.
-PyGrass has two classes for vector maps: :ref:`Vector-label` and :ref:`VectorTopo-label`.
-As the names suggest, the Vector class is for vector maps, while VectorTopo
-opens vector maps with `GRASS GIS topology <http://grass.osgeo.org/programming7/vlibTopology.html>`_.
-VectorTopo is an extension of the Vector class, so supports all the Vector class methods, with additions.
+PyGRASS has two classes for vector maps: :ref:`Vector-label` and
+:ref:`VectorTopo-label`. As the names suggest, the Vector class is
+for vector maps, while VectorTopo opens vector maps with `GRASS GIS
+topology <http://grass.osgeo.org/programming7/vlibTopology.html>`_.
+VectorTopo is an extension of the Vector class, so supports all the
+Vector class methods, with additions. The classes are part of the
+:mod:`~pygrass.vector` module.
.. _Vector-label:
Vector
------
-The :class:`~pygrass.vector.Vector` class is part of the :mod:`~pygrass.vector`
-module. It is based on the :class:`~pygrass.vector.abstract.Info` class, which
-provides methods for accessing basic information about the vector map: ::
+The :class:`~pygrass.vector.Vector` class is based on the
+:class:`~pygrass.vector.abstract.Info` class, which provides methods
+for accessing basic information about the vector map: ::
>>> from grass.pygrass.vector import Vector
>>> cens = Vector('census')
@@ -55,8 +59,8 @@ like the Vector class: ::
'user1'
-Working with Vector Objects
----------------------------
+Working with Vector Maps
+------------------------
As the VectorTopo class is so similar to the Vector class, the following examples
exclusively demonstrate the VectorTopo class.
@@ -67,13 +71,16 @@ To begin using a vector map, it must first be opened: ::
>>> municip = VectorTopo('boundary_municp_sqlite')
>>> municip.open(mode='r')
-The ``open()`` method supports a number of option arguments (see the :class:`~pygrass.vector.abstract.Info`
-documentation for a complete list). In particular, the mode argument can take a
-a value of:
+The ``open()`` method supports a number of option arguments (see the
+:class:`~pygrass.vector.abstract.Info` documentation for a complete
+list). In particular, the mode argument can take a a value of:
-'r': read-only mode, vector features are read-only (attribute table is modifiable since are handle by a database);
-'w': write-only mode, write a new vector map in case of an old vector map all the previous features will be removed/overwritten;
-'rw': read-write mode, add new/update vector features without removing the existing ones. Add/remove vector layers.
+* 'r': read-only mode, vector features are read-only (attribute table
+ is modifiable since are handle by a database);
+* 'w': write-only mode, write a new vector map in case of an old
+ vector map all the previous features will be removed/overwritten;
+* 'rw': read-write mode, add new/update vector features without
+ removing the existing ones. Add/remove vector layers.
The geometry of a vector map can be read sequentially using the ``next()`` method.
@@ -118,7 +125,7 @@ Write the two points to the map:
>>> new.write(point0, cat=1, attrs=('pub',))
>>> new.write(point1, cat=2, attrs=('resturant',))
-Commit the db changes:
+Commit the DB changes (attributes):
>>> new.table.conn.commit()
>>> new.table.execute().fetchall()
@@ -208,19 +215,25 @@ requesting the table from each of the returned links: ::
Link(1, census, sqlite)
>>> table = link.table()
-Here, ``DBlinks()`` is a class (:class:`~pygrass.vector.table.DBlinks`) that
-contains all the links of a vector map. Each link is also a class
+Here, :class:`~pygrass.vector.table.DBlinks` is a class that contains
+all the links of a vector map. Each link is also a class
(:class:`~pygrass.vector.table.Link`) that contains a specific link's
-parameters. The ``table()`` method of the link class return the linked table as
-a table object (:class:`~pygrass.vector.table.Table`).
+parameters. The ``table()`` method of the link class return the linked
+table as a table object (:class:`~pygrass.vector.table.Table`).
Geometry Classes
----------------
-The vector package also includes a number of geometry classes, including Area,
-Boundary, Centroid, Isle, Line, and Point classes. Please consult the
-:mod:`~pygrass.vector.geometry` module for a complete list of methods for these
-classes, as there are many. Some basic examples are given below.
+The vector package also includes a number of geometry classes,
+including :class:`~pygrass.vector.geometry.Area`,
+:class:`~pygrass.vector.geometry.Boundary`,
+:class:`~pygrass.vector.geometry.Centroid`,
+:class:`~pygrass.vector.geometry.Isle`,
+:class:`~pygrass.vector.geometry.Line`, and
+:class:`~pygrass.vector.geometry.Point` classes. Please consult the
+:mod:`~pygrass.vector.geometry` module for a complete list of methods
+for these classes, as there are many. Some basic examples are given
+below.
Instantiate a Point object that could be 2 or 3D, default parameters are 0: ::
@@ -278,7 +291,7 @@ Find all areas larger than 10000m2: ::
>>> big = [area for area in municip.viter('areas')
... if area.alive() and area.area >= 10000]
-The PyGrass vector methods make complex operations rather easy. Notice the
+The PyGRASS vector methods make complex operations rather easy. Notice the
``viter()`` method: this returns an iterator object of the vector features, so
the user can choose on which vector features to iterate without loading all the
features into memory.
@@ -293,7 +306,6 @@ We can then sort the areas by size: ::
Area(2682) 320224369.66
Area(2552) 298356117.948
-
Or sort for the number of isles that are contained inside: ::
>>> big.sort(key = lambda x: x.isles.__len__(), reverse = True)
diff --git a/lib/python/pygrass/modules/interface/module.py b/lib/python/pygrass/modules/interface/module.py
index 262619e..2d5a0c5 100644
--- a/lib/python/pygrass/modules/interface/module.py
+++ b/lib/python/pygrass/modules/interface/module.py
@@ -359,6 +359,7 @@ class Module(object):
"Color table for raster map <test_a> set to 'rules'"
Run a second time
+
>>> colors.run()
Module('r.colors')
>>> stdout, stderr = colors.popen.communicate(input="1 blue")
@@ -369,6 +370,7 @@ class Module(object):
"Color table for raster map <test_a> set to 'rules'"
Multiple run test
+
>>> colors = Module("r.colors", map="test_a",
... color="ryb", run_=False)
>>> colors.get_bash()
diff --git a/lib/python/temporal/mapcalc.py b/lib/python/temporal/mapcalc.py
index b6bdec9..0be9aa7 100644
--- a/lib/python/temporal/mapcalc.py
+++ b/lib/python/temporal/mapcalc.py
@@ -119,7 +119,7 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
dbif=dbif)
# In case samples are not found
- if not list and len(list) == 0:
+ if not list or len(list) == 0:
dbif.close()
msgr.message(_("No samples found for map calculation"))
return 0
@@ -196,8 +196,7 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
for i in range(num):
count += 1
- if count % 10 == 0:
- msgr.percent(count, num, 1)
+ msgr.percent(count, num, 10)
# Create the r.mapcalc statement for the current time step
map_name = "{base}_{suffix}".format(base=base,
@@ -294,8 +293,7 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
for new_map in map_list:
count += 1
- if count % 10 == 0:
- msgr.percent(count, num, 1)
+ msgr.percent(count, num, 10)
# Read the map data
new_map.load()
@@ -315,8 +313,6 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
# Update the spatio-temporal extent and the metadata table entries
new_sp.update_from_registered_maps(dbif)
- msgr.percent(1, 1, 1)
-
# Remove empty maps
if len(empty_maps) > 0:
names = ""
diff --git a/lib/raster/gdal.c b/lib/raster/gdal.c
index 38b4a73..88c6e66 100644
--- a/lib/raster/gdal.c
+++ b/lib/raster/gdal.c
@@ -114,6 +114,7 @@ static void load_library(void)
"libgdal1.7.0.so",
# endif
# ifdef _WIN32
+ "gdal201.dll",
"gdal200.dll",
"gdal111.dll",
"gdal110.dll",
diff --git a/lib/vector/dglib/avl.c b/lib/vector/dglib/avl.c
index 923c88b..6d7bda1 100644
--- a/lib/vector/dglib/avl.c
+++ b/lib/vector/dglib/avl.c
@@ -1,25 +1,28 @@
-/* Produced by texiweb from libavl.w on 2002/02/09 at 01:45. */
+/* Produced by texiweb from libavl.w. */
/* libavl - library for manipulation of binary trees.
- Copyright (C) 1998-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+ */
- The author may be contacted at <blp at gnu.org> on the Internet, or
- as Ben Pfaff, 12167 Airport Rd, DeWitt MI 48820, USA through more
- mundane means.
+/* Nov 2016, Markus Metz
+ * from libavl-2.0.3
+ * added safety checks and speed optimizations
*/
#include <assert.h>
@@ -63,15 +66,15 @@ void *avl_find(const struct avl_table *tree, const void *item)
const struct avl_node *p;
assert(tree != NULL && item != NULL);
- for (p = tree->avl_root; p != NULL;) {
+
+ p = tree->avl_root;
+ while (p != NULL) {
int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
- if (cmp < 0)
- p = p->avl_link[0];
- else if (cmp > 0)
- p = p->avl_link[1];
- else /* |cmp == 0| */
+ if (cmp == 0)
return p->avl_data;
+
+ p = p->avl_link[cmp > 0];
}
return NULL;
@@ -97,7 +100,8 @@ void **avl_probe(struct avl_table *tree, void *item)
z = (struct avl_node *)&tree->avl_root;
y = tree->avl_root;
dir = 0;
- for (q = z, p = y; p != NULL; q = p, p = p->avl_link[dir]) {
+ q = z, p = y;
+ while (p != NULL) {
int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
if (cmp == 0)
@@ -106,25 +110,33 @@ void **avl_probe(struct avl_table *tree, void *item)
if (p->avl_balance != 0)
z = q, y = p, k = 0;
da[k++] = dir = cmp > 0;
+ q = p, p = p->avl_link[dir];
}
- n = q->avl_link[dir] =
- tree->avl_alloc->libavl_malloc(tree->avl_alloc, sizeof *n);
+ n = tree->avl_alloc->libavl_malloc(tree->avl_alloc, sizeof *n);
if (n == NULL)
return NULL;
tree->avl_count++;
- n->avl_data = item;
+ tree->avl_generation++;
n->avl_link[0] = n->avl_link[1] = NULL;
+ n->avl_data = item;
n->avl_balance = 0;
- if (y == NULL)
+ if (y == NULL) {
+ tree->avl_root = n;
+
return &n->avl_data;
+ }
+ q->avl_link[dir] = n;
- for (p = y, k = 0; p != n; p = p->avl_link[da[k]], k++)
+ p = y, k = 0;
+ while (p != n) {
if (da[k] == 0)
p->avl_balance--;
else
p->avl_balance++;
+ p = p->avl_link[da[k]], k++;
+ }
if (y->avl_balance == -2) {
struct avl_node *x = y->avl_link[0];
@@ -180,7 +192,6 @@ void **avl_probe(struct avl_table *tree, void *item)
return &n->avl_data;
z->avl_link[y != z->avl_link[0]] = w;
- tree->avl_generation++;
return &n->avl_data;
}
@@ -209,6 +220,7 @@ void *avl_replace(struct avl_table *table, void *item)
void *r = *p;
*p = item;
+
return r;
}
}
@@ -223,23 +235,31 @@ void *avl_delete(struct avl_table *tree, const void *item)
int k; /* Stack pointer. */
struct avl_node *p; /* Traverses tree to find node to delete. */
+ int dir; /* Side of |pa[k]| on which |p| is linked. */
int cmp; /* Result of comparison between |item| and |p|. */
assert(tree != NULL && item != NULL);
- k = 0;
- p = (struct avl_node *)&tree->avl_root;
- for (cmp = -1; cmp != 0;
- cmp = tree->avl_compare(item, p->avl_data, tree->avl_param)) {
- int dir = cmp > 0;
+ pa[0] = (struct avl_node *)&tree->avl_root;
+ da[0] = 0;
+ k = 1;
+ p = tree->avl_root;
+ while (p != NULL) {
+ cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
+
+ if (cmp == 0)
+ break;
+
+ dir = cmp > 0;
pa[k] = p;
da[k++] = dir;
p = p->avl_link[dir];
- if (p == NULL)
- return NULL;
}
+ if (p == NULL)
+ return NULL;
+
item = p->avl_data;
if (p->avl_link[1] == NULL)
@@ -258,7 +278,7 @@ void *avl_delete(struct avl_table *tree, const void *item)
struct avl_node *s;
int j = k++;
- for (;;) {
+ while (r != NULL) {
da[k] = 0;
pa[k++] = r;
s = r->avl_link[0];
@@ -367,6 +387,7 @@ void *avl_delete(struct avl_table *tree, const void *item)
tree->avl_count--;
tree->avl_generation++;
+
return (void *)item;
}
@@ -463,31 +484,30 @@ void *avl_t_last(struct avl_traverser *trav, struct avl_table *tree)
void *avl_t_find(struct avl_traverser *trav, struct avl_table *tree,
void *item)
{
- struct avl_node *p, *q;
+ struct avl_node *p;
assert(trav != NULL && tree != NULL && item != NULL);
trav->avl_table = tree;
trav->avl_height = 0;
trav->avl_generation = tree->avl_generation;
- for (p = tree->avl_root; p != NULL; p = q) {
+ p = tree->avl_root;
+ while (p != NULL) {
int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
- if (cmp < 0)
- q = p->avl_link[0];
- else if (cmp > 0)
- q = p->avl_link[1];
- else { /* |cmp == 0| */
-
+ if (cmp == 0) {
trav->avl_node = p;
+
return p->avl_data;
}
assert(trav->avl_height < AVL_MAX_HEIGHT);
trav->avl_stack[trav->avl_height++] = p;
+ p = p->avl_link[cmp > 0];
}
trav->avl_height = 0;
trav->avl_node = NULL;
+
return NULL;
}
@@ -512,10 +532,12 @@ void *avl_t_insert(struct avl_traverser *trav, struct avl_table *tree,
((char *)p - offsetof(struct avl_node, avl_data)));
trav->avl_generation = tree->avl_generation - 1;
+
return *p;
}
else {
avl_t_init(trav, tree);
+
return NULL;
}
}
@@ -644,14 +666,18 @@ void *avl_t_cur(struct avl_traverser *trav)
The new item must not upset the ordering of the tree. */
void *avl_t_replace(struct avl_traverser *trav, void *new)
{
- struct avl_node *old;
+ void *old;
assert(trav != NULL && trav->avl_node != NULL && new != NULL);
old = trav->avl_node->avl_data;
trav->avl_node->avl_data = new;
+
return old;
}
+/* Destroys |new| with |avl_destroy (new, destroy)|,
+ first setting right links of nodes in |stack| within |new|
+ to null pointers to avoid touching uninitialized data. */
static void
copy_error_recovery(struct avl_node **stack, int height,
struct avl_table *new, avl_item_func * destroy)
@@ -688,13 +714,14 @@ struct avl_table *avl_copy(const struct avl_table *org, avl_copy_func * copy,
allocator != NULL ? allocator : org->avl_alloc);
if (new == NULL)
return NULL;
+
new->avl_count = org->avl_count;
if (new->avl_count == 0)
return new;
x = (const struct avl_node *)&org->avl_root;
y = (struct avl_node *)&new->avl_root;
- for (;;) {
+ while (x != NULL) {
while (x->avl_link[0] != NULL) {
assert(height < 2 * (AVL_MAX_HEIGHT + 1));
@@ -754,6 +781,8 @@ struct avl_table *avl_copy(const struct avl_table *org, avl_copy_func * copy,
x = stack[--height];
}
}
+
+ return new;
}
/* Frees storage allocated for |tree|.
@@ -764,7 +793,8 @@ void avl_destroy(struct avl_table *tree, avl_item_func * destroy)
assert(tree != NULL);
- for (p = tree->avl_root; p != NULL; p = q)
+ p = tree->avl_root;
+ while (p != NULL) {
if (p->avl_link[0] == NULL) {
q = p->avl_link[1];
if (destroy != NULL && p->avl_data != NULL)
@@ -776,6 +806,8 @@ void avl_destroy(struct avl_table *tree, avl_item_func * destroy)
p->avl_link[0] = q->avl_link[1];
q->avl_link[1] = p;
}
+ p = q;
+ }
tree->avl_alloc->libavl_free(tree->avl_alloc, tree);
}
@@ -785,6 +817,7 @@ void avl_destroy(struct avl_table *tree, avl_item_func * destroy)
void *avl_malloc(struct libavl_allocator *allocator, size_t size)
{
assert(allocator != NULL && size > 0);
+
return malloc(size);
}
@@ -801,6 +834,9 @@ struct libavl_allocator avl_allocator_default = {
avl_free
};
+#undef NDEBUG
+#include <assert.h>
+
/* Asserts that |avl_insert()| succeeds at inserting |item| into |table|. */
void (avl_assert_insert) (struct avl_table * table, void *item)
{
@@ -816,5 +852,6 @@ void *(avl_assert_delete) (struct avl_table * table, void *item)
void *p = avl_delete(table, item);
assert(p != NULL);
+
return p;
}
diff --git a/lib/vector/dglib/avl.h b/lib/vector/dglib/avl.h
index ddd766f..3be85da 100644
--- a/lib/vector/dglib/avl.h
+++ b/lib/vector/dglib/avl.h
@@ -1,25 +1,23 @@
-/* Produced by texiweb from libavl.w on 2002/02/09 at 01:45. */
+/* Produced by texiweb from libavl.w. */
/* libavl - library for manipulation of binary trees.
- Copyright (C) 1998-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- The author may be contacted at <blp at gnu.org> on the Internet, or
- as Ben Pfaff, 12167 Airport Rd, DeWitt MI 48820, USA through more
- mundane means.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
*/
#ifndef AVL_H
@@ -48,9 +46,9 @@ extern struct libavl_allocator avl_allocator_default;
void *avl_malloc(struct libavl_allocator *, size_t);
void avl_free(struct libavl_allocator *, void *);
-/* Maximum AVL height. */
+/* Maximum AVL tree height. */
#ifndef AVL_MAX_HEIGHT
-#define AVL_MAX_HEIGHT 32
+#define AVL_MAX_HEIGHT 92
#endif
/* Tree data structure. */
diff --git a/lib/vector/dglib/tavl.c b/lib/vector/dglib/tavl.c
index ded62d7..2f69bd1 100644
--- a/lib/vector/dglib/tavl.c
+++ b/lib/vector/dglib/tavl.c
@@ -1,25 +1,28 @@
-/* Produced by texiweb from libavl.w on 2002/02/09 at 01:45. */
+/* Produced by texiweb from libavl.w. */
/* libavl - library for manipulation of binary trees.
- Copyright (C) 1998-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+ */
- The author may be contacted at <blp at gnu.org> on the Internet, or
- as Ben Pfaff, 12167 Airport Rd, DeWitt MI 48820, USA through more
- mundane means.
+/* Nov 2016, Markus Metz
+ * from libavl-2.0.3
+ * added safety checks and speed optimizations
*/
#include <assert.h>
@@ -63,10 +66,7 @@ void *tavl_find(const struct tavl_table *tree, const void *item)
assert(tree != NULL && item != NULL);
p = tree->tavl_root;
- if (p == NULL)
- return NULL;
-
- for (;;) {
+ while (p != NULL) {
int cmp, dir;
cmp = tree->tavl_compare(item, p->tavl_data, tree->tavl_param);
@@ -77,8 +77,10 @@ void *tavl_find(const struct tavl_table *tree, const void *item)
if (p->tavl_tag[dir] == TAVL_CHILD)
p = p->tavl_link[dir];
else
- return NULL;
+ p = NULL;
}
+
+ return NULL;
}
/* Inserts |item| into |tree| and returns a pointer to |item|'s address.
@@ -100,24 +102,21 @@ void **tavl_probe(struct tavl_table *tree, void *item)
z = (struct tavl_node *)&tree->tavl_root;
y = tree->tavl_root;
- if (y != NULL) {
- for (q = z, p = y;; q = p, p = p->tavl_link[dir]) {
- int cmp =
- tree->tavl_compare(item, p->tavl_data, tree->tavl_param);
- if (cmp == 0)
- return &p->tavl_data;
-
- if (p->tavl_balance != 0)
- z = q, y = p, k = 0;
- da[k++] = dir = cmp > 0;
-
- if (p->tavl_tag[dir] == TAVL_THREAD)
- break;
- }
- }
- else {
- p = z;
- dir = 0;
+ dir = 0;
+ q = z, p = y;
+ while (p != NULL) {
+ int cmp =
+ tree->tavl_compare(item, p->tavl_data, tree->tavl_param);
+ if (cmp == 0)
+ return &p->tavl_data;
+
+ if (p->tavl_balance != 0)
+ z = q, y = p, k = 0;
+ da[k++] = dir = cmp > 0;
+
+ if (p->tavl_tag[dir] == TAVL_THREAD)
+ break;
+ q = p, p = p->tavl_link[dir];
}
n = tree->tavl_alloc->libavl_malloc(tree->tavl_alloc, sizeof *n);
@@ -127,23 +126,26 @@ void **tavl_probe(struct tavl_table *tree, void *item)
tree->tavl_count++;
n->tavl_data = item;
n->tavl_tag[0] = n->tavl_tag[1] = TAVL_THREAD;
- n->tavl_link[dir] = p->tavl_link[dir];
- if (tree->tavl_root != NULL) {
- p->tavl_tag[dir] = TAVL_CHILD;
- n->tavl_link[!dir] = p;
- }
- else
- n->tavl_link[1] = NULL;
- p->tavl_link[dir] = n;
n->tavl_balance = 0;
- if (tree->tavl_root == n)
+ if (y == NULL) {
+ n->tavl_link[0] = n->tavl_link[1] = NULL;
+ tree->tavl_root = n;
+
return &n->tavl_data;
+ }
+ n->tavl_link[dir] = p->tavl_link[dir];
+ n->tavl_link[!dir] = p;
+ p->tavl_tag[dir] = TAVL_CHILD;
+ p->tavl_link[dir] = n;
- for (p = y, k = 0; p != n; p = p->tavl_link[da[k]], k++)
+ p = y, k = 0;
+ while (p != n) {
if (da[k] == 0)
p->tavl_balance--;
else
p->tavl_balance++;
+ p = p->tavl_link[da[k]], k++;
+ }
if (y->tavl_balance == -2) {
struct tavl_node *x = y->tavl_link[0];
@@ -259,6 +261,7 @@ void *tavl_replace(struct tavl_table *table, void *item)
void *r = *p;
*p = item;
+
return r;
}
}
@@ -308,19 +311,26 @@ void *tavl_delete(struct tavl_table *tree, const void *item)
assert(tree != NULL && item != NULL);
- if (tree->tavl_root == NULL)
- return NULL;
+ q = (struct tavl_node *)&tree->tavl_root;
+ p = tree->tavl_root;
+ dir = 0;
+ while (p != NULL) {
+ cmp = tree->tavl_compare(item, p->tavl_data, tree->tavl_param);
+
+ if (cmp == 0)
+ break;
- p = (struct tavl_node *)&tree->tavl_root;
- for (cmp = -1; cmp != 0;
- cmp = tree->tavl_compare(item, p->tavl_data, tree->tavl_param)) {
dir = cmp > 0;
q = p;
- if (p->tavl_tag[dir] == TAVL_THREAD)
- return NULL;
- p = p->tavl_link[dir];
+ if (p->tavl_tag[dir] == TAVL_CHILD)
+ p = p->tavl_link[dir];
+ else
+ p = NULL;
}
+ if (p == NULL)
+ return NULL;
+
item = p->tavl_data;
if (p->tavl_tag[1] == TAVL_THREAD) {
@@ -359,7 +369,7 @@ void *tavl_delete(struct tavl_table *tree, const void *item)
else {
struct tavl_node *s;
- for (;;) {
+ while (r != NULL) {
s = r->tavl_link[0];
if (s->tavl_tag[0] == TAVL_THREAD)
break;
@@ -527,6 +537,7 @@ void *tavl_delete(struct tavl_table *tree, const void *item)
}
tree->tavl_count--;
+
return (void *)item;
}
@@ -590,15 +601,13 @@ void *tavl_t_find(struct tavl_traverser *trav, struct tavl_table *tree,
trav->tavl_node = NULL;
p = tree->tavl_root;
- if (p == NULL)
- return NULL;
-
- for (;;) {
+ while (p != NULL) {
int cmp, dir;
cmp = tree->tavl_compare(item, p->tavl_data, tree->tavl_param);
if (cmp == 0) {
trav->tavl_node = p;
+
return p->tavl_data;
}
@@ -606,8 +615,12 @@ void *tavl_t_find(struct tavl_traverser *trav, struct tavl_table *tree,
if (p->tavl_tag[dir] == TAVL_CHILD)
p = p->tavl_link[dir];
else
- return NULL;
+ p = NULL;
}
+
+ trav->tavl_node = NULL;
+
+ return NULL;
}
/* Attempts to insert |item| into |tree|.
@@ -634,6 +647,7 @@ void *tavl_t_insert(struct tavl_traverser *trav,
}
else {
tavl_t_init(trav, tree);
+
return NULL;
}
}
@@ -705,11 +719,12 @@ void *tavl_t_cur(struct tavl_traverser *trav)
The new item must not upset the ordering of the tree. */
void *tavl_t_replace(struct tavl_traverser *trav, void *new)
{
- struct tavl_node *old;
+ void *old;
assert(trav != NULL && trav->tavl_node != NULL && new != NULL);
old = trav->tavl_node->tavl_data;
trav->tavl_node->tavl_data = new;
+
return old;
}
@@ -748,6 +763,9 @@ copy_node(struct tavl_table *tree,
return 1;
}
+/* Destroys |new| with |tavl_destroy (new, destroy)|,
+ first initializing the right link in |new| that has
+ not yet been initialized. */
static void
copy_error_recovery(struct tavl_node *p,
struct tavl_table *new, tavl_item_func * destroy)
@@ -798,7 +816,7 @@ struct tavl_table *tavl_copy(const struct tavl_table *org,
rq.tavl_link[0] = NULL;
rq.tavl_tag[0] = TAVL_THREAD;
- for (;;) {
+ while (p != NULL) {
if (p->tavl_tag[0] == TAVL_CHILD) {
if (!copy_node(new, q, 0, p->tavl_link[0], copy)) {
copy_error_recovery(rq.tavl_link[0], new, destroy);
@@ -830,6 +848,8 @@ struct tavl_table *tavl_copy(const struct tavl_table *org,
return NULL;
}
}
+
+ return new;
}
/* Frees storage allocated for |tree|.
@@ -840,9 +860,10 @@ void tavl_destroy(struct tavl_table *tree, tavl_item_func * destroy)
struct tavl_node *n; /* Next node. */
p = tree->tavl_root;
- if (p != NULL)
+ if (p != NULL) {
while (p->tavl_tag[0] == TAVL_CHILD)
p = p->tavl_link[0];
+ }
while (p != NULL) {
n = p->tavl_link[1];
@@ -881,6 +902,9 @@ struct libavl_allocator tavl_allocator_default = {
tavl_free
};
+#undef NDEBUG
+#include <assert.h>
+
/* Asserts that |tavl_insert()| succeeds at inserting |item| into |table|. */
void (tavl_assert_insert) (struct tavl_table * table, void *item)
{
@@ -896,5 +920,6 @@ void *(tavl_assert_delete) (struct tavl_table * table, void *item)
void *p = tavl_delete(table, item);
assert(p != NULL);
+
return p;
}
diff --git a/lib/vector/dglib/tavl.h b/lib/vector/dglib/tavl.h
index 16f6642..02958bc 100644
--- a/lib/vector/dglib/tavl.h
+++ b/lib/vector/dglib/tavl.h
@@ -1,25 +1,23 @@
-/* Produced by texiweb from libavl.w on 2002/02/09 at 01:45. */
+/* Produced by texiweb from libavl.w. */
/* libavl - library for manipulation of binary trees.
- Copyright (C) 1998-2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- The author may be contacted at <blp at gnu.org> on the Internet, or
- as Ben Pfaff, 12167 Airport Rd, DeWitt MI 48820, USA through more
- mundane means.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
*/
#ifndef TAVL_H
@@ -50,7 +48,7 @@ void tavl_free(struct libavl_allocator *, void *);
/* Maximum TAVL height. */
#ifndef TAVL_MAX_HEIGHT
-#define TAVL_MAX_HEIGHT 32
+#define TAVL_MAX_HEIGHT 92
#endif
/* Tree data structure. */
diff --git a/misc/m.measure/m.measure.html b/misc/m.measure/m.measure.html
index b94db39..2d544fc 100644
--- a/misc/m.measure/m.measure.html
+++ b/misc/m.measure/m.measure.html
@@ -4,6 +4,49 @@
and areas of lines and polygons. Areas can be stated in acres,
hectares, square miles, square meters and square kilometers.
+<h2>EXAMPLES</h2>
+
+Distance example in a latitude-longitude location (on great circle, i.e. an orthodrome):
+
+<div class="code"><pre>
+Bonn_DE="7.09549,50.73438"
+Philadelphia_US="-75.16379,39.95233"
+
+m.measure coordinates="$Bonn_DE,$Philadelphia_US" units=kilometers
+Length: 6217.916452 kilometers
+</pre></div>
+
+<div align="center" style="margin: 10px">
+<a href="m_measure_distance.png">
+<img src="m_measure_distance.png" width="600" alt="Visualization (with d.geodesic) of m.measure distance example" border=0><br>
+</a>
+<i>Visualization (with d.geodesic) of m.measure distance example</i>
+</div>
+
+<p>
+As an example for the North Carolina sample dataset, here four points
+describing a square of 1000m side length:
+
+<div class="code"><pre>
+m.measure units=meters \
+ coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
+Length: 3000.000000 meters
+Area: 1000000.000000 square meters
+
+# script style output:
+m.measure -g units=hectares \
+ coordinates=922000,2106000,923000,2106000,923000,2107000,922000,2107000
+units=meters,square meters
+length=3000.000000
+area=1000000.000000
+</pre></div>
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="d.geodesic.html">d.geodesic</a>
+</em>
+
<h2>AUTHORS</h2>
Glynn Clements
@@ -13,4 +56,4 @@ Some updates by Martin Landa, CTU in Prague, Czech Republic
Derived from d.measure by James Westervelt, Michael Shapiro, U.S. Army
Construction Engineering Research Laboratory
-<p><i>Last changed: $Date: 2011-11-08 13:24:20 -0800 (Tue, 08 Nov 2011) $</i>
+<p><i>Last changed: $Date: 2016-12-17 13:29:46 +0100 (Sat, 17 Dec 2016) $</i>
diff --git a/misc/m.measure/m_measure_distance.png b/misc/m.measure/m_measure_distance.png
new file mode 100644
index 0000000..10a843f
Binary files /dev/null and b/misc/m.measure/m_measure_distance.png differ
diff --git a/mswindows/GRASS-Installer.nsi.tmpl b/mswindows/GRASS-Installer.nsi.tmpl
index bf5c376..0d4c4b5 100644
--- a/mswindows/GRASS-Installer.nsi.tmpl
+++ b/mswindows/GRASS-Installer.nsi.tmpl
@@ -3,7 +3,7 @@
;GRASS GIS Installer for Windows
;Written by Marco Pasetti
;Updated for OSGeo4W by Colin Nielsen, Helmut Kudrnovsky, and Martin Landa
-;Last Update: $Id: GRASS-Installer.nsi.tmpl 69812 2016-11-13 23:09:36Z neteler $
+;Last Update: $Id: GRASS-Installer.nsi.tmpl 70126 2016-12-23 14:48:55Z martinl $
;Mail to: grass-dev at lists.osgeo.org
;----------------------------------------------------------------------------------------------------------------------------
@@ -490,6 +490,13 @@ FunctionEnd
;Declares the variables for optional Sample Data Sections
Var /GLOBAL HTTP_PATH
Var /GLOBAL ARCHIVE_NAME
+;Var /GLOBAL ARCHIVE_NAME2005
+Var /GLOBAL ARCHIVE_NAME2008
+Var /GLOBAL ARCHIVE_NAME2010
+!if ${PLATFORM} == "x86_64"
+ Var /GLOBAL ARCHIVE_NAME2012
+!endif
+Var /GLOBAL ARCHIVE_NAME2013
Var /GLOBAL EXTENDED_ARCHIVE_NAME
Var /GLOBAL ORIGINAL_UNTAR_FOLDER
Var /GLOBAL CUSTOM_UNTAR_FOLDER
@@ -802,12 +809,31 @@ Function DownloadInstallMSRuntime
SetShellVarContext current
InitPluginsDir
NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME"
+ ;!if ${PLATFORM} == "x86"
+ ; NSISdl::download "$HTTP_PATH/msvcrt2005/$ARCHIVE_NAME2005" "$TEMP\$ARCHIVE_NAME2005"
+ ;!endif
+ NSISdl::download "$HTTP_PATH/msvcrt2008/$ARCHIVE_NAME2008" "$TEMP\$ARCHIVE_NAME2008"
+ NSISdl::download "$HTTP_PATH/msvcrt2010/$ARCHIVE_NAME2010" "$TEMP\$ARCHIVE_NAME2010"
+ !if ${PLATFORM} == "x86_64"
+ NSISdl::download "$HTTP_PATH/msvcrt2012/$ARCHIVE_NAME2012" "$TEMP\$ARCHIVE_NAME2012"
+ !endif
+ NSISdl::download "$HTTP_PATH/msvcrt2013/$ARCHIVE_NAME2013" "$TEMP\$ARCHIVE_NAME2013"
+
Pop $0
StrCmp $0 "success" download_ok download_failed
download_ok:
InitPluginsDir
untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME"
+ ;!if ${PLATFORM} == "x86"
+ ; untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2005"
+ ;!endif
+ untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2008"
+ untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2010"
+ !if ${PLATFORM} == "x86_64"
+ untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2012"
+ !endif
+ untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME2013"
Pop $0
StrCmp $0 "success" untar_ok untar_failed
@@ -825,12 +851,27 @@ Function DownloadInstallMSRuntime
untar_ok:
DetailPrint "Archive successfully unzipped."
- DetailPrint "Installing vcredist_2005_x86.exe ..."
- ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2005_x86.exe" /q'
- DetailPrint "Installing vcredist_2008_x86.exe ..."
- ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2008_x86.exe" /q'
- DetailPrint "Installing vcredist_2010_x86.exe ..."
- ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2010_x86.exe" /q'
+ !if ${PLATFORM} == "x86"
+ ; seems to be not needed, see #2996
+ ;DetailPrint "Installing vcredist_2005_x86.exe ..."
+ ;ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2005_x86.exe" /q'
+ DetailPrint "Installing vcredist_2008_x86.exe ..."
+ ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2008_x86.exe" /q'
+ DetailPrint "Installing vcredist_2010_x86.exe ..."
+ ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2010_x86.exe" /q'
+ DetailPrint "Installing vcredist_2013_x86.exe ..."
+ ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2013_x86.exe" /q'
+ !else
+ DetailPrint "Installing vcredist_2008_x64.exe ..."
+ ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2008-sp1-x64.exe" /q'
+ DetailPrint "Installing vcredist_2010_x64.exe ..."
+ ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2010-x64.exe" /q'
+ ; msvcrt2012 package contains dll files
+ ;DetailPrint "Installing vcredist_2012_x64.exe ..."
+ ;ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2012-x64.exe" /q'
+ DetailPrint "Installing vcredist_2013_x64.exe ..."
+ ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist-2013-x64.exe" /q'
+ !endif
DetailPrint "Copying runtime files ..."
CopyFiles "$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "$INSTALL_DIR\extrabin"
DetailPrint "MS runtime files installed."
@@ -843,7 +884,7 @@ FunctionEnd
Section "Important Microsoft Runtime DLLs" SecMSRuntime
;Set the size (in KB) of the archive file
- StrCpy $ARCHIVE_SIZE_KB 12521
+ StrCpy $ARCHIVE_SIZE_KB 18512
;Set the size (in KB) of the unpacked archive file
AddSize 13500
@@ -851,8 +892,16 @@ Section "Important Microsoft Runtime DLLs" SecMSRuntime
StrCpy $HTTP_PATH "http://download.osgeo.org/osgeo4w/${PLATFORM}/release/msvcrt/"
!if ${PLATFORM} == "x86_64"
StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-8.tar.bz2"
+ StrCpy $ARCHIVE_NAME2008 "msvcrt2008-1.0.0-1.tar.bz2"
+ StrCpy $ARCHIVE_NAME2010 "msvcrt2010-1.0.0-1.tar.bz2"
+ StrCpy $ARCHIVE_NAME2012 "msvcrt2012-1.0.0-1.tar.bz2"
+ StrCpy $ARCHIVE_NAME2013 "msvcrt2013-1.0.0-1.tar.bz2"
!else
- StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-12.tar.bz2"
+ StrCpy $ARCHIVE_NAME "msvcrt-1.0.1-13.tar.bz2"
+ ;StrCpy $ARCHIVE_NAME2005 "msvcrt2005-1.0-1.tar.bz2"
+ StrCpy $ARCHIVE_NAME2008 "msvcrt2008-1.0-1.tar.bz2"
+ StrCpy $ARCHIVE_NAME2010 "msvcrt2010-1.0-1.tar.bz2"
+ StrCpy $ARCHIVE_NAME2013 "msvcrt2013-1.0-1.tar.bz2"
!endif
StrCpy $EXTENDED_ARCHIVE_NAME "Microsoft Visual C++ Redistributable Packages"
StrCpy $ORIGINAL_UNTAR_FOLDER "install_msruntime"
@@ -882,6 +931,7 @@ Function DownloadDataSet
SetShellVarContext current
InitPluginsDir
NSISdl::download "$HTTP_PATH/$ARCHIVE_NAME" "$TEMP\$ARCHIVE_NAME"
+
Pop $0
StrCmp $0 "success" download_ok download_failed
diff --git a/mswindows/external/README.license b/mswindows/external/README.license
index 53bde5e..2423c61 100644
--- a/mswindows/external/README.license
+++ b/mswindows/external/README.license
@@ -17,5 +17,5 @@ comments carefully.
* Windows batchfiles for use with R / (GNU GPL v2)
http://code.google.com/p/batchfiles/
-
+ https://github.com/ggrothendieck/batchfiles (new code repository)
diff --git a/mswindows/osgeo4w/env.bat.tmpl b/mswindows/osgeo4w/env.bat.tmpl
index b77ca0a..be5b243 100644
--- a/mswindows/osgeo4w/env.bat.tmpl
+++ b/mswindows/osgeo4w/env.bat.tmpl
@@ -22,3 +22,6 @@ set FONTCONFIG_FILE=%GISBASE%\etc\fonts.conf
REM set RStudio temporarily to %PATH% if it exists
IF EXIST "%ProgramFiles%\RStudio\bin\rstudio.exe" set PATH=%PATH%;%ProgramFiles%\RStudio\bin
+
+REM set R_USER if %USERPROFILE%\Documents\R\ exists to catch most common cases of private R libraries
+IF EXIST "%USERPROFILE%\Documents\R\" set R_USER=%USERPROFILE%\Documents\
diff --git a/mswindows/osgeo4w/setup.hint.tmpl b/mswindows/osgeo4w/setup.hint.tmpl
index 937e88b..e571872 100644
--- a/mswindows/osgeo4w/setup.hint.tmpl
+++ b/mswindows/osgeo4w/setup.hint.tmpl
@@ -1,7 +1,7 @@
sdesc: "GRASS GIS - daily builds of development version"
ldesc: "Geographic Resources Analysis Support System (GRASS GIS) - daily builds of SVN release branch"
category: Desktop
-requires: liblas avce00 gpsbabel gs gdal-python matplotlib msvcrt iconv libtiff gdal proj freetype-mingw pdcurses zlib fftw libpng wxpython python-numpy python-pil pyopengl cairo psycopg2
+requires: liblas avce00 gpsbabel gs gdal-python matplotlib msvcrt iconv libtiff gdal proj freetype-mingw pdcurses zlib fftw libpng wxpython python-numpy python-pil pyopengl cairo psycopg2 rbatch
maintainer: MartinLanda
-test: @GRASS_VERSION_NUMBER at -1
+curr: @GRASS_VERSION_NUMBER at -1
prev: @GRASS_VERSION_NUMBER at -1
diff --git a/raster/r.category/r.category.html b/raster/r.category/r.category.html
index 759b365..67a3454 100644
--- a/raster/r.category/r.category.html
+++ b/raster/r.category/r.category.html
@@ -39,7 +39,8 @@ another program.
The <b>rules</b> option allows the user to assign category labels from values
found in a file. The label can refer to a single category, range of
categories, floating point value, or a range of floating point values.
-The format is given as follows (when separator is set to colon).
+The format is given as follows (when separator is set to colon; no white space
+must be used after the separator):
<div class="code"><pre>
cat:Label
val1:val2:Label
@@ -110,50 +111,52 @@ avoid unwanted shell substitution.
Spearfish sample dataset:
-<p><dl>
-<dt><span class="code"><tt>
+<h3>Printing categories</h3>
+<div class="code"><pre>
r.category map=soils
-</tt></span>
-<dd>
+</pre></div>
+
prints the values and labels associated with all of the categories in the
-<em>soils</em> raster map layer;
+<em>soils</em> raster map layer.
-<dt><span class="code"><tt>
+<p>
+<div class="code"><pre>
r.category map=soils cats=10,12,15-20
-</tt></span>
-<dd>
+</pre></div>
+
prints only the category values and labels for <em>soils</em> map layer
-categories <tt>10, 12</tt>, and <tt>15</tt> through <tt>20</tt>; and
+categories <tt>10, 12</tt>, and <tt>15</tt> through <tt>20</tt>.
-<dt><span class="code"><tt>
+<p>
+<div class="code"><pre>
r.category map=soils cats=10,20 separator=':'
-</tt></span>
-<dd>
+</pre></div>
+
prints the values and labels for <em>soils</em> map layer categories
<tt>10</tt> and <tt>20</tt>, but uses "<tt>:</tt>" (instead of a tab)
as the character separating the category values from the category
-values in the output.
-</dl>
+values in the output:
-<dl>
-<dt>Example output:
-<dd>
-<p><div class="code"><pre>
+Example output:
+<div class="code"><pre>
10:Dumps, mine, Cc
20:Kyle clay, KaA
</pre></div>
-</dl>
-<dl>
-<dt>Example defining category labels:
-<dd><div class="code"><pre>
+<h3>Adding categories</h3>
+
+Example for defining new category labels:
+<div class="code"><pre>
r.category diseasemap separator=: rules=- << EOF
1:potential absence
2:potential presence
EOF
</pre></div>
-<p>sets the categoy values 1 and 2 to respective text labels.
-</dl>
+
+This sets the categoy values 1 and 2 to respective text labels.
+
+Alternatively, the rules can be stored in an ASCII text file and loaded
+via the <em>rules</em> parameter.
<h2>SEE ALSO</h2>
@@ -173,4 +176,4 @@ UNIX Manual entries for <i>awk</i> and <i>sort</i>
Michael Shapiro, U.S. Army Construction Engineering Research Laboratory<br>
Hamish Bowman, University of Otago, New Zealand (label creation options)
-<p><i>Last changed: $Date: 2016-03-08 09:06:33 +0100 (Tue, 08 Mar 2016) $</i>
+<p><i>Last changed: $Date: 2016-11-30 16:49:05 +0100 (Wed, 30 Nov 2016) $</i>
diff --git a/raster/r.contour/r.contour.html b/raster/r.contour/r.contour.html
index 8d8025b..c50f4e0 100644
--- a/raster/r.contour/r.contour.html
+++ b/raster/r.contour/r.contour.html
@@ -32,16 +32,38 @@ with contour levels from 1000m to 2000m, 100m contour step, and a minimum of 200
points contributing to the contour line:
<div class="code"><pre>
-r.contour input=elevation.dem output=elevation_dem_contours minlevel=1000 maxlevel=2000 step=100 cut=200
+r.contour input=elevation.dem output=elevation_dem_contours \
+ minlevel=1000 maxlevel=2000 step=100 cut=200
</pre></div>
<p>
+For an example of using levels with <em>r.contour</em> this example uses
+the elevation map from the North Carolina database:
+
+<div class="code"><pre>
+g.region raster=elevation
+r.contour in=elevation out=contours levels=60,90,120,150 --o
+d.mon wx0
+d.rast elevation_shade
+d.vect contours color=red
+</pre></div>
+
+<div align="center" style="margin: 10px">
+<a href="r_contour_using_levels.png">
+<img src="r_contour_using_levels.png" width="600" alt="r.contours example" border=0><br>
+</a>
+<i>Contour lines shown on shaded terrain map</i>
+</div>
+
-North Carolina example:
<p>
+For an example of using steps with <em>r.contour</em> this example uses
+the LiDAR data derived elevation map from the North Carolina database:
+
<div class="code"><pre>
g.region raster=elev_lid792_1m -p
-r.contour input=elev_lid792_1m output=elev_lid792_1m_contours minlevel=100 maxlevel=150 step=10
+r.contour input=elev_lid792_1m output=elev_lid792_1m_contours \
+ minlevel=100 maxlevel=150 step=10
</pre></div>
<h2>AUTHORS</h2>
@@ -50,5 +72,5 @@ Terry Baker, U.S. Army Construction Engineering Research Laboratory<br>
3/2001: cut parameter and fixes by Andrea Aime (aaime at libero.it)
<p>
-<i>Last changed: $Date: 2014-12-19 22:17:36 +0100 (Fri, 19 Dec 2014) $</i>
+<i>Last changed: $Date: 2016-12-09 19:15:57 +0100 (Fri, 09 Dec 2016) $</i>
diff --git a/raster/r.contour/r_contour_using_levels.png b/raster/r.contour/r_contour_using_levels.png
new file mode 100644
index 0000000..608258e
Binary files /dev/null and b/raster/r.contour/r_contour_using_levels.png differ
diff --git a/raster/r.fill.dir/main.c b/raster/r.fill.dir/main.c
index f3794eb..382ddcc 100644
--- a/raster/r.fill.dir/main.c
+++ b/raster/r.fill.dir/main.c
@@ -85,6 +85,9 @@ int main(int argc, char **argv)
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("hydrology"));
+ G_add_keyword(_("sink"));
+ G_add_keyword(_("fill sinks"));
+ G_add_keyword(_("depressions"));
module->description =
_("Filters and generates a depressionless elevation map and a "
"flow direction map from a given elevation raster map.");
diff --git a/raster/r.fill.dir/r.fill.dir.html b/raster/r.fill.dir/r.fill.dir.html
index f66fe15..ca26b5c 100644
--- a/raster/r.fill.dir/r.fill.dir.html
+++ b/raster/r.fill.dir/r.fill.dir.html
@@ -11,8 +11,11 @@ the flow direction map. The <i>agnps</i> format gives category values from
The <i>answers</i> format gives category values from 0-360 degrees, with 0
(360) facing east and values increasing in the counter clockwise direction
at 45 degree increments. The <i>grass</i> format gives the same category
-values as the <em><a href="r.slope.aspect.html">r.slope.aspect</a></em>
-program.<p>
+values as <em><a href="r.slope.aspect.html">r.slope.aspect</a></em>.
+<p>
+The flow direction map can be visualized with
+<em><a href="d.rast.arrow.html">d.rast.arrow</a></em>.
+<p>
The method adopted to filter the elevation map and rectify it is
based on the paper titled "Software Tools to Extract Structure from Digital
Elevation Data for Geographic Information System Analysis" by S.K. Jenson
@@ -32,9 +35,9 @@ direction to the highest slope out of the cell. If there is more than one
equal, non-zero slope then the code picks one direction based on preferences
that are hard-coded into the program. If the highest slope is flat and in
more than one direction then the code first tries to select an alternative
-based on flow directions in the adjacent cells. <em>r.fill.dir</em> iteratates that process,
+based on flow directions in the adjacent cells. <em>r.fill.dir</em> iterates that process,
effectively propagating flow directions from areas where the directions are
-known into the area where the flow direction can't otherwise be resolved.
+known into the area where the flow direction cannot otherwise be resolved.
<p>The flow direction map can be encoded in either ANSWERS (Beasley et.al,
1982) or AGNPS (Young et.al, 1985) form, so that it can be readily used as
@@ -53,39 +56,85 @@ the best way to solve a drainage problem. These options let the user get a
partially-fixed elevation map, identify the remaining problems and fix the
problems appropriately.
<p>
-<em>r.fill.dir</em> is sensitive to the current window setting. Thus
-the program can be used to generate a flow direction map for any
+<em>r.fill.dir</em> is sensitive to the computational region settings. Thus
+the module can be used to generate a flow direction map for any
sub-area within the full map layer. Also, <em>r.fill.dir</em> is
-sensitive to any <em>mask</em> in effect.
+sensitive to any raster <em>MASK</em> in effect.
<p>
In some cases it may be necessary to run <em>r.fill.dir</em> repeatedly (using output
from one run as input to the next run) before all of problem areas are
filled.
-<h2>EXAMPLE</h2>
+<h2>EXAMPLES</h2>
+Generic example: create a depressionless (sinkless) elevation
+map <i>ansi.fill.elev</i> and a flow direction map <i>ansi.asp</i> for the
+type "grass":
<div class="code"><pre>
r.fill.dir input=ansi.elev output=ansi.fill.elev direction=ansi.asp
</pre></div>
-Will create a depressionless (sinkless) elevation
-map <i>ansi.fill.elev</i> and a flow direction map <i>ansi.asp</i> for the
-type "grass".
+<p>
+
+North Carolina sample dataset example: The LiDAR derived 1m elevation map is
+sink-filled. The outcome are a depressionless elevation map, the flow direction
+map and an error map.
+
+<div class="code"><pre>
+# set computational region to elevation map
+g.region raster=elev_lid792_1m -p
+# generate depressionless DEM and related maps
+r.fill.dir input=elev_lid792_1m output=elev_lid792_1m_filled \
+ direction=elev_lid792_1m_dir areas=elev_lid792_1m_error
+
+# generate elevation map of pixelwise differences to see obtained terrain alterations
+r.mapcalc "elev_lid792_1m_diff = elev_lid792_1m_filled - elev_lid792_1m"
+r.colors elev_lid792_1m_diff color=differences
+
+# assess univariate statistics of differences
+r.univar -e elev_lid792_1m_diff
+
+# vectorize filled areas (here all fills are of positive value, see r.univar output)
+r.mapcalc "elev_lid792_1m_fill_area = if(elev_lid792_1m_diff > 0.0, 1, null() )"
+r.to.vect input=elev_lid792_1m_fill_area output=elev_lid792_1m_fill_area type=area
+
+# generate shaded terrain for better visibility of results
+r.relief input=elev_lid792_1m output=elev_lid792_1m_shade
+
+d.mon wx0
+d.shade shade=elev_lid792_1m_shade color=elev_lid792_1m_filled
+d.vect elev_lid792_1m_fill_area type=boundary color=red
+</pre></div>
+
+<div align="center" style="margin: 10px">
+<a href="r_fill_dir.png">
+<img src="r_fill_dir.png" width="600" alt="r.fill.dir example" border=0><br>
+</a>
+<i>Figure: Sink-filled DEM (shown as shaded terrain) with areas of filling shown as vector polygons</i>
+</div>
+
<h2>REFERENCES</h2>
<ul>
-<li>Beasley, D.B. and L.F. Huggins. 1982. ANSWERS (areal nonpoint source watershed environmental response simulation): User's manual. U.S. EPA-905/9-82-001, Chicago, IL, 54 p.
+<li>Beasley, D.B. and L.F. Huggins. 1982. ANSWERS (areal nonpoint source watershed environmental
+response simulation): User's manual. U.S. EPA-905/9-82-001, Chicago, IL, 54 p.
<li>Jenson, S.K., and J.O. Domingue. 1988. Extracting topographic structure from
-digital elevation model data for geographic information system analysis. Photogram. Engr. and Remote Sens. 54: 1593-1600.
-<li>Young, R.A., C.A. Onstad, D.D. Bosch and W.P. Anderson. 1985. Agricultural nonpoint surface pollution models (AGNPS) I and II model documentation. St. Paul: Minn. Pollution control Agency and Washington D.C., USDA-Agricultural Research
-Service.
+digital elevation model data for geographic information system analysis. Photogram.
+Engr. and Remote Sens. 54: 1593-1600.
+<li>Young, R.A., C.A. Onstad, D.D. Bosch and W.P. Anderson. 1985. Agricultural nonpoint
+surface pollution models (AGNPS) I and II model documentation. St. Paul: Minn. Pollution
+control Agency and Washington D.C., USDA-Agricultural Research Service.
</ul>
<h2>SEE ALSO</h2>
<em>
+<a href="d.rast.arrow.html">d.rast.arrow</a>,
+<a href="d.shade.html">d.shade</a>,
+<a href="g.region.html">g.region</a>,
<a href="r.fillnulls.html">r.fillnulls</a>,
+<a href="r.relief.html">r.relief</a>,
<a href="r.slope.aspect.html">r.slope.aspect</a>
</em>
@@ -97,4 +146,4 @@ Rewrite to C with enhancements:
Roger S. Miller
<p>
-<i>Last changed: $Date: 2014-11-28 17:22:17 +0100 (Fri, 28 Nov 2014) $</i>
+<i>Last changed: $Date: 2016-12-11 19:03:35 +0100 (Sun, 11 Dec 2016) $</i>
diff --git a/raster/r.fill.dir/r_fill_dir.png b/raster/r.fill.dir/r_fill_dir.png
new file mode 100644
index 0000000..3d49fab
Binary files /dev/null and b/raster/r.fill.dir/r_fill_dir.png differ
diff --git a/raster/r.param.scale/r.param.scale.html b/raster/r.param.scale/r.param.scale.html
index ee4dd21..d2ded51 100644
--- a/raster/r.param.scale/r.param.scale.html
+++ b/raster/r.param.scale/r.param.scale.html
@@ -70,17 +70,21 @@ Note that the aspect map is calculated differently from
<h2>EXAMPLE</h2>
-The next commands will create a geomorphological map of the Spearfish region:
+The next commands will create a geomorphological map of the Spearfish sample
+dataset region:
<div class="code"><pre>
g.region raster=elevation.10m -p
-r.param.scale in=elevation.10m output=morphology param=feature size=9
+r.param.scale in=elevation.10m output=morphology method=feature size=9
</pre></div>
-<p><center>
-<img src="r_param_scale_morph.jpg" alt="r.param.scale generated geomorphological map"><br>
-<i>Geomorphological map of a subregion in the Spearfish (SD) area</i>
-</center>
+<div align="center" style="margin: 10px">
+<a href="r_param_scale_morph.jpg">
+<img src="r_param_scale_morph.jpg" width="600" alt="r.param.scale example" border=0><br>
+</a>
+<i>Figure: Geomorphological map of a subregion in the Spearfish (SD) area</i>
+</div>
+
<h2>TODO</h2>
@@ -117,4 +121,4 @@ tables for all output files (presently only on features).
<p>Update to FP 3/2002: L. Potrich, M. Neteler, S. Menegon (ITC-irst)
<p>
-<i>Last changed: $Date: 2016-06-22 19:07:12 +0200 (Wed, 22 Jun 2016) $</i>
+<i>Last changed: $Date: 2016-12-11 19:03:35 +0100 (Sun, 11 Dec 2016) $</i>
diff --git a/raster/r.quantile/main.c b/raster/r.quantile/main.c
index 92a9674..96aae93 100644
--- a/raster/r.quantile/main.c
+++ b/raster/r.quantile/main.c
@@ -255,6 +255,8 @@ int main(int argc, char *argv[])
G_add_keyword(_("raster"));
G_add_keyword(_("algebra"));
G_add_keyword(_("statistics"));
+ G_add_keyword(_("percentile"));
+ G_add_keyword(_("quantile"));
module->description = _("Compute quantiles using two passes.");
opt.input = G_define_standard_option(G_OPT_R_INPUT);
diff --git a/raster/r.stats.quantile/main.c b/raster/r.stats.quantile/main.c
index f1b1843..ad67c49 100644
--- a/raster/r.stats.quantile/main.c
+++ b/raster/r.stats.quantile/main.c
@@ -395,6 +395,8 @@ int main(int argc, char *argv[])
module = G_define_module();
G_add_keyword(_("raster"));
G_add_keyword(_("statistics"));
+ G_add_keyword(_("percentile"));
+ G_add_keyword(_("quantile"));
module->description = _("Compute category quantiles using two passes.");
opt.basemap = G_define_standard_option(G_OPT_R_BASE);
diff --git a/raster/r.texture/r.texture.html b/raster/r.texture/r.texture.html
index 4c77c31..65435ab 100644
--- a/raster/r.texture/r.texture.html
+++ b/raster/r.texture/r.texture.html
@@ -3,17 +3,58 @@
<em>r.texture</em> creates raster maps with textural features from a
user-specified raster map layer. The module calculates textural features
based on spatial dependence matrices at 0, 45, 90, and 135
-degrees for a <em>distance</em> (default = 1).
+degrees.
+
+<p>
+In order to take into account the scale of the texture to be measured,
+<em>r.texture</em> allows the user to define the <em>size</em> of the moving
+window and the <em>distance</em> at which to compare pixel grey values. By
+default the module averages the results over the 4 orientations, but the user
+can also request output of the texture variables in 4 different orientations
+(flag <em>-s</em>). Please note that angles are defined in degrees of east and
+they increase counterclockwise, so 0 is East - West, 45 is North-East -
+South-West, 90 is North - South, 135 is North-West - South-East.
+
+<p>
+The user can either chose one or several texture measures (see below for their
+description) using the <em>method</em> parameter, or can request the creating
+of maps for all available methods with the <em>-a</em>.
+
+<p>
+<em>r.texture</em> assumes grey levels ranging from 0 to 255 as input. The
+input is automatically rescaled to 0 to 255 if the input map range is outside of
+this range. In order to reduce noise in the input data (thus generally
+reinforcing the textural features), and to speed up processing, it is
+recommended that the user recode the data using equal-probability quantization.
+Quantization rules for <em>r.recode</em> can be generated with <em>r.quantile
+-r</em> using e.g 16 or 32 quantiles (see example below).
+
+
+<h2>NOTES</h2>
+
<p>
-<em>r.texture</em> assumes grey levels ranging from 0 to 255 as input.
-The input is automatically rescaled to 0 to 255 if the input map range is outside
-of this range.
+Texture is a feature of specific land cover classes in satellite imagery.
+It is particularly useful in situations where spectral differences between
+classes are small, but classes are distinguishable by their organisation on the
+ground, often opposing natural to human-made spaces: cultivated fields vs meadows
+or golf courses, palm tree plantations vs natural rain forest, but texture can
+also be a natural phenomen: dune fields, different canopies due to different
+tree species. The usefulness and use of texture is highly dependend on the
+resolution of satellite imagery and on the scale of the human intervention or
+the phenomenon that created the texture (also see the discussion of scale
+dependency below). The user should observe the phenomenon visually in order to
+determine an adequat setting of the <em>size</em> parameter.
<p>
-In order to reduce noise in the input data, and to speed up processing,
-the input map can be recoded using equal-probability quantization.
-Quantization rules for <em>r.recode</em> can be generated with
-<em>r.quantile -r</em> using e.g 16 or 32 quantiles (see example below).
+The output of <em>r.texture</em> can constitute very useful additional variables
+as input for image classification or image segmentation (object recognition).
+It can be used in supervised classification algorithms such as
+<a href="i.maxlik.html">i.maxlik</a> or <a href="i.smap.html">i.smap</a>,
+or for the identification of objects in <a href="i.segment.html">i.segment</a>,
+and/or for the characterization of these objects and thus, for example, as one
+of the raster inputs of the
+<a href="https://grass.osgeo.org/grass70/manuals/addons/i.segment.stats.html">
+ i.segment.stats</a> addon.
<p>
In general, several variables constitute texture: differences in grey level values,
@@ -23,28 +64,16 @@ properties) and structure (spatial relationships). Since textures are highly sca
dependent, hierarchical textures may occur.
<p>
-<em>r.texture</em> reads a GRASS raster map as input and calculates
-textural features based on spatial dependence matrices for north-south,
-east-west, northwest, and southwest directions using a side by side
-neighborhood (i.e., a distance of 1), and writes out by default the average
-over all angles for each measure. Optionally, using flag <b>-s</b> the output
-consists of four images for each textural feature, one for every direction
-(0, 45, 90, 135).
+<em>r.texture</em> uses the common texture model based on the so-called grey
+level co-occurrence matrix as described by Haralick et al (1973). This matrix
+is a two-dimensional histogram of grey levels for a pair of pixels which are
+separated by a fixed spatial relationship. The matrix approximates the joint
+probability distribution of a pair of pixels. Several texture measures are
+directly computed from the grey level co-occurrence matrix.
<p>
-The user must carefully set the resolution (using <em>g.region</em>) before
-running this program, or the computer may run out of memory.
-
-<p>
-A commonly used texture model is based on the so-called grey level co-occurrence
-matrix. This matrix is a two-dimensional histogram of grey levels
-for a pair of pixels which are separated by a fixed spatial relationship.
-The matrix approximates the joint probability distribution of a pair of pixels.
-Several texture measures are directly computed from the grey level co-occurrence
-matrix.
-<p>
-The following part offers brief explanations of texture measures (after
-Jensen 1996).
+The following part offers brief explanations of the Haralick et al texture
+measures (after Jensen 1996).
<h3>First-order statistics in the spatial domain</h3>
<ul>
@@ -104,9 +133,20 @@ level co-occurrence matrices (GLCM; after Haralick 1979).
<li> Maximal Correlation Coefficient (MCC)</li>
</ul>
-
-<h2>NOTES</h2>
+<p>
+The computational region should be set to the input map with
+<b>g.region rast=<input map></b>, or aligned to the input map
+with <b>g.region align=<input map></b> if only a subregion
+should be analyzed.
+
+<p>
+Note that the output of <em>r.texture</em> will always be smaller than
+the current region as only cells for which there are no null cells and
+for which all cells of the moving window are within the current region
+will contain a value. The output will thus appear cropped at the margins.
+
+<p>
Importantly, the input raster map cannot have more than 255 categories.
<h2>EXAMPLE</h2>
@@ -138,8 +178,55 @@ r.quantile in=ortho_2001_t792_1m quantiles=16 -r | r.recode in=ortho_2001_t792_1
The recoded raster map can then be used as input for r.texture as before.
+<p>
+Second example: analysis of IDM (homogeneity) on a simple raster with
+North-South line pattern.
+
+<div class="code"><pre>
+# import raster
+r.in.ascii in=- output=lines << EOF
+north: 9
+south: 0
+east: 9
+west: 0
+rows: 9
+cols: 9
+0 0 0 1 0 0 0 1 0
+0 0 0 1 0 0 0 1 0
+0 0 0 1 0 0 0 1 0
+0 0 0 1 0 0 0 1 0
+0 0 0 1 0 0 0 1 0
+0 0 0 1 0 0 0 1 0
+0 0 0 1 0 0 0 1 0
+0 0 0 1 0 0 0 1 0
+0 0 0 1 0 0 0 1 0
+EOF
+
+# adjust region to raster
+g.region rast=lines
+
+# calculate IDM (homogeneity) in all directions
+r.texture -s lines method=idm out=text_lines
+</pre></div>
+
+<p>
+The following image shows the original map, the result in East-West direction
+and the result in North-South direction, showing how texture can depend on
+direction, with texture perfectly homogeneous (value=1) in the North-South
+direction, but quite heterogeneous in East-West direction, except for those
+areas where there are three columns of equal values (as size=3).
+The overlayed grid highlights that the texture measures output maps
+are cropped at the margins.
+
+<center>
+ <img src="r_texture_directions_example.png" border=1><br>
+ <i>IDM textures according to direction</i>
+</center>
+
+
<h2>KNOWN ISSUES</h2>
-The program can run incredibly slow for large raster maps.
+The program can run incredibly slow for large raster maps and large
+moving windows (<em>size</em> option).
<h2>REFERENCES</h2>
@@ -168,8 +255,12 @@ of <a href="http://netpbm.sourceforge.net/doc/pgmtexture.html">pgmtexture</a>.
<h2>SEE ALSO</h2>
<em>
+<a href="i.maxlik.html">i.maxlik</a>,
+<a href="i.gensig.html">i.gensig</a>,
<a href="i.smap.html">i.smap</a>,
<a href="i.gensigset.html">i.gensigset</a>,
+<a href="https://grass.osgeo.org/grass70/manuals/addons/i.segment.stats.html">
+ i.segment.stats</a>,
<a href="i.pca.html">i.pca</a>,
<a href="r.neighbors.html">r.neighbors</a>,
<a href="r.rescale.html">r.rescale</a>
@@ -179,6 +270,7 @@ of <a href="http://netpbm.sourceforge.net/doc/pgmtexture.html">pgmtexture</a>.
<a href="mailto:antoniol at ieee.org">G. Antoniol</a> - RCOST (Research Centre on Software Technology - Viale Traiano - 82100 Benevento)<br>
C. Basco - RCOST (Research Centre on Software Technology - Viale Traiano - 82100 Benevento)<br>
M. Ceccarelli - Facolta di Scienze, Universita del Sannio, Benevento<br>
-Markus Metz
+Markus Metz (correction and optimization of the initial version)<br>
+Moritz Lennert (documentation)
-<p><i>Last changed: $Date: 2016-11-16 21:32:28 +0100 (Wed, 16 Nov 2016) $</i>
+<p><i>Last changed: $Date: 2016-11-27 15:59:49 +0100 (Sun, 27 Nov 2016) $</i>
diff --git a/raster/r.texture/r_texture_directions_example.png b/raster/r.texture/r_texture_directions_example.png
new file mode 100644
index 0000000..b665b7b
Binary files /dev/null and b/raster/r.texture/r_texture_directions_example.png differ
diff --git a/raster/r.univar/r.univar.html b/raster/r.univar/r.univar.html
index d07fa52..68e9d5c 100644
--- a/raster/r.univar/r.univar.html
+++ b/raster/r.univar/r.univar.html
@@ -25,7 +25,11 @@ specified saves the user from using a temporary raster map for the result of
As with most GRASS raster modules, <em>r.univar</em> operates on the raster
array defined by the current region settings, not the original extent and
-resolution of the input map. See <em><a href="g.region.html">g.region</a></em>.
+resolution of the input map. See <em><a href="g.region.html">g.region</a></em>,
+but also
+<a href="https://grasswiki.osgeo.org/wiki/Computational_region#Understanding_the_impact_of_region_settings">
+the wiki page on the computational region</a> to understand the impact of the
+region settings on the calculations.
<p>
This module can use large amounts of system memory when the <b>-e</b>
@@ -168,13 +172,14 @@ d.out.file runivar_basins.png
optipng -o5 runivar_basins.png width=200px
-->
-<center>
-<img src="runivar_basins.png" alt="Basins and their IDs" align="middle"
-width="600">
-<p>
-Figure: Zones (basins, opacity: 60%) with underlying elevation map
-for North Carolina sample dataset.
-</center>
+
+<div align="center" style="margin: 10px">
+<a href="runivar_basins.png">
+<img src="runivar_basins.png" width="600" alt="r.univar basins and their IDs" border=0><br>
+</a>
+<i>Figure: Zones (basins, opacity: 60%) with underlying elevation map
+for North Carolina sample dataset.</i>
+</div>
<p>
Then statistics for elevation can be calculated separately for every
@@ -204,14 +209,13 @@ stddev,variance,coeff_var,sum,sum_abs2,,116975,0,55.5787925720215,
Comma Separated Values (CSV) file is best viewed through a spreadsheet
program such as Microsoft Excel, Libre/Open Office Calc or Google Docs:
-<p>
-<center>
-<img src="runivar_basins_elev_zonal.png" alt="TABLE" align="middle"
-width="900">
-<p>
-Figure: Raster statistics for zones (basins, North Carolina sample
-dataset) viewed through Libre/Open Office Calc
-</center>
+<div align="center" style="margin: 10px">
+<a href="runivar_basins_elev_zonal.png">
+<img src="runivar_basins_elev_zonal.png" width="600" alt="r.univar raster statistics" border=0><br>
+</a>
+<i>Figure: Raster statistics for zones (basins, North Carolina sample
+dataset) viewed through Libre/Open Office Calc.</i>
+</div>
<h2>TODO</h2>
@@ -241,4 +245,4 @@ Extended statistics by Martin Landa<br>
Multiple input map support by Ivan Shmakov<br>
Zonal loop by Markus Metz
-<p><i>Last changed: $Date: 2016-11-03 12:46:42 +0100 (Thu, 03 Nov 2016) $</i>
+<p><i>Last changed: $Date: 2016-12-11 19:03:35 +0100 (Sun, 11 Dec 2016) $</i>
diff --git a/raster/r.viewshed/r.viewshed.html b/raster/r.viewshed/r.viewshed.html
index 02f398f..1389261 100644
--- a/raster/r.viewshed/r.viewshed.html
+++ b/raster/r.viewshed/r.viewshed.html
@@ -185,7 +185,7 @@ r.viewshed input=elev_lid792_1m output=elev_lid792_1m_viewshed \
<div align="center" style="margin: 10px">
<a href="r.viewshed.png">
-<img src="r.viewshed.png" width="900" alt="r.viewshed example" border=0><br>
+<img src="r.viewshed.png" width="600" alt="r.viewshed example" border=0><br>
</a>
<i>Viewshed shown on shaded terrain (observer position in the north-east quadrant with white dot; 5m above ground)</i>
</div>
@@ -242,4 +242,4 @@ and Combinatorics (ALENEX/ANALCO 2007)</em>.</li>
<p>Markus Metz
<p>
-<i>Last changed: $Date: 2016-09-13 22:01:13 +0200 (Tue, 13 Sep 2016) $</i>
+<i>Last changed: $Date: 2016-12-09 19:15:57 +0100 (Fri, 09 Dec 2016) $</i>
diff --git a/scripts/d.correlate/d.correlate.py b/scripts/d.correlate/d.correlate.py
index 6eb1c7a..407ed14 100755
--- a/scripts/d.correlate/d.correlate.py
+++ b/scripts/d.correlate/d.correlate.py
@@ -30,7 +30,7 @@ import sys
import os
from grass.script.utils import try_remove
from grass.script import core as gcore
-
+from grass.exceptions import CalledModuleError
def main():
layers = options['map'].split(',')
@@ -44,9 +44,12 @@ def main():
if not gcore.find_file(map, element='cell')['file']:
gcore.fatal(_("Raster map <%s> not found") % map)
- gcore.write_command('d.text', color='black', size=4, line=1,
- stdin="CORRELATION")
-
+ try:
+ gcore.write_command('d.text', color='black', size=4, line=1,
+ stdin="CORRELATION")
+ except CalledModuleError:
+ return 1
+
os.environ['GRASS_RENDER_FILE_READ'] = 'TRUE'
colors = "red black blue green gray violet".split()
@@ -108,6 +111,8 @@ def main():
try_remove(tmpfile)
+ return 0
+
if __name__ == "__main__":
options, flags = gcore.parser()
- main()
+ sys.exit(main())
diff --git a/scripts/i.in.spotvgt/i.in.spotvgt.py b/scripts/i.in.spotvgt/i.in.spotvgt.py
index 2acd632..42f5202 100755
--- a/scripts/i.in.spotvgt/i.in.spotvgt.py
+++ b/scripts/i.in.spotvgt/i.in.spotvgt.py
@@ -33,6 +33,8 @@
#% description: Imports SPOT VGT NDVI data into a raster map.
#% keyword: imagery
#% keyword: import
+#% keyword: NDVI
+#% keyword: SPOT
#%end
#%flag
#% key: a
diff --git a/scripts/r.in.aster/r.in.aster.py b/scripts/r.in.aster/r.in.aster.py
index 82edf1a..187ae41 100755
--- a/scripts/r.in.aster/r.in.aster.py
+++ b/scripts/r.in.aster/r.in.aster.py
@@ -26,7 +26,8 @@
#% keyword: raster
#% keyword: import
#% keyword: imagery
-#% keyword: Terra-ASTER
+#% keyword: ASTER
+#% keyword: elevation
#%End
#%option G_OPT_F_INPUT
#% description: Name of input ASTER image
@@ -126,12 +127,12 @@ def main():
if band in allbands:
dataset = bands[proctype][band]
srcfile = "HDF4_EOS:EOS_SWATH:%s:%s" % (input, dataset)
- import_aster(proj, srcfile, tempfile, band)
+ import_aster(proj, srcfile, tempfile, output, band)
else:
grass.fatal(_('band %s is not an available Terra/ASTER band') % band)
elif proctype == "DEM":
srcfile = input
- import_aster(proj, srcfile, tempfile, "DEM")
+ import_aster(proj, srcfile, tempfile, output, "DEM")
# cleanup
grass.message(_("Cleaning up ..."))
@@ -141,7 +142,7 @@ def main():
return
-def import_aster(proj, srcfile, tempfile, band):
+def import_aster(proj, srcfile, tempfile, output, band):
# run gdalwarp with selected options (must be in $PATH)
# to translate aster image to geotiff
grass.message(_("Georeferencing aster image ..."))
diff --git a/scripts/r.out.xyz/r.out.xyz.html b/scripts/r.out.xyz/r.out.xyz.html
index 9fe1392..d713e76 100644
--- a/scripts/r.out.xyz/r.out.xyz.html
+++ b/scripts/r.out.xyz/r.out.xyz.html
@@ -5,8 +5,10 @@ values into an ASCII text file.
<h2>NOTES</h2>
-This module will not export x,y coordinates for raster cells containing
-a NULL value. This includes cells masked by a raster MASK.
+This module will by default not export x,y coordinates for raster cells
+containing a NULL value. This includes cells masked by a raster MASK.
+Using the flag <b>-i</b> also these raster cells will be included in the
+exported data.
<p>
This module, as all GRASS raster modules, will export cells based on the
current region settings. See the <em>g.region</em> module for details.
@@ -17,7 +19,7 @@ size row x column) containing z values.
<em>r.out.xyz</em> can combine several input raster maps, which can be
convenient when it comes to e.g. produce ASCII point cloud files.
<p>
-<em>r.out.xyz</em> is simply a front-end to "<tt>r.stats -1gn</tt>".
+<em>r.out.xyz</em> is simply a front-end to "<tt>r.stats -1g[n]</tt>".
<h2>EXAMPLES</h2>
@@ -67,4 +69,4 @@ M. Hamish Bowman<br>
<i>Dept. Marine Science<br>
Otago University, New Zealand</i>
-<p><i>Last changed: $Date: 2014-12-19 22:17:36 +0100 (Fri, 19 Dec 2014) $</i>
+<p><i>Last changed: $Date: 2016-12-07 21:58:48 +0100 (Wed, 07 Dec 2016) $</i>
diff --git a/scripts/r.out.xyz/r.out.xyz.py b/scripts/r.out.xyz/r.out.xyz.py
index 12647e2..16a0e04 100755
--- a/scripts/r.out.xyz/r.out.xyz.py
+++ b/scripts/r.out.xyz/r.out.xyz.py
@@ -32,6 +32,10 @@
#%end
#%option G_OPT_F_SEP
#%end
+#%flag
+#% key: i
+#% description: Include no data values
+#%end
import sys
from grass.script import core as grass
@@ -41,8 +45,13 @@ from grass.exceptions import CalledModuleError
def main():
# if no output filename, output to stdout
output = options['output']
+ donodata = flags['i']
- parameters = dict(flags="1gn",
+ if donodata:
+ statsflags="1g"
+ else:
+ statsflags="1gn"
+ parameters = dict(flags=statsflags,
input=options['input'],
separator=options['separator'])
if output:
diff --git a/scripts/v.rast.stats/v.rast.stats.py b/scripts/v.rast.stats/v.rast.stats.py
index 79ec071..dfb7f4e 100644
--- a/scripts/v.rast.stats/v.rast.stats.py
+++ b/scripts/v.rast.stats/v.rast.stats.py
@@ -9,7 +9,7 @@
# add column choose by Luca Delucchi
# PURPOSE: Calculates univariate statistics from a GRASS raster map
# only for areas covered by vector objects on a per-category base
-# COPYRIGHT: (C) 2005-2010 by the GRASS Development Team
+# COPYRIGHT: (C) 2005-2016 by the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
@@ -24,6 +24,8 @@
#% keyword: raster
#% keyword: univariate statistics
#% keyword: zonal statistics
+#% keyword: sampling
+#% keyword: querying
#%end
#%flag
#% key: c
diff --git a/vector/v.in.ogr/main.c b/vector/v.in.ogr/main.c
index 25a88c9..3babe20 100644
--- a/vector/v.in.ogr/main.c
+++ b/vector/v.in.ogr/main.c
@@ -1456,7 +1456,6 @@ int main(int argc, char *argv[])
OGR_L_ResetReading(Ogr_layer);
cat = 0; /* field = layer + 1 */
- G_percent(cat, n_features, 2);
while ((Ogr_feature = OGR_L_GetNextFeature(Ogr_layer)) != NULL) {
G_percent(cat, n_features, 2);
@@ -1485,6 +1484,7 @@ int main(int argc, char *argv[])
#endif
OGR_F_Destroy(Ogr_feature);
}
+ G_percent(1, 1, 1);
}
/* Write centroids */
diff --git a/vector/v.net.visibility/v.net.visibility.html b/vector/v.net.visibility/v.net.visibility.html
index a133b13..9e9c938 100644
--- a/vector/v.net.visibility/v.net.visibility.html
+++ b/vector/v.net.visibility/v.net.visibility.html
@@ -101,8 +101,8 @@ v.extract input=zipcodes_wake output=areas_7_11_25 cats=7,11,25
g.region vector=zipcodes_wake
d.mon wx0
d.vect areas_7_11_25
-v.net.visibility input=zipcodes_wake output=graph
-v.net.visibility input=zipcodes_wake visibility=graph output=new_graph \
+v.net.visibility input=areas_7_11_25 output=graph
+v.net.visibility input=areas_7_11_25 visibility=graph output=new_graph \
coordinates=669547.97,208348.20
d.erase
d.vect areas_7_11_25
@@ -122,6 +122,74 @@ d.vect graph
d.vect archsites col=red
</pre></div>
+<h3>Example 6</h3>
+
+Here is an example with artificial data.
+
+<p>
+<img src="v_net_visibility.png">
+
+<p>
+Load data using here document syntax (Bash and unix-like commands lines only):
+
+<div class="code"><pre>
+v.in.ascii input=- output=simple format=standard <<EOF
+VERTI:
+B 6
+ 82.19908257 75.21788991
+ 81.67889908 71.40321101
+ 83.58623853 71.72522936
+ 84.3293578 75.21788991
+ 82.24862385 76.06009174
+ 82.19908257 75.21788991
+C 1 1
+ 82.88897401 73.66318782
+ 1 1
+C 1 1
+ 90.72645705 75.61248675
+ 1 2
+C 1 1
+ 89.37944702 69.51012912
+ 1 3
+C 1 1
+ 81.60108979 67.78669725
+ 1 4
+B 5
+ 89.92752294 73.95458716
+ 92.37981651 75.11880734
+ 91.56238532 77.29862385
+ 88.96146789 75.88669725
+ 89.92752294 73.95458716
+B 10
+ 88.54036697 70.70963303
+ 87.92192518 70.04087417
+ 87.89633028 69.00045872
+ 88.66460807 68.13372867
+ 90.15108904 68.23290821
+ 90.9426344 68.97588202
+ 90.86880734 70.11513761
+ 90.00144697 70.78336312
+ 89.06055046 70.95733945
+ 88.54036697 70.70963303
+B 9
+ 78.73119266 71.35366972
+ 80.76238532 68.90137615
+ 84.20550459 66.91972477
+ 89.87798165 65.35917431
+ 83.23494031 66.27685175
+ 80.34278748 68.00837238
+ 78.38484005 71.40292009
+ 78.40917431 72.27018349
+ 78.73119266 71.35366972
+EOF
+</pre></div>
+
+Compute the graph:
+
+<div class="code"><pre>
+v.net.visibility input=simple output=graph
+</pre></div>
+
<h2>KNOWN ISSUES</h2>
In some cases when 3 points or nodes are collinear, some wrong edges
are added. This happens only really rarly and shouldn't be a big
@@ -145,4 +213,4 @@ Maximilian Maldacker<br>
Mentor: Wolf Bergenheim
<p>
-<i>Last changed: $Date: 2016-08-30 15:30:14 +0200 (Tue, 30 Aug 2016) $</i>
+<i>Last changed: $Date: 2016-12-11 19:59:46 +0100 (Sun, 11 Dec 2016) $</i>
diff --git a/vector/v.net.visibility/v_net_visibility.png b/vector/v.net.visibility/v_net_visibility.png
new file mode 100644
index 0000000..e0ff792
Binary files /dev/null and b/vector/v.net.visibility/v_net_visibility.png differ
diff --git a/vector/v.qcount/v.qcount.html b/vector/v.qcount/v.qcount.html
index 771121c..73d8da8 100644
--- a/vector/v.qcount/v.qcount.html
+++ b/vector/v.qcount/v.qcount.html
@@ -1,15 +1,57 @@
<h2>DESCRIPTION</h2>
-<em>v.qcount</em> chooses <b>nquadradius ants</b> circular quadrats of
-radius <b>radius</b> such that they are completely within the
-bounds of the current region and no two quadrats overlap.
-The number of points falling within each quadrat are counted
-and indices are calculated to estimate the departure of
-point locations from complete spatial randomness.
+<em>v.qcount</em> computes six different quadrat count statistics that provide
+a measure of how much an user defined point pattern departs from a complete
+spatial random point pattern.
+
+<p>Points are distributed following a complete spatial randomness (CSR) pattern
+if events are equally likely to occur anywhere within an area. There are two
+types departure from a CSR: regularity and clustering. Figure 1 gives an example
+of a complete random, regular and a clustered pattern.
+
+<!-- source of figures:
+ https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_5_4/src/sites/s.qcount/tutorial
+-->
+
+<div align="center" style="margin: 10px">
+<img src="v_qcount_1.png">
+<img src="v_qcount_2.png">
+<img src="v_qcount_3.png">
+<br>
+<i>Figure 1: Realization of two-dimensional Poisson processes of 50 points on
+the unit square exhibiting (a) complete spatial randomness, (b) regularity, and
+(c) clustering.</i>
+</div>
+
+<p>Various indices and statistics measure departure from CSR. The
+<em>v.qcount</em> function implements six different <i>quadrat count</i>
+indices that are described in Cressie (1991; p. 590-591)[1] and in Ripley (1981;
+p. 102-106)[2] and summarized in Table 1.
+
+<div align="center" style="margin: 10px">
+<img src="v_qcount_5.png">
+<br>
+<i>Table 1: Indices for Quadrat Count Data. Adapted from
+Cressie [1], this table shows the statistics computed for the
+quadrats in Figure 2.</i>
+</div>
+
+<p>These indices are computed as follows: <em>v.qcount</em> chooses
+<b>nquadrads</b> circular quadrats of radius <b>radius</b> such that they are
+completely within the bounds of the current region and no two quadrats overlap.
+The number of points falling within each quadrat are counted and indices are
+calculated to estimate the departure of point locations from complete spatial
+randomness. This is illustrated in Figure 2.
+
+<div align="center" style="margin: 10px">
+<img src="v_qcount_4.png">
+<br>
+<i>Figure 2: Randomly placed quadrats (n = 100) with 584 sample points.</i>
+</div>
<h2>NOTES</h2>
-This program may not work properly with lat-long data. It uses
+This program may not work properly with lat-long data. It uses
<em>hypot()</em> in two files: <em>count.c</em> and
<em>findquads.c</em>.
@@ -17,49 +59,51 @@ This program may not work properly with lat-long data. It uses
<h2>SEE ALSO</h2>
-<em><a href="v.random.html">v.random</a></em>
+<em><a href="v.random.html">v.random</a></em>
<h2>REFERENCES</h2>
-<ul>
-<li><em>Complete Spatial Randomness and Quadrat Methods</em> - GRASS
-Tutorial on <em>v.qcount</em> (only available as older file
-s.qcount-tutorial.ps)</li>
-</ul>
-
-<p>
-General references include:
+<b>General references include:</b>
-<ul>
-<li>Noel A. C. Cressie. <em>Statistics for Spatial Data</em>.
+<p>[1] Noel A. C. Cressie. <em>Statistics for Spatial Data</em>.
Wiley Series in Probability and Mathematical Statistics. John Wiley
-& Sons, New York, NY, 1st edition, 1991.</li>
-<li>Brian D. Ripley. <em>Spatial Statistics</em>.
-John Wiley \& Sons, New York, NY, 1981.</li>
-</ul>
-
-<p>
-References to the indices include:
+& Sons, New York, NY, 1st edition, 1991.
+<p>[2] Brian D. Ripley. <em>Spatial Statistics</em>.
+John Wiley \& Sons, New York, NY, 1981.
-<ul>
-<li>F. N. David and P. G. Moore. Notes on contagious distributions in
-plant populations. <em>Annals of Botany</em>, 18:47-53, 1954.</li>
-<li>J. B. Douglas. Clustering and aggregation.
-<em>Sankhya B</em>, 37:398-417, 1975.</li>
+<p>
+<b>References to the indices include:</b>
-<li>R. A. Fisher, H. G. Thornton, and W. A. Mackenzie.
+<p>[3] R. A. Fisher, H. G. Thornton, and W. A. Mackenzie.
The accuracy of the plating method of estimating the density of
bacterial populations.
-<em>Annals of Applied Biology</em>, 9:325-359, 1922.</li>
+<em>Annals of Applied Biology</em>, 9:325-359, 1922.
+
+<p>[4] F. N. David and P. G. Moore. Notes on contagious distributions in
+plant populations. <em>Annals of Botany</em>, 18:47-53, 1954.
+
+<p>[5] J. B. Douglas. Clustering and aggregation.
+<em>Sankhya B</em>, 37:398-417, 1975.
+
+<p>[6] M. Lloyd. Mean crowding.
+<em>Journal of Animal Ecology</em>, 36:1-30, 1967.
+
+<p>[7] M. Morista. Measuring the dispersion and analysis of distribution
+patterns. <em>Memoires of the Faculty of Science, Kyushu University, Series E.
+Biology</em>, 2:215-235, 1959.
+
+<p>
+<b>A more detailed background is given in the tutorial:</b>
+
+<!-- source of tutorial:
+ https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_5_4/src/sites/s.qcount/tutorial
+-->
+
+<p>[8] James Darrell McCauley 1993. Complete Spatial Randomness and Quadrat Methods -
+<a href="https://grass.osgeo.org/uploads/grass/history_docs/v_qcount_tutorial.pdf">GRASS Tutorial on v.qcount</a>
-<li>M. Lloyd. Mean crowding.
-<em>Journal of Animal Ecology</em>, 36:1-30, 1967.</li>
-<li>M. Morista. Measuring the dispersion and analysis of distribution patterns.
-<em>Memoires of the Faculty of Science, Kyushu University, Series E.
-Biology</em>, 2:215-235, 1959.</li>
-</ul>
<h2>KNOWN ISSUES</h2>
@@ -68,8 +112,7 @@ Timestamp not working for header part of counts output. (2000-10-28)
<h2>AUTHORS</h2>
<a href="http://mccauley-usa.com/">James Darrell McCauley</a>
-<a href="mailto:darrell at mccauley-usa.com"><darrell at mccauley-usa.com></a>,
-<br>when he was at:
+<br>when he was at:
<a href="http://ABE.www.ecn.purdue.edu/ABE/">Agricultural Engineering</a>
<a href="http://www.purdue.edu/">Purdue University</a>
@@ -77,4 +120,4 @@ Timestamp not working for header part of counts output. (2000-10-28)
<br>
Modified for GRASS 5.7 by R. Blazek (2004-10-14)
-<p><i>Last changed: $Date: 2015-05-11 02:11:34 +0200 (Mon, 11 May 2015) $</i>
+<p><i>Last changed: $Date: 2016-12-22 15:43:22 +0100 (Thu, 22 Dec 2016) $</i>
diff --git a/vector/v.qcount/v_qcount_1.png b/vector/v.qcount/v_qcount_1.png
new file mode 100644
index 0000000..832c1b9
Binary files /dev/null and b/vector/v.qcount/v_qcount_1.png differ
diff --git a/vector/v.qcount/v_qcount_2.png b/vector/v.qcount/v_qcount_2.png
new file mode 100644
index 0000000..9e066ab
Binary files /dev/null and b/vector/v.qcount/v_qcount_2.png differ
diff --git a/vector/v.qcount/v_qcount_3.png b/vector/v.qcount/v_qcount_3.png
new file mode 100644
index 0000000..9018366
Binary files /dev/null and b/vector/v.qcount/v_qcount_3.png differ
diff --git a/vector/v.qcount/v_qcount_4.png b/vector/v.qcount/v_qcount_4.png
new file mode 100644
index 0000000..4f63476
Binary files /dev/null and b/vector/v.qcount/v_qcount_4.png differ
diff --git a/vector/v.qcount/v_qcount_5.png b/vector/v.qcount/v_qcount_5.png
new file mode 100644
index 0000000..8170a99
Binary files /dev/null and b/vector/v.qcount/v_qcount_5.png differ
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/grass.git
More information about the Pkg-grass-devel
mailing list