Skip to content

Commit

Permalink
sync changes from addons since r70655
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Apr 8, 2019
1 parent be64d56 commit 6c56e18
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 74 deletions.
34 changes: 20 additions & 14 deletions r.futures/r.futures.calib/r.futures.calib.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ <h3>Calibration input and output</h3>
Calibration results are saved in a CSV file specified in <b>calibration_results</b>:

<pre>
input_discount_factor area_distance input_compactness_mean input_compactness_range compactness_distance
0.1 1.01541178435 0.1 0.02 3.00000005937
0.2 1.26578803108 0.1 0.02 4.12442780529
0.3 1.17631210026 0.1 0.02 3.86904462396
0.4 2.31700278644 0.1 0.02 15.0569602795
0.5 1.08655152036 0.1 0.02 3.72484862687
0.6 2.97628078734 0.1 0.02 21.6358616001
0.7 3.61632549044 0.1 0.02 25.4492265706
0.8 2.72789958233 0.1 0.02 18.1083820007
0.9 2.45915297845 0.1 0.02 18.4500322711
0.1 1.05473877995 0.1 0.04 3.09321560218
input_discount_factor,area_distance,input_compactness_mean,input_compactness_range,compactness_distance
0.1,1.01541178435,0.1,0.02,3.00000005937
0.2,1.26578803108,0.1,0.02,4.12442780529
0.3,1.17631210026,0.1,0.02,3.86904462396
0.4,2.31700278644,0.1,0.02,15.0569602795
0.5,1.08655152036,0.1,0.02,3.72484862687
0.6,2.97628078734,0.1,0.02,21.6358616001
0.7,3.61632549044,0.1,0.02,25.4492265706
0.8,2.72789958233,0.1,0.02,18.1083820007
0.9,2.45915297845,0.1,0.02,18.4500322711
0.1,1.05473877995,0.1,0.04,3.09321560218
...
</pre>

Expand Down Expand Up @@ -103,14 +103,20 @@ <h2>REFERENCES</h2>
<a href="http://dx.doi.org/10.1080/00045608.2012.707591">FUTURES: Multilevel Simulations of Emerging
Urban-Rural Landscape Structure Using a Stochastic Patch-Growing Algorithm</a>.
Annals of the Association of American Geographers, 103(4), 785-807.
DOI: 10.1080/00045608.2012.707591
<li>Dorning, M. A., Koch, J., Shoemaker, D. A., &amp; Meentemeyer, R. K. (2015).
<a href="http://dx.doi.org/10.1016/j.landurbplan.2014.11.011">Simulating urbanization scenarios reveals
tradeoffs between conservation planning strategies</a>.
Landscape and Urban Planning, 136, 28-39.</li>
Landscape and Urban Planning, 136, 28-39.
DOI: 10.1016/j.landurbplan.2014.11.011</li>
<li>Petrasova, A., Petras, V., Van Berkel, D., Harmon, B. A., Mitasova, H., &amp; Meentemeyer, R. K. (2016).
<a href="https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLI-B7/953/2016/isprs-archives-XLI-B7-953-2016.pdf">Open Source Approach to Urban Growth Simulation</a>.
Int. Arch. Photogramm. Remote Sens. Spatial Inf. Sci., XLI-B7, 953-959.
DOI: 10.5194/isprsarchives-XLI-B7-953-2016</li>
</ul>

<h2>AUTHOR</h2>

Anna Petrasova, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU OSGeoREL</a><br>
Anna Petrasova, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll</a><br>

<p><i>Last changed: $Date: 2015-02-12 14:32:45 -0500 (Thu, 12 Feb 2015) $</i>
<p><i>Last changed: $Date: 2018-09-14 21:49:22 -0400 (Fri, 14 Sep 2018) $</i>
14 changes: 5 additions & 9 deletions r.futures/r.futures.calib/r.futures.calib.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#% key: repeat
#% description: How many times is the simulation repeated
#% required: no
#% answer: 10
#% guisection: Calibration
#%end
#%option
Expand Down Expand Up @@ -147,7 +146,6 @@
#% required: no
#% multiple: no
#% options: 4,8
#% answer: 4
#% description: The number of neighbors to be used for patch generation (4 or 8)
#% guisection: PGA
#%end
Expand All @@ -157,7 +155,6 @@
#% required: no
#% multiple: no
#% options: 1,2
#% answer: 2
#% description: The way location of a seed is determined (1: uniform distribution 2: development probability)
#% guisection: PGA
#%end
Expand All @@ -167,7 +164,6 @@
#% required: no
#% multiple: no
#% options: occurrence,gravity,kernel
#% answer: gravity
#% description: Approaches to derive development pressure
#% guisection: PGA
#%end
Expand Down Expand Up @@ -300,7 +296,7 @@ def run_one_combination(repeat, development_start, compactness_mean, compactness
run_simulation(development_start=development_start, development_end=simulation_dev_end,
compactness_mean=compactness_mean, compactness_range=compactness_range,
discount_factor=discount_factor, patches_file=patches_file, fut_options=fut_options)
except CalledModuleError, e:
except CalledModuleError as e:
queue.put(None)
cleanup(tmp=TMP_PROCESS)
gcore.error(_("Running r.futures.pga failed. Details: {e}").format(e=e))
Expand Down Expand Up @@ -344,8 +340,8 @@ def run_simulation(development_start, development_end, compactness_mean, compact
output=development_end)
parameters.update(futures_parameters)
for not_required in ('constrain_weight', 'num_steps', 'incentive_power'):
if options[not_required]:
parameters.update({not_required: options[not_required]})
if fut_options[not_required]:
parameters.update({not_required: fut_options[not_required]})

gcore.run_command('r.futures.pga', flags='s', overwrite=True, **parameters)

Expand Down Expand Up @@ -475,7 +471,7 @@ def main():
proc_list = []
num_all = len(compactness_means) * len(compactness_ranges) * len(discount_factors)
with open(options['calibration_results'], 'a') as f:
f.write(' '.join(['input_discount_factor', 'area_distance',
f.write(','.join(['input_discount_factor', 'area_distance',
'input_compactness_mean', 'input_compactness_range',
'compactness_distance']))
f.write('\n')
Expand All @@ -500,7 +496,7 @@ def main():
data = queue_list[i].get()
if not data:
continue
f.write(' '.join([str(data['input_discount_factor']), str(data['area_distance']),
f.write(','.join([str(data['input_discount_factor']), str(data['area_distance']),
str(data['input_compactness_mean']), str(data['input_compactness_range']),
str(data['compactness_distance'])]))
f.write('\n')
Expand Down
12 changes: 9 additions & 3 deletions r.futures/r.futures.demand/r.futures.demand.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,20 @@ <h2>REFERENCES</h2>
<a href="http://dx.doi.org/10.1080/00045608.2012.707591">FUTURES: Multilevel Simulations of Emerging
Urban-Rural Landscape Structure Using a Stochastic Patch-Growing Algorithm</a>.
Annals of the Association of American Geographers, 103(4), 785-807.
DOI: 10.1080/00045608.2012.707591
<li>Dorning, M. A., Koch, J., Shoemaker, D. A., &amp; Meentemeyer, R. K. (2015).
<a href="http://dx.doi.org/10.1016/j.landurbplan.2014.11.011">Simulating urbanization scenarios reveals
tradeoffs between conservation planning strategies</a>.
Landscape and Urban Planning, 136, 28-39.</li>
Landscape and Urban Planning, 136, 28-39.
DOI: 10.1016/j.landurbplan.2014.11.011</li>
<li>Petrasova, A., Petras, V., Van Berkel, D., Harmon, B. A., Mitasova, H., &amp; Meentemeyer, R. K. (2016).
<a href="https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLI-B7/953/2016/isprs-archives-XLI-B7-953-2016.pdf">Open Source Approach to Urban Growth Simulation</a>.
Int. Arch. Photogramm. Remote Sens. Spatial Inf. Sci., XLI-B7, 953-959.
DOI: 10.5194/isprsarchives-XLI-B7-953-2016</li>
</ul>

<h2>AUTHOR</h2>

Anna Petrasova, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU OSGeoREL</a><br>
Anna Petrasova, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll</a><br>

<p><i>Last changed: $Date: 2015-02-12 14:32:45 -0500 (Thu, 12 Feb 2015) $</i>
<p><i>Last changed: $Date: 2018-09-14 21:49:22 -0400 (Fri, 14 Sep 2018) $</i>
16 changes: 11 additions & 5 deletions r.futures/r.futures.devpressure/r.futures.devpressure.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,24 @@ <h2>SEE ALSO</h2>
<h2>REFERENCES</h2>
<ul>
<li>
Meentemeyer, R. K., Tang, W., Dorning, M. A., Vogler, J. B., Cunniffe, N. J., & Shoemaker, D. A. (2013).
Meentemeyer, R. K., Tang, W., Dorning, M. A., Vogler, J. B., Cunniffe, N. J., &amp; Shoemaker, D. A. (2013).
<a href="http://dx.doi.org/10.1080/00045608.2012.707591">FUTURES: Multilevel Simulations of Emerging
Urban-Rural Landscape Structure Using a Stochastic Patch-Growing Algorithm</a>.
Annals of the Association of American Geographers, 103(4), 785-807.
<li>Dorning, M. A., Koch, J., Shoemaker, D. A., & Meentemeyer, R. K. (2015).
DOI: 10.1080/00045608.2012.707591
<li>Dorning, M. A., Koch, J., Shoemaker, D. A., &amp; Meentemeyer, R. K. (2015).
<a href="http://dx.doi.org/10.1016/j.landurbplan.2014.11.011">Simulating urbanization scenarios reveals
tradeoffs between conservation planning strategies</a>.
Landscape and Urban Planning, 136, 28-39.</li>
Landscape and Urban Planning, 136, 28-39.
DOI: 10.1016/j.landurbplan.2014.11.011</li>
<li>Petrasova, A., Petras, V., Van Berkel, D., Harmon, B. A., Mitasova, H., &amp; Meentemeyer, R. K. (2016).
<a href="https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLI-B7/953/2016/isprs-archives-XLI-B7-953-2016.pdf">Open Source Approach to Urban Growth Simulation</a>.
Int. Arch. Photogramm. Remote Sens. Spatial Inf. Sci., XLI-B7, 953-959.
DOI: 10.5194/isprsarchives-XLI-B7-953-2016</li>
</ul>

<h2>AUTHOR</h2>

Anna Petrasova, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU OSGeoREL</a><br>
Anna Petrasova, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll</a><br>

<p><i>Last changed: $Date: 2015-02-12 14:32:45 -0500 (Thu, 12 Feb 2015) $</i>
<p><i>Last changed: $Date: 2018-09-14 21:49:22 -0400 (Fri, 14 Sep 2018) $</i>
24 changes: 12 additions & 12 deletions r.futures/r.futures.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ <h2>REFERENCES</h2>
<a href="http://dx.doi.org/10.1080/00045608.2012.707591">FUTURES: Multilevel Simulations of Emerging
Urban-Rural Landscape Structure Using a Stochastic Patch-Growing Algorithm</a>.
Annals of the Association of American Geographers, 103(4), 785-807.
DOI: 10.1080/00045608.2012.707591
<li>Dorning, M. A., Koch, J., Shoemaker, D. A., &amp; Meentemeyer, R. K. (2015).
<a href="http://dx.doi.org/10.1016/j.landurbplan.2014.11.011">Simulating urbanization scenarios reveals
tradeoffs between conservation planning strategies</a>.
Landscape and Urban Planning, 136, 28-39.</li>
<li>
Petrasova, A., Petras, V., Shoemaker, D. A., Dorning, M. A., &amp; Meentemeyer, R. K. (2015).
<a href="http://geomatica.como.polimi.it/workbooks/n12/FOSS4G-eu15_submission_72.pdf">
The integration of land change modeling framework FUTURES into GRASS GIS 7</a>.
Geomatics Workbooks. Volume 12. FOSS4G Europe: Como 2015.
Politecnico di Milano. Italy.
Landscape and Urban Planning, 136, 28-39.
DOI: 10.1016/j.landurbplan.2014.11.011</li>
<li>Petrasova, A., Petras, V., Van Berkel, D., Harmon, B. A., Mitasova, H., &amp; Meentemeyer, R. K. (2016).
<a href="https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLI-B7/953/2016/isprs-archives-XLI-B7-953-2016.pdf">Open Source Approach to Urban Growth Simulation</a>.
Int. Arch. Photogramm. Remote Sens. Spatial Inf. Sci., XLI-B7, 953-959.
DOI: 10.5194/isprsarchives-XLI-B7-953-2016</li>
</ul>


Expand All @@ -138,7 +138,7 @@ <h2>AUTHORS</h2>
<p>
<em>Corresponding author:</em><br>
Ross K. Meentemeyer, rkmeente ncsu edu,
<a href="http://geospatial.ncsu.edu/">Center for Geospatial Analytics, NCSU</a>
<a href="https://geospatial.ncsu.edu/">Center for Geospatial Analytics, NCSU</a>

<p>
<em>Original standalone version:</em><br>
Expand All @@ -153,17 +153,17 @@ <h2>AUTHORS</h2>

<br>
* Department of Geography and Earth Sciences, UNC Charlotte<br>
** <a href="http://geospatial.ncsu.edu/">Center for Geospatial Analytics, NCSU</a><br>
** <a href="https://geospatial.ncsu.edu/">Center for Geospatial Analytics, NCSU</a><br>

<p>
<em>Port to GRASS GIS and GRASS-specific additions:</em><br>

Vaclav Petras, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU OSGeoREL</a><br>
Vaclav Petras, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll</a><br>

<p>
<em>Developement pressure, demand and calibration and preprocessing modules:</em><br>

Anna Petrasova, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU OSGeoREL</a><br>
Anna Petrasova, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll</a><br>

<p>
<i>Last changed: $Date: 2014-03-25 20:16:47 -0400 (Tue, 25 Mar 2014) $</i>
<i>Last changed: $Date: 2018-09-14 21:49:22 -0400 (Fri, 14 Sep 2018) $</i>
12 changes: 9 additions & 3 deletions r.futures/r.futures.parallelpga/r.futures.parallelpga.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,20 @@ <h2>REFERENCES</h2>
<a href="http://dx.doi.org/10.1080/00045608.2012.707591">FUTURES: Multilevel Simulations of Emerging
Urban-Rural Landscape Structure Using a Stochastic Patch-Growing Algorithm</a>.
Annals of the Association of American Geographers, 103(4), 785-807.
DOI: 10.1080/00045608.2012.707591
<li>Dorning, M. A., Koch, J., Shoemaker, D. A., &amp; Meentemeyer, R. K. (2015).
<a href="http://dx.doi.org/10.1016/j.landurbplan.2014.11.011">Simulating urbanization scenarios reveals
tradeoffs between conservation planning strategies</a>.
Landscape and Urban Planning, 136, 28-39.</li>
Landscape and Urban Planning, 136, 28-39.
DOI: 10.1016/j.landurbplan.2014.11.011</li>
<li>Petrasova, A., Petras, V., Van Berkel, D., Harmon, B. A., Mitasova, H., &amp; Meentemeyer, R. K. (2016).
<a href="https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLI-B7/953/2016/isprs-archives-XLI-B7-953-2016.pdf">Open Source Approach to Urban Growth Simulation</a>.
Int. Arch. Photogramm. Remote Sens. Spatial Inf. Sci., XLI-B7, 953-959.
DOI: 10.5194/isprsarchives-XLI-B7-953-2016</li>
</ul>

<h2>AUTHOR</h2>

Anna Petrasova, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU OSGeoREL</a><br>
Anna Petrasova, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll</a><br>

<p><i>Last changed: $Date: 2015-02-12 14:32:45 -0500 (Thu, 12 Feb 2015) $</i>
<p><i>Last changed: $Date: 2018-09-14 21:49:22 -0400 (Fri, 14 Sep 2018) $</i>
8 changes: 4 additions & 4 deletions r.futures/r.futures.pga/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,13 +1319,15 @@ void updateMap1(t_Landscape * pLandscape, t_Params * pParams, int step,
}
G_debug(1, "After accounting for extra cells, attempt %d cells", nToConvert);
/* if have cells to convert this step */
bool forceConvertEverything = false;
if (nToConvert > 0) {
/* if not enough cells to convert then alter number required */
if (nToConvert > pLandscape->num_undevSites[regionID]) {
G_warning("Not enough undeveloped sites (requested: %d,"
" available: %d). Converting all available.",
nToConvert, pLandscape->num_undevSites[regionID]);
nToConvert = pLandscape->num_undevSites[regionID];
forceConvertEverything = true;
}
/* update in stochastic fashion */
nDone = 0;
Expand Down Expand Up @@ -1364,7 +1366,7 @@ void updateMap1(t_Landscape * pLandscape, t_Params * pParams, int step,
/* Doug's "back to front" logit */
// dProb = 1.0/(1.0 + exp(pLandscape->asUndev[i].logitVal));
dProb = pLandscape->asUndevs[regionID][i].logitVal;
if (uniformRandom() < dProb) {
if (forceConvertEverything || (uniformRandom() < dProb)) {
nDone +=
convertCells(pLandscape, pParams,
pLandscape->asUndevs[regionID]
Expand Down Expand Up @@ -1904,7 +1906,6 @@ int getUnDevIndex1(t_Landscape * pLandscape, int regionID)
if (p >= pLandscape->asUndevs[regionID][last].cumulProb)
return last;
while (first <= last) {
// TODO: these might not me initialized (says also valgrind)
if (pLandscape->asUndevs[regionID][middle].cumulProb < p)
first = middle + 1;
else if (pLandscape->asUndevs[regionID][middle - 1].cumulProb < p &&
Expand Down Expand Up @@ -2007,9 +2008,8 @@ void findAndSortProbsAll(t_Landscape * pLandscape, t_Params * pParams,
int j;

for (j = 0; j < pParams->num_Regions; j++) {
// TODO: value of pLandscape->asUndevs[j][0].cumulProb is what?
double sum = pLandscape->asUndevs[j][0].logitVal;

pLandscape->asUndevs[j][0].cumulProb = pLandscape->asUndevs[j][0].logitVal;
for (i = 1; i < pLandscape->num_undevSites[j]; i++) {
pLandscape->asUndevs[j][i].cumulProb =
pLandscape->asUndevs[j][i - 1].cumulProb +
Expand Down
17 changes: 13 additions & 4 deletions r.futures/r.futures.potential/r.futures.potential.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ <h3>Format</h3>
The header contains the names of the predictor maps and the first column
contains the identifiers of the subregions. The order of columns is important,
the second column represents intercept, the third development pressure and
then the predictors.
then the predictors. Therefore the development pressure column must be specified
as the first column in option <b>columns</b>.

<pre>
ID Intercept devpressure_0_5 slope road_dens_perc forest_smooth_perc ...
Expand All @@ -41,6 +42,8 @@ <h3>Format</h3>
<h2>NOTES</h2>
Note that this module is designed to automate the FUTURES workflow by brute-force
selection of model, which has numerous caveats.
<p>
In case there is only one subregion, R function glm is used instead of glmer.

<h2>EXAMPLES</h2>

Expand All @@ -61,14 +64,20 @@ <h2>REFERENCES</h2>
<a href="http://dx.doi.org/10.1080/00045608.2012.707591">FUTURES: Multilevel Simulations of Emerging
Urban-Rural Landscape Structure Using a Stochastic Patch-Growing Algorithm</a>.
Annals of the Association of American Geographers, 103(4), 785-807.
DOI: 10.1080/00045608.2012.707591
<li>Dorning, M. A., Koch, J., Shoemaker, D. A., &amp; Meentemeyer, R. K. (2015).
<a href="http://dx.doi.org/10.1016/j.landurbplan.2014.11.011">Simulating urbanization scenarios reveals
tradeoffs between conservation planning strategies</a>.
Landscape and Urban Planning, 136, 28-39.</li>
Landscape and Urban Planning, 136, 28-39.
DOI: 10.1016/j.landurbplan.2014.11.011</li>
<li>Petrasova, A., Petras, V., Van Berkel, D., Harmon, B. A., Mitasova, H., &amp; Meentemeyer, R. K. (2016).
<a href="https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLI-B7/953/2016/isprs-archives-XLI-B7-953-2016.pdf">Open Source Approach to Urban Growth Simulation</a>.
Int. Arch. Photogramm. Remote Sens. Spatial Inf. Sci., XLI-B7, 953-959.
DOI: 10.5194/isprsarchives-XLI-B7-953-2016</li>
</ul>

<h2>AUTHOR</h2>

Anna Petrasova, <a href="http://geospatial.ncsu.edu/osgeorel/">NCSU OSGeoREL</a><br>
Anna Petrasova, <a href="https://geospatial.ncsu.edu/geoforall/">NCSU GeoForAll</a><br>

<p><i>Last changed: $Date: 2015-02-12 14:32:45 -0500 (Thu, 12 Feb 2015) $</i>
<p><i>Last changed: $Date: 2018-09-14 21:49:22 -0400 (Fri, 14 Sep 2018) $</i>
Loading

0 comments on commit 6c56e18

Please sign in to comment.