Reference

Docstrings for SpatRasters.

AbstractSpatRaster

No documentation found for public symbol.

Summary

abstract type AbstractSpatRaster{T, N}

Subtypes

SpatRaster{T, N}

D8Direction

No documentation found for public symbol.

SpatRasters.D8Direction is a Function.

# 1 method for generic function "D8Direction" from SpatRasters:
 [1] D8Direction(dem::AbstractMatrix{T}, i::Int64, j::Int64, spill::T) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/D8Direction.jl:2

DirLength

No documentation found for public symbol.

SpatRasters.DirLength is a Function.

# 1 method for generic function "DirLength" from SpatRasters:
 [1] DirLength(idir::Int64)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/Hydro.jl:116

InGrid

No documentation found for public symbol.

SpatRasters.InGrid is a Function.

# 2 methods for generic function "InGrid" from SpatRasters:
 [1] InGrid(i::Int64, j::Int64, nrow::Int64, ncol::Int64)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/Hydro.jl:106
 [2] InGrid(x::AbstractMatrix, i::Int64, j::Int64)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/Hydro.jl:110

NextCell

No documentation found for public symbol.

SpatRasters.NextCell is a Function.

# 1 method for generic function "NextCell" from SpatRasters:
 [1] NextCell(dem::AbstractMatrix, i::Int64, j::Int64, dir::UInt8)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/Hydro.jl:120

SpatRaster

  • A::AbstractArray
  • b::bbox
  • cellsize::Tuple{Real, Real}
  • lon::AbstractVector{<:Real}
  • lat::AbstractVector{<:Real}
  • time::Union{Nothing, AbstractVector}
  • bands::Union{Nothing, AbstractVector{String}}
  • name::String
  • nodata::Union{Nothing, AbstractVector{T}} where T
SpatRaster(A, b::bbox; reverse_lat=true, kw...)
  • kw: other parameters: time, name

SpatRasters

No docstring found for public module SpatRasters.

Public names

AbstractSpatRaster, D8Direction, DirLength, InGrid, NextCell, SpatRaster, bandnames, bbox, bbox2cellsize, bbox2dims, bbox2lims, bbox2ndim, bbox2range, bbox2vec, bbox_overlap, cellArea, col_goto, earth_dist, fliplr, flipud, gdal_info, gdal_nodata, gdal_polygonize, gdalinfo, getgeotransform, gis2tau, gis2wflow, guanshan_dem, guanshan_flowdir_cpp, guanshan_flowdir_gis, in_bbox, isscalar, merge_var, merge_var!, nband, nlayer, nlyr, ogr_info, range2bbox, rast, read_gdal, read_sf, resample_first, rm_shp, row_goto, set_bandnames, st_bbox, st_cellsize, st_crop, st_dims, st_extract, st_location, st_location_exact, st_location_fast, st_mosaic, st_points, st_read, st_write, tau2gis, write_gdal, write_sf, xy2ij

Displaying contents of readme found at /home/runner/work/SpatRasters.jl/SpatRasters.jl/README.md

SpatRasters.jl: Simple Spatial Rasters in Julia

<!– Stable –> Dev CI Codecov

Dongdong Kong

SpatRaster is a simple spatial raster with WGS84 projection, abbreviated as rast.

Due to its simplicity, SpatRasters.jl doesn’t rely on any other geospatial packages, which makes SpatRasters.jl more lightweight than GeoArrays and Rasters.jl.

SpatRasters.jl used the class and function of R language terra and sf packages.

julia -e "@time using SpatRasters"
# 0.053372 seconds (50.83 k allocations: 3.506 MiB, 8.44% compilation time)

bandnames

No documentation found for public symbol.

SpatRasters.bandnames is a Function.

# 0 methods for generic function "bandnames" from SpatRasters

bbox

bbox(xmin, ymin, xmax, ymax)
bbox(;xmin, ymin, xmax, ymax)
bbox2tuple(b::bbox)
bbox2vec(b::bbox)
bbox2affine(size::Tuple{Integer, Integer}, b::bbox)

Spatial bounding box

bbox2cellsize

No documentation found for public symbol.

SpatRasters.bbox2cellsize is a Function.

# 1 method for generic function "bbox2cellsize" from SpatRasters:
 [1] bbox2cellsize(b::bbox, size)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/bbox.jl:19

bbox2dims

bbox2dims(b::bbox; size=nothing, cellsize=nothing, reverse_lat=true)

Arguments

  • cellsize: celly为负,则lat倒序

bbox2lims

No documentation found for public symbol.

SpatRasters.bbox2lims is a Function.

# 1 method for generic function "bbox2lims" from SpatRasters:
 [1] bbox2lims(b::bbox)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/bbox.jl:66

bbox2ndim

No documentation found for public symbol.

SpatRasters.bbox2ndim is a Function.

# 1 method for generic function "bbox2ndim" from SpatRasters:
 [1] bbox2ndim(b; size, cellsize)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/bbox.jl:49

bbox2range

No documentation found for public symbol.

SpatRasters.bbox2range is a Function.

# 1 method for generic function "bbox2range" from SpatRasters:
 [1] bbox2range(b::bbox)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/bbox.jl:63

bbox2vec

No documentation found for public symbol.

SpatRasters.bbox2vec is a Function.

# 1 method for generic function "bbox2vec" from SpatRasters:
 [1] bbox2vec(b::bbox)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/bbox.jl:65

bbox_overlap

No documentation found for public symbol.

SpatRasters.bbox_overlap is a Function.

# 1 method for generic function "bbox_overlap" from SpatRasters:
 [1] bbox_overlap(b::bbox, box::bbox; size, cellsize, reverse_lat, zip)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/bbox.jl:70

cellArea

No documentation found for public symbol.

SpatRasters.cellArea is a Function.

# 1 method for generic function "cellArea" from SpatRasters:
 [1] cellArea(x, y, cellsize)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/SpatRasters.jl:106

col_goto

No documentation found for public symbol.

SpatRasters.col_goto is a Function.

# 1 method for generic function "col_goto" from SpatRasters:
 [1] col_goto(col::Int64, idir::Int64)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/Hydro.jl:104

earth_dist

earth_dist(x1::Matrix, x2::Matrix; R=6378.388)
earth_dist(p1::Tuple{FT,FT}, x2::AbstractMatrix; R=6378.388) where {FT}
p1 = [110 30; 111 31]
p2 = [113 32; 115 35]
earth_dist(p1, p2)

fliplr

No documentation found for public symbol.

SpatRasters.fliplr is a Function.

# 2 methods for generic function "fliplr" from SpatRasters:
 [1] fliplr(x::AbstractArray{T, 3}) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/Ops.jl:14
 [2] fliplr(x::AbstractMatrix{T}) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/Ops.jl:13

flipud

No documentation found for public symbol.

SpatRasters.flipud is a Function.

# 2 methods for generic function "flipud" from SpatRasters:
 [1] flipud(x::AbstractArray{T, 3}) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/Ops.jl:12
 [2] flipud(x::AbstractMatrix{T}) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/Ops.jl:11

gdal_info

No documentation found for public symbol.

SpatRasters.gdal_info is a Function.

# 0 methods for generic function "gdal_info" from SpatRasters

gdal_nodata

No documentation found for public symbol.

SpatRasters.gdal_nodata is a Function.

# 0 methods for generic function "gdal_nodata" from SpatRasters

gdal_polygonize

No documentation found for public symbol.

SpatRasters.gdal_polygonize is a Function.

# 0 methods for generic function "gdal_polygonize" from SpatRasters

gdalinfo

No documentation found for public symbol.

SpatRasters.gdalinfo is a Function.

# 0 methods for generic function "gdalinfo" from SpatRasters

getgeotransform

No documentation found for public symbol.

SpatRasters.getgeotransform is a Function.

# 1 method for generic function "getgeotransform" from SpatRasters:
 [1] getgeotransform(ra::AbstractSpatRaster)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/Ops.jl:2

gis2tau

No documentation found for public symbol.

SpatRasters.gis2tau is a Function.

# 1 method for generic function "gis2tau" from SpatRasters:
 [1] gis2tau(A::AbstractArray)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/Hydro.jl:59

gis2wflow

No documentation found for public symbol.

SpatRasters.gis2wflow is a Function.

# 1 method for generic function "gis2wflow" from SpatRasters:
 [1] gis2wflow(A::AbstractArray)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/Hydro.jl:50

guanshan_dem

No documentation found for public symbol.

SpatRasters.guanshan_dem is of type String.

Summary

mutable struct String

Supertype Hierarchy

String <: AbstractString <: Any

guanshan_flowdir_cpp

No documentation found for public symbol.

SpatRasters.guanshan_flowdir_cpp is of type String.

Summary

mutable struct String

Supertype Hierarchy

String <: AbstractString <: Any

guanshan_flowdir_gis

No documentation found for public symbol.

