Skip to main content

csmap-py

GitHub Release GitHub Actions Workflow Status

module to process CSMap, based on https://www.rinya.maff.go.jp/j/seibi/sagyoudo/attach/pdf/romou-12.pdf

usage: csmap [-h] [--chunk_size CHUNK_SIZE] [--max_workers MAX_WORKERS]
                   [--bigtiff {YES,NO,IF_NEEDED,IF_SAFER}] [--gf_size GF_SIZE]
                   [--gf_sigma GF_SIGMA] [--curvature_size CURVATURE_SIZE]
                   [--height_scale HEIGHT_SCALE HEIGHT_SCALE]
                   [--slope_scale SLOPE_SCALE SLOPE_SCALE]
                   [--curvature_scale CURVATURE_SCALE CURVATURE_SCALE]
                   input_dem_path output_path

positional arguments:
  input_dem_path        input DEM path
  output_path           output path

options:
  -h, --help            show this help message and exit
  --chunk_size CHUNK_SIZE
                        chunk size as pixel, default to 1024
  --max_workers MAX_WORKERS
                        max workers for multiprocessing, default to 1
  --bigtiff {YES,NO,IF_NEEDED,IF_SAFER}
                        BIGTIFF creation option of GeoTIFF, default to IF_SAFER
  --gf_size GF_SIZE     gaussian filter size, default to 12
  --gf_sigma GF_SIGMA   gaussian filter sigma, default to 3
  --curvature_size CURVATURE_SIZE
                        curvature filter size, default to 1
  --height_scale HEIGHT_SCALE HEIGHT_SCALE
                        height scale, min max, default to 0.0 1000.0
  --slope_scale SLOPE_SCALE SLOPE_SCALE
                        slope scale, min max, default to 0.0 1.5
  --curvature_scale CURVATURE_SCALE CURVATURE_SCALE
                        curvature scale, min max, default to -0.1 0.1

usage

Command Line Interface

pip install csmap-py
csmap dem.tif csmap.tif
csmap dem.vrt csmap.tif # you can use virtual raster or other gdal supported format
csmap dem.tif csmap.tif --chunk_size 256 --max_workers 4 # you can use multiprocessing
csmap dem.tif csmap.tif --bigtiff YES # force BigTIFF output (default IF_SAFER writes BigTIFF when output may exceed 4GB)
csmap dem.tif csmap.tif --gf_size 3 --gf_sigma 1.0 --curvature_size 1 # you can change filter size
csmap dem.tif csmap.tif --height_scale 0 500 --slope_scale 0 1 --curvature_scale -0.2 0.2 # you can change scale

Python API

from csmap.process import process, CsmapParams

params = CsmapParams() # use default params

# convert dem to csmap
process(
    input_dem_path,
    output_path,
    chunk_size=1024,
    params
)

development

uv sync
uv run pytest
uv run ruff check . && uv run ruff format --check .

processing image

Authors

Acknowledgements

Taku Fukada (@ciscorn) contributed the initial implementation by porting SAGA's calculations to Python, leveraging numpy for vectorization.

Release files for csmap-py 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csmap-py 0.2.0
File Size Uploaded
csmap_py-0.2.0.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for csmap-py 0.2.0
File Interpreter ABI Platform
csmap_py-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / csmap_py-0.2.0.tar.gz

Download URL csmap_py-0.2.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
759c1f15213cd2f557bd576e62e16624f2676fc89856ca767ac880d55d60d757
BLAKE2b-256 checksum
How to use checksums
7361a38638bac25e0746b130039517dabdfe7f9df03d4cd83532c3dc86251686
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / csmap_py-0.2.0-py3-none-any.whl

Download URL csmap_py-0.2.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2c653c6f10facb7fae6ee91f74eb627d5a1ce15cdb95305164bcc3646876964
BLAKE2b-256 checksum
How to use checksums
a147938d10eb3fdc64758e6eb58d95a29802d1d18d2bf7e2aabb5a2da0e69b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page