Giter Club home page Giter Club logo

rsar's Introduction

Travis-CI Build Status Binder License: GPL v3 Lifecycle Status Codecov test coverage

R package rsar

This package is under development, but a working use case is available at frycast/kmspd.

Features

Given a raster image or brick (i.e., multiple raster images), in tif format, the load_SAR_matrix function can load the brick into R and convert it into a matrix (called a SAR_matrix), where each image occupies one column of the matrix, and each row of the matrix represents one pixel in the image(s). The original raster attributes are stored in the SAR_matrix, so that conversion back to raster is straight forward (including with spatial geodata extent). Conversion to/from raster brick and SAR_matrix are handled by the functions brick_to_matrix and matrix_to_brick.

The function patchify_SAR_matrix is useful for reducing the resolution of the raster image(s) by aggregating (e.g., via taking the mean) within patches of specified height and width. The output and input format are both SAR_matrix, and the raster attributes are adjusted to suit the new resolution.

Installation

Installation with devtools:

devtools::install_github("frycast/rsar")
library(rsar)

Getting started

The load_SAR_matrix will import a raster brick from a tif file and convert the raster brick to a SAR_matrix. Each column of a SAR_matrix corresponds to a band in the original raster brick, and each row corresponds to a pixel. So if the raster brick has dimensions A x B x C then the SAR_matrix has dimensions A*B x C. The file path specified below is to a sample dataset in the package directory.

filename <- system.file("extdata", "MG_CC_sub_norm_testclip.tif", package="rsar")
sample <- load_SAR_matrix(filename)

The sample raster brick consists of a 43x50 raster image with 29 bands.

dim(sample)

See the help files

?load_SAR_matrix
?matrix_to_brick
?brick_to_matrix
?patchify_SAR_matrix

rsar's People

Contributors

frycast avatar symplescience avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.