pyrsgis: A Python package to read, process and export GeoTIFFs.

pyrsgis enables the user to read, process and export GeoTIFFs. The module is built on the GDAL library, but is much more convenient when it comes to reading and exporting GeoTIFs. There are several other functions available in this package that ease raster pre-processing, some focused on machine learning tasks.

Feedback and bug reports are most welcome. Since this is an open-source project, I always look forward to contributors.

GitHub repository : https://github.com/PratyushTripathy/pyrsgis

pyrsgis is available on both, PyPI and Anaconda. Please submit your query as a pull request on the GitHub repo. For more information, write to: pratkrt@gmail.com

Installation

pyrsgis supports python 3.5 to 3.8 only. However, since there is no major reliability on the Python version, it should work on all Python 3 versions. Please ensure that you are using a python 3 environment.

Installing using PyPi

pyrsgis is available on the Python Package Index repository. It can be installed using pip from command line using the following command:

pip install pyrsgis

If you want to install a specific version, you can check the release history on the PyPI page to find out your version and install it by explicitly specifying the version.:

pip install pyrsgis==0.4.0

This can be useful since stable and latest versions are different.

Installing using Conda

pyrsgis is available on Anaconda too. It can be installed using the following command:

conda install -c pratyusht pyrsgis

Contributing to pyrsgis

pyrsgis is an open-source non-profit project and suggestions/ contributions are most welcome. To contribute to the project, you can fork the GitHub repo, clone the repository locally, make changes to the cloned version and submit a pull request.

pyrsgis - Python for Remote Sensing and GIS author: pratkrt<at>gmail.com Compatible with Python versions 3+

pyrsgis API reference

Reading and exporting GeoTIFFs

pyrsgis.raster.read(file[, bands])

Read raster file

pyrsgis.raster.export(arr, ds[, filename, …])

Export GeoTIFF file

Clipping a raster

pyrsgis.raster.clip(ds, data_arr, x_min, …)

ds : datasource object

pyrsgis.raster.clip_file(file, x_min, x_max, …)

Clip and export raster file in one go

pyrsgis.raster.trim(ds, data_arr, remove)

Trim raster array and modify ds

pyrsgis.raster.trim_array(data_arr[, …])

Trim raster array to remove NoData value at the edge

pyrsgis.raster.trim_file(filename, remove, …)

Trim and export raster file

Shifting a raster

pyrsgis.raster.shift(ds[, x, y, shift_type])

Shift the datasource of a raster file

pyrsgis.raster.shift_file(file[, …])

Shift and export raster file in one go

Reshaping GeoTIFF array for statistical analysis

pyrsgis.convert.array_to_table(arr)

Convert 2D or 3D array to table

pyrsgis.convert.table_to_array(table[, …])

Convert tablar array to 2D or 3D array

pyrsgis.convert.raster_to_csv(path[, …])

Convert raster to a tabular CSV file

pyrsgis.convert.csv_to_raster(csvfile, …)

Convert a CSV file to raster

Creating image chips for deep learning

pyrsgis.ml.array_to_chips(data_arr[, …])

Image chips from raster array

pyrsgis.ml.array2d_to_chips(data_arr[, …])

Image chips from 2D array

pyrsgis.ml.raster_to_chips(file[, y_size, …])

Image chips from raster file

Generating northing and easting raster

pyrsgis.raster.north_east(arr[, layer, …])

Generate row and column number arrays

pyrsgis.raster.north_east_coordinates(ds, arr)

Generate arrays with cell latitude and longitude value.

pyrsgis.raster.northing(reference_file[, …])

Generate northing raster using a reference .tif file

pyrsgis.raster.easting(reference_file[, …])

Generate easting raster using a reference .tif file