Skip to main content

Multisimil

This is a Python package to calculate similarity between two classified images at multiple scales.

The main objective of this package is to enable comparision of actual and predicted land use maps at multiple scales so a more relaxed assesment of accuracy can be done which is not possible with pixel to pixel comarision. It allows for the simulated map to miss the exact location of particular land use by a few pixels (specified by the user), and still will be considered a good prediction.

The module can be installed by:

! pip install multisimil

It is important to understand that in case of pixel to pixel comarision, even if when the entire map is shifted by 1 pixel, it will drastically reduce the accuracy. However, with comparing the frequecy of occurance of different land use classes in a neighborhood, a better comparision can be made.

import multisimil
from osgeo import gdal

image1 = "path/to/image1.tif"
image2 = "path/to/image2.tif"

rband1 = gdal.Open(image1).GetRasterBand(1)
rband2 = gdal.Open(image2).GetRasterBand(1)

array1 = rband1.ReadAsArray()
array2 = rbdand2.ReadAsArray()

nodata1 = rband1.GetNoDataValue()
nodata2 = rband2.GetNoDataValue()

array1[array1 == nodata1] = 0
array2[array2 == nodata2] = 0

# TO use 9*9 neighborhood, set f = 9
similarity = multisimil.calculate_similarity(array1, array2, f = 9)

Similarly, we can calculate similarity for multiple neighborhood filter sizes.

# This will calculate similarity for neighborhood sizes from 1*1 to 91*91
find_multiresolution_similarity(array1, array2, min_size = 1, max_size = 100, steps = 10)

More features to come soon.

Release files for multisimil 0.0.1.1

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

Source distribution (sdist)

Source distribution for multisimil 0.0.1.1
File Size Uploaded
multisimil-0.0.1.1.tar.gz 4.5 kB Details

Release files / multisimil-0.0.1.1.tar.gz

Download URL multisimil-0.0.1.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
768c4af4406dbb57dea2d6266e11da1ddf34edbe97bcda81da76efb572cf720a
BLAKE2b-256 checksum
How to use checksums
206122b55ce5df493e0bda20739d2fbfa487f2b4b4596fab737b3eafefeb8726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.0.1.1 This release

1 release file

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