benducke / Network-reconstruction-tools-for-GRASS-GIS

Node-based network model generator for GRASS GIS 7.x (and QGIS 3.x)
GNU General Public License v3.0
4 stars 1 forks source link

v.net.models: Improve/externalise statistical computations #60

Open benducke opened 2 months ago

benducke commented 2 months ago

At the end of a run, v.net.models computes and outputs some useful descriptive statistics on the generated network. The computations are done in function "stats_unreduced ()" (for complete networks) and at the very end of the script:

# Compute statistics for reduced network (if applicable)
if [ "${GIS_OPT_MODEL}" != "complete" ] || [ -n "${GIS_OPT_MAXDIST}" ] ; then
  ...
fi

# Output global network statistics
# 1. For unreduced network (these were already computed in 'model_complete' and are
#    always available):
if [ ${GIS_FLAG_G} -eq 1 ] ; then
  ...
fi

# 2. For reduced network: Only available if a model other than COMPLETE was chosen.
if [ "${GIS_OPT_MODEL}" != "complete" ] || [ -n "${GIS_OPT_MAXDIST}" ] ; then
  ...
fi

While these statistics might be useful, they are also not saved anywhere (only printed to the screen), and their computation takes a lot of time.

The following improvements should be implemented:

  1. Unify statistics for reduced and unreduced network cases, remove them from v.net.models and move them into a dedicated model.
  2. Look for opportunities to improve efficiency around the calls to v.db.select.
  3. Implement a representative sampling scheme as the default mode and only compute (-e)xact statistics if the user sets the corresponding flag.
benducke commented 1 month ago

Created initial version of v.net.stats.

Next steps: