`GRTSmh_base4frac`

as a
SpatRaster`R/GRTSmh.R`

`read_GRTSmh_base4frac.Rd`

The `GRTSmh_base4frac`

data source is like a mirror to
`GRTSmaster_habitats`

, holding the ranking numbers as base 4 fractions.
The function returns it as a SpatRaster in the Belgian Lambert 72 CRS
(EPSG-code 31370).

read_GRTSmh_base4frac( file = file.path(locate_n2khab_data(), "20_processed/GRTSmh_base4frac/GRTSmh_base4frac.tif") )

file | The absolute or relative file path of the data source.
The default follows the data management advice in the
vignette on data storage (run |
---|

A SpatRaster with 21041043 cells.

If the package is configured to use the raster package
(see `n2khab_options()`

), a RasterLayer is
returned instead.

The data source file, read by the function, is a monolayered GeoTIFF in the
`FLT8S`

datatype and is available at
Zenodo.
In `GRTSmh_base4frac`

, the decimal (i.e. base 10) integer values from
the raster data source `GRTSmaster_habitats`

(see
`read_GRTSmh`

) have been converted into base 4 fractions,
using a precision
of 13 digits behind the decimal mark (as needed to cope with the range of
values).
For example, the integer `16`

(`= 4^2`

) has been converted into
`0.0000000000100`

and `4^12`

has been converted into
`0.1000000000000`

.

Long base 4 fractions seem to be handled and stored easier than long (base 4) integers. This approach follows the one of Stevens & Olsen (2004) to represent the reverse hierarchical order in a GRTS sample as base-4-fraction addresses.

See R-code in the
n2khab-preprocessing repository for the creation from
the `GRTSmaster_habitats`

data source.

Beware that not all GRTS ranking numbers are present in the data source, as the original GRTS raster has been clipped with the Flemish outer borders (i.e., not excluding the Brussels Capital Region).

Also, be warned that R does not regard the values as base 4, but
as base 10.
So, what really matters is only the notation with many digits, to be
*regarded* as a base 4 fraction.

Stevens D.L. & Olsen A.R. (2004). Spatially Balanced Sampling of Natural Resources. Journal of the American Statistical Association 99 (465): 262–278. doi:10.1198/016214504000000250 .

Other functions involved in processing the 'GRTSmaster_habitats' data source:
`convert_base4frac_to_dec()`

,
`convert_dec_to_base4frac()`

,
`read_GRTSmh_diffres()`

,
`read_GRTSmh()`

if (FALSE) { # This example supposes that your working directory or a directory up to 10 # levels above has # the 'n2khab_data' folder AND that the latest version of the # 'GRTSmh_base4frac' data source is present in the default subdirectory. # In all other cases, this example won't work but at least you can consider # what to do. oldopt <- options(scipen = 999, digits = 15) r <- read_GRTSmh_base4frac() r options(oldopt) }