Reading and writing files
SimpleSDMLayers.ascii
— Functionascii(file::AbstractString, datatype::Type{T}=Float64) where {T <: Number}
Reads the content of a grid file to a SimpleSDMPredictor
, the type of which is given by the datatype
argument.
ascii(layer::SimpleSDMPredictor{T}, file::AbstractString; nodata::T=convert(T, -9999)) where {T <: Number}
Writes a layer
to a grid file, with a given nodata
value. The layer must store numbers.
ascii(layer::SimpleSDMResponse{T}, file::AbstractString; nodata::T=convert(T, -9999)) where {T <: Number}
Writes a layer
to a grid file, with a given nodata
value. The layer must store numbers.
SimpleSDMLayers.geotiff
— Functiongeotiff(::Type{LT}, file, bandnumber::Integer=1; left=nothing, right=nothing, bottom=nothing, top=nothing) where {LT <: SimpleSDMLayer}
The geotiff function reads a geotiff file, and returns it as a matrix of the correct type. The optional arguments left
, right
, bottom
, and left
are defining the bounding box to read from the file. This is particularly useful if you want to get a small subset from large files.
The first argument is the type of the SimpleSDMLayer
to be returned.
geotiff(file::AbstractString, layer::SimpleSDMPredictor{T}; nodata::T=convert(T, -9999)) where {T <: Number}
Write a single layer
to a file
, where the nodata
field is set to an arbitrary value.
geotiff(file::AbstractString, layers::Vector{SimpleSDMPredictor{T}}; nodata::T=convert(T, -9999)) where {T <: Number}
Stores a series of layers
in a file
, where every layer in a band. See geotiff
for other options.
geotiff(file::AbstractString, layer::SimpleSDMResponse{T}; nodata::T=convert(T, -9999)) where {T <: Number}
Write a single SimpleSDMResponse
layer to a file.
geotiff(file::AbstractString, layers::Vector{SimpleSDMResponse{T}}; nodata::T=convert(T, -9999)) where {T <: Number}
Write a vector of SimpleSDMResponse
layers to bands in a file.