<commit_before>.. _raster_stats:

Raster Statistics App
=======================
The `lingcod.raster_stats` app allows you to analyze raster datasets based on a polygon geometry. For example, for a given polygon, you may want to know the average elevation or the maximum temperature, etc. Essentially this performs a vector-on-raster intersection. 

The app uses an optional caching mechanism so that any geometry/raster combination only needs to be run once. 

The raster_stats app provides a model to register raster datasets, a utility function to quickly calculate stats programatically and a webservice which returns the statistics in json format.

Installation
------------
The raster_stats app relies on the `starspan` executable. This C++ app must be installed from src and it's a pain. The end. 

http://projects.atlas.ca.gov/frs/download.php/667/starspan-1.2.03.tar.gz

Settings<commit_msg>added starspan installation instructions<commit_after>.. _raster_stats:

Raster Statistics App
=======================
The `lingcod.raster_stats` app allows you to analyze raster datasets based on a polygon geometry. For example, for a given polygon, you may want to know the average elevation or the maximum temperature, etc. Essentially this performs a vector-on-raster intersection. 

The app uses an optional caching mechanism so that any geometry/raster combination only needs to be run once. 

The raster_stats app provides a model to register raster datasets, a utility function to quickly calculate stats programatically and a webservice which returns the statistics in json format.

Installation
------------
The raster_stats app relies on the `starspan` executable. This C++ app must be installed from src and requires GDAL and GEOS header files::

    wget http://projects.atlas.ca.gov/frs/download.php/667/starspan-1.2.03.tar.gz
    tar -xzvf starspan-1.2.03.tar.gz
    cd starspan-1.2.03
    ./configure
    make
    sudo make install

If you get errors similar to::

    src/csv/Csv.h:52: error: ‘stdout’ was not declared in this scope

it means that you are probably compiling with a newer version of GCC (eg GCC 4.4 which ships with Ubuntu 10.4) and does not include some standard libraries by default. This means that you need to explicitly include them (eg add `#include <cstdio>` to the affected files). We also have a patched version available at http://maps11.msi.ucsb.edu/downloads/starspan-1.2.04.tar.gz

Settings
{'fraction_non_alphanumeric': 0.08459958932238193, 'fraction_numerical': 0.014373716632443531, 'mean_word_length': 4.1069182389937104, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3787995', 'n_tokens_mistral': 677, 'n_tokens_neox': 625, 'n_words': 315}