fasterraster

A fast multi-threaded python library for performing raster operations with simple IO

https://github.com/asenogles/fasterraster

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: science.org
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.9%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

A fast multi-threaded python library for performing raster operations with simple IO

Basic Info
  • Host: GitHub
  • Owner: asenogles
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Size: 31.3 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 1
Created about 4 years ago · Last pushed over 2 years ago
Metadata Files
Readme License Citation

README.md

Faster-Raster

pypi image License

fasterraster is a fast multi-threaded python library for performing raster operations using openMP and numpy objects complete with simple IO.

  • Github repository: https://github.com/asenogles/fasterraster
  • PyPI: https://pypi.org/project/fasterraster

Motivation

fasterraster was developed to quickly perform raster operations, enabling self-supervised learning for raster based analyses. fasterraster provides a cython wrapper for optimized openMP c code. Data objects are handled by numpy allowing for straightforward memory management. Currently only computation of visual/morphological features have been implemented however this is open to expansion in the future. All code is still in development and thus it is recommended to test fully before use.

Installation

fasterraster has currently been tested on Linux and Microsoft windows operating systems. You will need python>=3.6 installed. It is recommended to install fasterraster within a virtual environment.

Install using pip

To install fasterraster from PyPI using pip:

console pip install fasterraster

Install from source

To build fasterraster from source, download this repository and run: console python3 setup.py build_ext --inplace Note: You will need to have the required build dependencies installed.

Example

```python import timeit import numpy as np import fasterraster as fr from pathlib import Path

NTESTS = 10

Load a .bil file containing a DEM

fname = Path('./test_data/dem.bil') dem = fr.read(fname)

regular python implementation of hillshade function

from https://www.neonscience.org/resources/learning-hub/tutorials/create-hillshade-py

def pyhillshade(dem, cellsize, azimuth=330, altitude=30): azimuth = 360.0 - azimuth

dem = dem / cell_size
x, y = np.gradient(dem)
slope = np.pi/2. - np.arctan(np.sqrt(x*x + y*y))
aspect = np.arctan2(-x, y)
azimuthrad = azimuth*np.pi/180.
altituderad = altitude*np.pi/180.

shaded = np.sin(altituderad)*np.sin(slope)
+ np.cos(altituderad)*np.cos(slope) * np.cos(
(azimuthrad - np.pi/2.) - aspect)

return 255*(shaded + 1)/2

Time hillshade computation using regular python

time = timeit.timeit(lambda: py_hillshade(dem.raster, dem.XDIM), number=NTESTS) print(f'python hillshade averaged {time/NTESTS:.3f} seconds')

Time hillshade computation using fasterraster for num-threads

numthreads = [1,2,4,8] for numt in numthreads: time = timeit.timeit(lambda: fr.hillshadefastermp(dem.raster, numt), number=NTESTS) print(f'hillshade averaged {time/NTESTS:.3f} seconds for {numt} threads') Example output: console python hillshade averaged 2.880 seconds hillshade averaged 0.081 seconds for 1 threads hillshade averaged 0.041 seconds for 2 threads hillshade averaged 0.034 seconds for 4 threads hillshade averaged 0.024 seconds for 8 threads ```

Owner

  • Login: asenogles
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Senogles"
  given-names: "Andrew"
  orcid: "https://orcid.org/0000-0002-6607-2934"
title: "fasterraster: A fast multi-threaded python library for performing raster operations with simple IO"
version: 0.0.1
doi: 10.5281/zenodo.6350746
date-released: 2022-03-13
url: "https://github.com/asenogles/fasterraster"

GitHub Events

Total
  • Fork event: 1
Last Year
  • Fork event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 13
  • Total Committers: 2
  • Avg Commits per committer: 6.5
  • Development Distribution Score (DDS): 0.154
Top Committers
Name Email Commits
asenogles s****a@o****u 11
asenogles 4****s@u****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 8 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 5
  • Total maintainers: 1
pypi.org: fasterraster

Fast multi-threaded raster operations with simple IO

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 8 Last month
Rankings
Dependent packages count: 10.0%
Dependent repos count: 21.7%
Average: 27.2%
Forks count: 29.8%
Stargazers count: 31.9%
Downloads: 42.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

setup.py pypi
  • cython >=0.29.21
  • numpy >=1.19.0
  • scipy >=1.7.0
  • tifffile *
pyproject.toml pypi