Munish
Munish

Reputation: 677

reading correct range of values from tif files in R

I am trying to open a .tif file containing values for canopy height. In my code, the values read are in the range (0,255). However, the provider of the file believes the values are in the range (0,40) and probably my software (which is R) is expanding the values. Please help and suggest how to tackle this programming issue and get the desired range without expanding. See the lines I wrote to read the file.

remove(list=ls())
library(raster)
read_file<-as.matrix(raster("veght_Part_d_7.tif")) #filename of attached image
min(read_file)
max(read_file) # returns 255 but supposedly return 40

enter image description here canopy height values in tif format

Upvotes: 1

Views: 582

Answers (1)

Lucas Fortini
Lucas Fortini

Reputation: 2470

This is a problem with your data, not r. I just opened the tif in arcgis to check in an alternative platform and the values are evenly distributed from 0 to 255, and do not concentrate at all between 0 and 40.

Upvotes: 3

Related Questions