Skip to content

mapbiomas-brazil/pasture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Vinícius Mesquita

Pasture Mapping Codes

This repository organizes the pasture mapping codes developed by Laboratório de Processamento de Imagens e Geoprocessamento (LAPIG/UFG). The methology used by LAPIG team is avaliable in the paper of PARENTE et al. (2017)

Requisites:

  • Python 3.9 or above

  • Gdal python package and Gdal Binaries

  • scipy python package

  • joblib python package

  • Earth Engine python library

  • An folder synchronization with Google Drive (For Windows | For Unix)

Recommendations for Windows:

Recommendations for Unix:

How to use

1. Run classification in Google Earth Engine (GEE)

You have 2 options for make your classification:

Using Python with GEE

First download/clone the in this Github repository, then acess the 1_gee_processing folder through the system terminal/prompt and execute the command bellow:

python LANDSAT_COL9_1985_2023_justRun_v2.py

Using JavaScript in GEE

  • Access this link and, if desired, change the parameters of year, landsatWRSPath, landsatWRSRow, my_folder. After that you can click in Run and export your result in Task.

Also, you can change the training dataset (cultivated and natural) by changing the variable TRAIN_DATA (line 9).

2. Prepare the data for Multidimensional Median Filter

Merge the classifications files by year using the binaries gdalbuildvrt and *gdal_translate. E.g.:

  • gdalbuildvrt lapig_pasture_map_|year xxxx|.vrt |year xxxx|.tif
  • gdal_translate lapig_pasture_map_|year xxxx|.vrt lapig_pasture_map_|year xxxx|.tif -co COMPRESS=LZW -co BIGTIFF=YES

In addition, if you want to view a file in a GIS like QGIS, just add a pyramid to your data using:

  • gdaladdo -ro lapig_pasture_map_.tif 2 4 8 --config COMPRESS_OVERVIEW LZW --config USE_RRD YES

3. Applying the multidimensional median filter (3 x 3 x 5)

This code need 2 arguments to run, the and the (e.g. python 2_Multidimensional_median_filter prob_rasters_dir filtered_rasters_dir).

python 2_Multidimensional_median_filter_parallel.py <input_dir_name> <output_dir_name>

4. Merging the files... again.

Like in the section 2, we will use the gdalbuildvrt and gdal_translate to merge the result files by year.

Changelog

* Version 3.0 released (Github version)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages