All Projects → up42 → fake-geo-images

up42 / fake-geo-images

Licence: MIT License
A module to programmatically create geotiff images which can be used for unit tests

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to fake-geo-images

xyz-spaces-python
Manage your XYZ Hub or HERE Data Hub spaces from Python.
Stars: ✭ 29 (+61.11%)
Mutual labels:  geospatial
InstantMock
Create mocks easily in Swift
Stars: ✭ 88 (+388.89%)
Mutual labels:  unit-testing
angular-material-boilerplate
A straightforward and well structured boilerplate based on Google's Angular Material project.
Stars: ✭ 28 (+55.56%)
Mutual labels:  unit-testing
lonlat bng
A multithreaded Rust library with FFI for converting WGS84 longitude and latitude coordinates into BNG (OSGB36) Eastings and Northings and vice versa (using OSTN15)
Stars: ✭ 20 (+11.11%)
Mutual labels:  geospatial
Wasmite
Now WebAssembly has proper testing, unit-testing and debugging 🤗
Stars: ✭ 20 (+11.11%)
Mutual labels:  unit-testing
rafagas
Daily geospatial links curated by Raf Roset
Stars: ✭ 17 (-5.56%)
Mutual labels:  geospatial
pylandtemp
Algorithms for computing global land surface temperature and emissivity from NASA's Landsat satellite images with Python.
Stars: ✭ 110 (+511.11%)
Mutual labels:  geospatial
dea-coastlines
Extracting tidally-constrained annual shorelines and robust rates of coastal change from freely available Earth observation data at continental scale
Stars: ✭ 24 (+33.33%)
Mutual labels:  geospatial
Fineract-CN-mobile
DEPRECATED project - Check the Apache fineract-cn-mobile project instead
Stars: ✭ 17 (-5.56%)
Mutual labels:  unit-testing
StoreCleanArchitecture-NET
This is a basic project to demonstrate an introduction about the implementation of Clean Architecture on .NET
Stars: ✭ 19 (+5.56%)
Mutual labels:  unit-testing
pygeoif
Basic implementation of the __geo_interface__
Stars: ✭ 44 (+144.44%)
Mutual labels:  geospatial
wp-phpunit
WordPress core PHPUnit library. [READ ONLY] Versions for new WordPress releases are built daily.
Stars: ✭ 65 (+261.11%)
Mutual labels:  unit-testing
how-to-qemu-arm-gdb-gtest
How to run, debug, and unit test ARM code on X86 ubuntu
Stars: ✭ 19 (+5.56%)
Mutual labels:  unit-testing
jasmine-marbles
Marble testing helpers for RxJS and Jasmine
Stars: ✭ 102 (+466.67%)
Mutual labels:  unit-testing
angular-unit-testing-examples
Showroom for different Angular unit testing concepts
Stars: ✭ 19 (+5.56%)
Mutual labels:  unit-testing
earthengine-py-examples
A collection of 300+ examples for using Earth Engine and the geemap Python package
Stars: ✭ 76 (+322.22%)
Mutual labels:  geospatial
Geospatial Python CourseV1
This is an collection of blog posts turned into a course format
Stars: ✭ 53 (+194.44%)
Mutual labels:  geospatial
karta
A tidy Python package for geospatial computation
Stars: ✭ 98 (+444.44%)
Mutual labels:  geospatial
rusty buntdb
A Rust port of BuntDB
Stars: ✭ 12 (-33.33%)
Mutual labels:  geospatial
riteway-jest
Unit tests that always supply a good bug report when they fail for Jest.
Stars: ✭ 24 (+33.33%)
Mutual labels:  unit-testing

fake-geo-images

A module to programmatically create geotiff images which can be used for unit tests.

The underlying idea is that in order to write unit tests for geospatial image processsing algorithms, it is necessary to have an actual input image file or array. Organising these test images becomes a chore over time, they should not be stored in git as they are large binary data and when stored outside, there always is the danger that they are not updated according to changes in the code repo.

fake-geo-images provides a solution to the problem by providing simple code that allows to create geospatial images (so far geotiffs) in a parameterised way.

Install package

pip install fake-geo-images

Run tests

pytest

Usage

In the following an example unit test for a hypothetical NDVI function.

import numpy as np
import rasterio as rio
from pathlib import Path

from rasterio.transform import from_origin
from my_image_processing import ndvi
from fake_geo_images.fakegeoimages import FakeGeoImage

def test_ndvi():
    """
    A unit test if an NDVI method works in general
    """
    # Create 4-band image simulating RGBN as needed for NDVI
    test_image, _ = FakeGeoImage(
        300,
        150,
        4,
        "uint16",
        out_dir=Path("/tmp"),
        crs=4326,
        nodata=0,
        nodata_fill=3,
        cog=False,
    ).create(seed=42, transform=from_origin(13.428596, 52.494384, 0.000006, 0.000006))

    ndvi_image = ndvi(test_image)

    with rio.open(str(ndvi_image)) as src:
        ndvi_array = src.read()
        # NDVI only has one band of same size as input bands
        assert ndvi_array.shape == (1, 300, 150)
        # NDVI has float values between -1 and 1
        assert ndvi_array.dtype == np.float
        assert ndvi_array.min >= -1
        assert ndvi_array.max <= 1
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].