Skip to content

Different results reading categorical geotiff across platforms #761

@mjwoods

Description

@mjwoods

When reading land use categories in geotiff format, I get different results on Windows and MacOS binary distributions of R. In both cases, I have tested R_4.5.2 and stars_0.6-8, downloaded as binary packages using Windows 11 and MacOS Tahoe.

The dataset being used was downloaded and unpacked from ABARES catchment scale land use of Australia.

A map showing the expected contents of the dataset is available here.

On each platform, I ran the following code:

library(stars)
library(ggplot2)

tiff <- "clum_50m_2023_v2/clum_50m_2023_v2.tif"

raw <- read_stars(tiff)
rasterio <- list(nXOff=1, nYOff=1,
                 nXSize=dim(raw)[1], nXSize=dim(raw)[2],
                 nBufXSize=dim(raw)[1]/50, nBufYSize=dim(raw)[1]/50,
                 bands=1, resample="nearest_neighbour")

land <- read_stars(tiff, RasterIO=rasterio, RAT="SIMP")
print(ggplot() + geom_stars(data=land))

MacOS results are shown in the first figure below. It appears that numeric values were read instead of categories.

Image

Windows results are as follows. Although categories were read, many categories and data points are missing.

Image

Does this indicate bugs and/or missing features in the binary packages on each platform?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions