Skip to main content

Processing satellite data directly from TAR files.

Project description

Python-for-Remote-Sensing-and-GIS

PyRSGIS is a powerful module to read, manipulate and export geo-rasters. The module is built on the GDAL library, and is very efficient for various geospatial analysis.

Please find few example below:

Let's import the module by using the below code
import pyrsgis as rg

We will first start with reading raster and perform some basic operations. Make sure your current working directory is the same where the raster files are located, if not use the following command:
import os
os.chdir("d:/yourDirectory")

Please skip the last two lines of code if the directory is already set to the files location.
Considering that the raster bands are stacked already, reading a multispectral data would be:
yourRaster = rg.readtif("yourFilename.tif")

After the above code, various properties of the raster can be assessed.
print(yourRaster.rows)
print(yourRaster.cols)
will give you the number of rows and columns.

The number of bands can be checked using:
print(yourRaster.nbands)

Any particular band can be extarcted using:
yourBand = yourRaster.getband(bandNumber)

The above code returns the band as array which can be visualised using:
yourRaster.display(yourBand)

The extracted band can be exported using:
yourRaster.export(yourBand, "yourOutputFilename.tif")
This saves the extracted band to the same directory.

If stacked properly, the satellite sensor can also be determined.
print(yourRaster.satellite)

If the above code shows the correct satellite sensor correctly, then this getting this should be easy:
print(yourRaster.bandIndex)
This will show correctly the band number for available bands.

The NDVI (Normalised Difference Vgetaton Index) can be computed easily.
yourndvi = yourRaster.ndvi()
This returns the NDVI array,which can be exported using the same command used for the band above.

yourRaster.export(yourndvi, 'yourNDVI.tif', datatype='float')
One thing to notice is that the NDVI is of float datatype, whereas the raw bands are integer datatype. Float data export uses more space on hard drive, so the default has been set to integer. Therefore, to export any float datatype, the argument should be passed explicitly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrsgis-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

pyrsgis-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pyrsgis-0.1.1.tar.gz.

File metadata

  • Download URL: pyrsgis-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.4.4

File hashes

Hashes for pyrsgis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e1a3bcb19f1a3063c83ad8b70c56f070c4157449e88e2223053f7f53d8feea2e
MD5 fb64ebf713b498cdfa541ef7de7a1594
BLAKE2b-256 c9d0a9ea1b6d305fb6c2eea9a268c8d7d9181359c6c17cd22c01223f50b443e6

See more details on using hashes here.

File details

Details for the file pyrsgis-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyrsgis-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.4.4

File hashes

Hashes for pyrsgis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0269b4282bd38fffcbc3f1d2dd42ce673087ee5a9061187552ae4fa4bce2547e
MD5 f3cd077eac198515efbf0c30f467277e
BLAKE2b-256 64752eae8eb5c504663b95ee902c130b42e933db18e8dee5329f91fa278e2e6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page