ASCIIrasters
Documentation for ASCIIrasters.
ASCIIrasters._check_and_parse_required
ASCIIrasters._check_nodata
ASCIIrasters._read_data
ASCIIrasters._read_header
ASCIIrasters.read_ascii
ASCIIrasters.write_ascii
ASCIIrasters._check_and_parse_required
— Method_check_and_parse
Checks that all required header parameters are here and parses them to the convenient types.
ASCIIrasters._check_nodata
— Method_check_nodata
If NODATAvalue is a header line, keep it as nodatavalue and detect its type. If NODATAvalue is missing, we set it to -9999.0 and its type to Any.
ASCIIrasters._read_data
— Method_read_data
Looks in header
for a number of lines to ignore, then writes the following lines in a matrix with required element type.
ASCIIrasters._read_header
— Method_read_header
Reads the first lines that don't start with a space. Converts them to a Dict with 9 entries with all the parameters we need both for assessing data type and keeping header parameters.
ASCIIrasters.read_ascii
— Methodread_ascii(filename::AbstractString) => Union{Tuple{Array, NamedTuple}, NamedTuple}
Reads an ASCII file. Parameters are parsed according to the AAIGrid format. Data elements are assumed to be of the same type as the nodatavalue header parameter if possible. If there is no NODATA_value field in the header, data type is estimated by checking if there are any floating numbers in the first 10 data rows.
Keywords
lazy
: when set totrue
, only the header offilename
will be read, and only theNamedTuple
of parameters be returned.
If not lazy
, returns a Tuple
with: an Array
of the data and a NamedTuple
of the header information.
ASCIIrasters.write_ascii
— Methodwrite_ascii(filename::AbstractString; kwargs...)
Writes data and header in an AAIGrid raster file.
Argument
dat
: theAbstractArray
of data to write
Keywords
Required:
ncols
andnrows
: numbers of columns and rowsxll
andyll
: coordinates of the lower-left cornerdx
anddy
: dx and dy cell sizes in coordinate units per pixel
Optional:
nodatavalue
: a value that should be considered as representing no data. Default is -9999.0detecttype
: when set totrue
, elements ofdat
are converted to the same type asnodatavalue
. Leavefalse
to coerce everything (bothdat
andnodatavalue
) toFloat32
.
Returns the written file name.