Py学习  »  机器学习算法

Raster4ML:用于机器学习的地理空间栅格处理库

气象学家 • 1 年前 • 249 次点击  

Raster4ML:用于机器学习的地理空间栅格处理库

链接:https://github.com/remotesensinglab/raster4ml

When geospatial raster data is concerned in a machine learning pipeline, it is often required to extract meaningful features, such as vegetation indices (e.g., NDVI, EVI, NDRE, etc.) or textures. This package provides easy-to-use functions that can automatically calculates the features with one or several lines of codes in Python. It also has the functionality of extracting statistics based on shapefile (i.e., point or polygon) from a raster data. Any type of raster data is supported regardless of satellite or UAVs.

Key Features

  • Stack raster bands
  • Automatically calculate vegetation indices (supports 350+ indices)
  • Extract raster values based on shapefile
  • Clip raster based on polygon

Documentation

Detailed documentation with tutorials can be found here: https://raster4ml.readthedocs.io/

How to Use?

  1. Stacking bands
    stack_bands(image_paths=['Band_1.tif''Band_2.tif''Band_3.tif',
                             'Band_4.tif''Band_5.tif''Band_6.tif'],
                out_file='Stack.tif')
  2. Vegetation index calculation
    VI = VegetationIndices(image_path='Landsat8.tif',
                           wavelengths=[442.96, 482.04, 561.41, 654.59, 864.67, 1608.86, 2200.73])
    VI.calculate(out_dir='vegetation_indices')
  3. Dynamic visualization in Jupyter Notebook
    m = Map()
    m.add_raster(image_path='Landsat8.tif', bands=[4, 3, 2])
    Output:

How to Install?

Dependencies

Raster4ML is built on top of geopandas, rasterio, fiona, pyproj, rtree, shapely, numpy, and pandas.

Virtual Environment

It is prefered to use a virtual environment for working with this package. Use Anaconda or Miniconda to create a seperate environment and then install the package and its dependencies there.

conda create --name raster4ml python=3
conda activate raster4ml

Windows

To install on Windows, first download the wheel files for GDAL, rasterio, and fiona from Christoph Gohlke's website (🤗Thanks Christoph🤗). Go to his website, press Ctrl+F and type gdal. Download the GDAL file that mostly matches your computer configuration (64-bit or 32-bit) and Python version.

After downloading it, cd into the downloaded directory while the raster4ml environment is activated. Then install using pip. Do the same for rasterio and fiona.

pip install GDAL‑3.4.3‑cp310‑cp310‑win_amd64.whl
pip install rasterio‑1.2.10‑cp310‑cp310‑win_amd64.whl
pip install Fiona‑1.8.21‑cp310‑cp310‑win_amd64.whl

If these three are installed, the rest of the dependencies can be installed directly through Raster4ML's pip distribution.

pip install raster4ml

Tutorials

There are two tutorials provided. Find them in docs/tutorials.

Questions?

Please report bugs at https://github.com/remotesensinglab/raster4ml/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your local setup that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.








声明:欢迎转载、转发本号原创内容,可留言区留言或者后台联系小编(微信:gavin7675)进行授权。气象学家公众号转载信息旨在传播交流,其内容由作者负责,不代表本号观点。文中部分图片来源于网络,如涉及作品内容、版权和其他问题,请后台联系小编处理。

   欢迎加入气象学家交流群   

请备注:姓名/昵称-单位/学校-研究方向



往期推荐

 ERA5-Land陆面高分辨率再分析数据(32TB)

★ NASA最新版本CMIP6降尺度数据集30TB

★ ERA5常用变量再分析数据(26TB)

 EC数据商店推出Python在线处理工具箱

★ EC打造实用气象Python工具Metview

 TRMM 3B42降水数据(Daily/3h)

 科研数据免费共享: GPM卫星降水数据

 气象圈子有人就有江湖,不要德不配位!

 请某气象公众号不要 “以小人之心,度君子之腹”!

★ 机器学习简介及在短临天气预警中的应用

★ AMS推荐|气象学家-海洋学家的Python教程

★ Nature-地球系统科学领域的深度学习及理解

★ 采用神经网络与深度学习来预报降水、温度

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/149170
 
249 次点击