SpatRasters.guanshan_flowdir_gis is of type String.

Summary

mutable struct String

Supertype Hierarchy

String <: AbstractString <: Any

in_bbox

in_bbox(b::bbox, (lon, lat))  
in_bbox(bs::Vector{bbox}, (lon, lat))

isscalar

No documentation found for public symbol.

SpatRasters.isscalar is a Function.

# 2 methods for generic function "isscalar" from SpatRasters:
 [1] isscalar(::Nothing)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/tools_Ipaper.jl:4
 [2] isscalar(x)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/tools_Ipaper.jl:3

merge_var

merge_var(fs; vars=nothing, var=nothing,
    progress=true, box::Union{bbox,Nothing}=nothing)

Arguments

  • fs: tiff file paths
  • vars: variables in the tiff
  • var: variable to merge

Examples

box = bbox(-180, -60, 180, 90)

merge_var!

No documentation found for public symbol.

SpatRasters.merge_var! is a Function.

# 1 method for generic function "merge_var!" from SpatRasters:
 [1] merge_var!(R::AbstractArray, f; var, box, cellsize)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_mosaic.jl:35

nband

No documentation found for public symbol.

SpatRasters.nband is a Function.

# 1 method for generic function "nband" from SpatRasters:
 [1] nband(ra::SpatRaster{T, N}) where {T, N}
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/SpatRaster.jl:21

nlayer

No documentation found for public symbol.

SpatRasters.nlayer is a Function.

# 0 methods for generic function "nlayer" from SpatRasters

nlyr

No documentation found for public symbol.

SpatRasters.nband is a Function.

# 1 method for generic function "nband" from SpatRasters:
 [1] nband(ra::SpatRaster{T, N}) where {T, N}
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/SpatRaster.jl:21

ogr_info

No documentation found for public symbol.

SpatRasters.ogr_info is a Function.

# 0 methods for generic function "ogr_info" from SpatRasters

range2bbox

No documentation found for public symbol.

SpatRasters.range2bbox is a Function.

# 1 method for generic function "range2bbox" from SpatRasters:
 [1] range2bbox(r::AbstractVector)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/bbox.jl:68

rast

No documentation found for public symbol.

Summary

mutable struct SpatRaster{T, N}

Fields

A        :: AbstractArray{T, N}
b        :: bbox
cellsize :: Tuple{Real, Real}
lon      :: AbstractVector{<:Real}
lat      :: AbstractVector{<:Real}
time     :: Union{Nothing, AbstractVector}
bands    :: Union{Nothing, AbstractVector{String}}
name     :: String
nodata   :: Union{Nothing, AbstractArray{T, 1}}

Supertype Hierarchy

SpatRaster{T, N} <: AbstractSpatRaster{T, N} <: Any

read_gdal

No documentation found for public symbol.

SpatRasters.read_gdal is a Function.

# 3 methods for generic function "read_gdal" from SpatRasters:
 [1] read_gdal(file::AbstractString, b::bbox, options...)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/IO.jl:35
 [2] read_gdal(file::AbstractString, indices, b::bbox, options...)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/IO.jl:22
 [3] read_gdal(files::Vector{<:AbstractString}, options...)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/IO.jl:13

read_sf

No documentation found for public symbol.

SpatRasters.read_sf is a Function.

# 0 methods for generic function "read_sf" from SpatRasters

resample_first

No documentation found for public symbol.

SpatRasters.resample_first is a Function.

# 1 method for generic function "resample_first" from SpatRasters:
 [1] resample_first(r::AbstractArray; fact, deepcopy)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_resample.jl:6

rm_shp

No documentation found for public symbol.

SpatRasters.rm_shp is a Function.

# 1 method for generic function "rm_shp" from SpatRasters:
 [1] rm_shp(f)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/SpatRasters.jl:83

row_goto

rowgoto(row::Int, idir::Int)::Int colgoto(col::Int, idir::Int)::Int

Details

  • flow direction 32 64 128 16 0 1 8 4 2

Arguments

  • k: 8-neighbor 6 7 8 5 1 4 3 2

set_bandnames

No documentation found for public symbol.

SpatRasters.set_bandnames is a Function.

# 0 methods for generic function "set_bandnames" from SpatRasters

st_bbox

No documentation found for public symbol.

SpatRasters.st_bbox is a Function.

