<commit_before>makesurface
===========

A few basic surface creation routines using: `rasterio`, `fiona`, and `shapely`

Installation
------------

.. role:: console(code)
   :language: console

1. Install dependencies:

- :console:`rasterio`
- `fiona`
- `shapely`
- `scipy`
- `scikit-image`

2. Clone this repo:

.. code-block:: console

git clone <EMAIL>:mapbox/make-surface.git

3. CD into `make-surface` then pip install .

Usage
------

Takes an input raster, and converts into a stacked shapefile. Sort of like `gdal polygonize` with more control. Also prints out a cartocss template for stylizing (one style for each class).

.. code-block:: console

makesurface <input raster> <output shapefile> [OPTIONS]

Arguments

* `<input raster>` Input single-band raster to class and vectorize

* `<output shapefile>` Output shapefile to create - output will be "stacked", with lower values including areas of higher values

Options

* `--classfile <TEXT>` - Filepath to one-line CSV of manually defined break values

* `--classes <INTEGER>` (default = 10) - Number of sections to vectorize into; Ignored if `classfile` specified

* `--weight <FLOAT>` (default = 0.5) - parameter to weight classification type; 0 = quantile breaks, 1 = equal interval, anywhere between 0 and 1 weights the classification between the two; Ignored if `classfile` specified

* `--smoothing <FLOAT>` (default = no smoothing) - optional parameter that defines the kernel sigma used in a gaussian smoothing operation prior to classification; If none, no smoothing is performed

* `--nodata <ANY NUMBER OR "min">` (default = nodata from metadata) - Manually defined nodata value - can be any number or "min"

* `--help` Show this message and exit;<commit_msg>working on code highlighting w/ .rst<commit_after>makesurface
===========

A few basic surface creation routines using (primarily) [rasterio](https://github.com/mapbox/rasterio), [fiona](https://github.com/Toblerity/Fiona), and [shapely](https://github.com/Toblerity/shapely)

Installation
------------

.. role:: console(code)
   :language: console

1. Install dependencies:

- :console:`rasterio`
- :console:`fiona`
- :console:`shapely`
- :console:`scipy`
- :console:`scikit-image`

2. Clone this repo:

:console:`git clone <EMAIL>:mapbox/make-surface.git`

3. CD into :console:`make-surface` then pip install .

Usage
------

Takes an input raster, and converts into a stacked shapefile. Sort of like :console:`gdal polygonize` with more control. Also prints out a cartocss template for stylizing (one style for each class).

:console:`makesurface <input raster> <output shapefile> [OPTIONS]`

Arguments

* :console:`<input raster>` Input single-band raster to class and vectorize

* :console:`<output shapefile>` Output shapefile to create - output will be "stacked", with lower values including areas of higher values

Options

* :console:`--classfile <TEXT>` - Filepath to one-line CSV of manually defined break values

* :console:`--classes <INTEGER>` (default = 10) - Number of sections to vectorize into; Ignored if `classfile` specified

* :console:`--weight <FLOAT>` (default = 0.5) - parameter to weight classification type; 0 = quantile breaks, 1 = equal interval, anywhere between 0 and 1 weights the classification between the two; Ignored if `classfile` specified

* :console:`--smoothing <FLOAT>` (default = no smoothing) - optional parameter that defines the kernel sigma used in a gaussian smoothing operation prior to classification; If none, no smoothing is performed

* :console:`--nodata <ANY NUMBER OR "min">` (default = nodata from metadata) - Manually defined nodata value - can be any number or "min"

* :console:`--help` Show this message and exit;
{'fraction_non_alphanumeric': 0.1215633423180593, 'fraction_numerical': 0.005929919137466307, 'mean_word_length': 4.378260869565217, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6043062', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1053, 'n_words': 435}