breaks
Command line tool for adding data classes to geodata files.
Built on top of Fiona and Pysal mapclassify.
Install
Requires GDAL. Numpy and Pysal will be installed if not available.
pip install breaks
These are the breaks
Usage: breaks [OPTIONS] input data-field output
Write a geodata file with bins based on a data field
Options:
-m, --method METHOD Binning method:
equal_interval
fisher_jenks
jenks_caspall
jenks_caspall_forced
jenks_caspall_sampled
max_p_classifier
maximum_breaks
natural_breaks
quantiles (default)
-b, --bin-field FIELD name of new field
-n, --norm-field FIELD Normalize (divide) bin-field by this name field
-k COUNT Number of bins (default: 5)
-B, --bins TEXT Comma-separated list of breaks (a series of upper-
bounds)
-i, --id-field FIELD If given, only write this field, bin-field, and
data-field (and norm-field, if given).
--version Show the version and exit.
--help Show this message and exit.
Add quintile bins on ‘fieldname’:
breaks data.shp fieldname data_binned.shp
This writes a file called data_binned.shp which is a copy of data.shp, but with an additional bin field, which contains a number from 0 to 4 (it will contain NULL values for rows with missing data).
Add decile bins on ‘fieldname’:
breaks -k 10 data.shp fieldname data_binned.geojson
Add five Fisher-Jenks bins on ‘fieldname’:
breaks --method fisher_jenks data.json fieldname data_binned.json
Add decile bins on ‘fieldname’ to a field called ‘mybin’:
breaks --bin-field mybin data.geojson fieldname data_binned.geojson
Divide one field by another. If you have more complicated manipulations you would like to work, alter your data with ogr2ogr or another tool.
# Calculates bins for population / area breaks data.geojson population data_binned.geojson --norm-field area
Add custom bins on ‘fieldname’:
breaks --bins 50,75,150,250,500 data.geojson fieldname data_binned.shp
(Give the upper-bounds as a comma-separated list.)
Only write an ID field and the data fields:
breaks --id-field GEOID data.shp field1 data_lookup.shp
License
Copyright 2016 Neil Freeman. Available under the GNU Public License.
Metadata
Release files for breaks 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| breaks-0.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for breaks-0.2.0-py2.py3-none-any.whl |
Release files / breaks-0.2.0-py2.py3-none-any.whl
| Download URL | breaks-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
af24e36aafeb056acee9c25bb2282ce5d01e3801ef972f6b0d7ff06a628f62d1
|
|
BLAKE2b-256 checksum How to use checksums |
0b8fac3506d07f34fa3417aa6b907e84037e173316ed3843ce6b9b354b83604f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for breaks 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.