# 5 methods for generic function "st_bbox" from SpatRasters:
 [1] st_bbox(bs::Vector{bbox})
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_bbox.jl:22
 [2] st_bbox(f::String)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_bbox.jl:15
 [3] st_bbox(lon, lat)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_bbox.jl:8
 [4] st_bbox(v::Vector{<:Real})
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_bbox.jl:4
 [5] st_bbox(r::AbstractSpatRaster)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_bbox.jl:2

st_cellsize

No documentation found for public symbol.

SpatRasters.st_cellsize is a Function.

# 3 methods for generic function "st_cellsize" from SpatRasters:
 [1] st_cellsize(f::AbstractString)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_dims.jl:51
 [2] st_cellsize(lon::AbstractVector, lat::AbstractVector)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_dims.jl:47
 [3] st_cellsize(r::AbstractSpatRaster)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_dims.jl:45

st_crop

No documentation found for public symbol.

SpatRasters.st_crop is a Function.

# 2 methods for generic function "st_crop" from SpatRasters:
 [1] st_crop(f::String, b::bbox)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_crop.jl:3
 [2] st_crop(ra::SpatRaster, b::bbox)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_crop.jl:5

st_dims

No documentation found for public symbol.

SpatRasters.st_dims is a Function.

# 3 methods for generic function "st_dims" from SpatRasters:
 [1] st_dims(x::SpatRasters.FileGDAL)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_dims.jl:32
 [2] st_dims(f::String)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_dims.jl:26
 [3] st_dims(r::AbstractSpatRaster)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_dims.jl:24

st_extract

No documentation found for public symbol.

SpatRasters.st_extract is a Function.

# 1 method for generic function "st_extract" from SpatRasters:
 [1] st_extract(ra::AbstractSpatRaster, points::Array{Tuple{T, T}, 1}; combine) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_extract.jl:69

st_location

No documentation found for public symbol.

SpatRasters.st_location is a Function.

# 1 method for generic function "st_location" from SpatRasters:
 [1] st_location(ra::AbstractSpatRaster, points::Array{Tuple{T, T}, 1}; kw...) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_extract.jl:63

st_location_exact

No documentation found for public symbol.

SpatRasters.st_location_exact is a Function.

# 1 method for generic function "st_location_exact" from SpatRasters:
 [1] st_location_exact(lon::AbstractVector, lat::AbstractVector, points::Array{Tuple{T, T}, 1}; rm_empty, cellsize, tol) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/st_extract.jl:12

st_location_fast

st_location(r::Raster, points::Vector{Tuple{T,T}})

return the overlaping indexes inds, and corresponding (i,j)

Examples

inds, locs = st_location(r, points)

st_mosaic

st_mosaic(rs::Vector{SpatRaster{T,N}}; kw...) where {T,N}

Arguments

  • kw: others to SpatRaster

st_points

No documentation found for public symbol.

SpatRasters.st_points is a Function.

# 1 method for generic function "st_points" from SpatRasters:
 [1] st_points(x::AbstractVector, y::AbstractVector)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/SpatRasters.jl:71

st_read

No documentation found for public symbol.

SpatRasters.read_gdal is a Function.

# 3 methods for generic function "read_gdal" from SpatRasters:
 [1] read_gdal(file::AbstractString, b::bbox, options...)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/IO.jl:35
 [2] read_gdal(file::AbstractString, indices, b::bbox, options...)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/IO.jl:22
 [3] read_gdal(files::Vector{<:AbstractString}, options...)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/IO.jl:13

st_write

No documentation found for public symbol.

SpatRasters.write_gdal is a Function.

# 0 methods for generic function "write_gdal" from SpatRasters

tau2gis

No documentation found for public symbol.

SpatRasters.tau2gis is a Function.

# 1 method for generic function "tau2gis" from SpatRasters:
 [1] tau2gis(A::AbstractArray)
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/hydro/Hydro.jl:67

write_gdal

No documentation found for public symbol.

SpatRasters.write_gdal is a Function.

# 0 methods for generic function "write_gdal" from SpatRasters

write_sf

No documentation found for public symbol.

SpatRasters.write_sf is a Function.

# 0 methods for generic function "write_sf" from SpatRasters

xy2ij

No documentation found for public symbol.

SpatRasters.xy2ij is a Function.

# 2 methods for generic function "xy2ij" from SpatRasters:
 [1] xy2ij(point::Tuple{T, T}, ra::SpatRaster) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/SpatRasters.jl:100
 [2] xy2ij(x::T, y::T, b::bbox, cellsize) where T<:Real
     @ ~/work/SpatRasters.jl/SpatRasters.jl/src/SpatRasters.jl:89