Hi,
I am trying to plot the Sea Surface Temperature (SST). For that I downloaded a tif file from Climate.gov. As you may find on the code (comments) I found that the values for the SST from this tiff file that I extract using the raster function are not the same they provide. Am I doing something wrong? Can I make an analysis based on a tiff file?
libs <-
c("tidyverse" # Collection of packages (visualization, manipulation): ggplot2, dplyr, purrr, etc)
)
# install missing libraries
installed_libs <- libs %in% rownames(installed.packages())
if (any(installed_libs == F)) {
install.packages(libs[!installed_libs])
}
# load libraries
invisible(lapply(libs, library, character.only = T))
lat <- 51 # 30
lon <- .5 # 30
ortho <- paste0(
'+proj=ortho +lat_0=',
lat,
' +lon_0=',
lon,
' +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs'
)
# first download zip file from:
# https://www.climate.gov/data/Ocean--Daily--Sea-Surface-Temperature--Global/04-full_res_zips/
sst_raw <- raster::raster("Ocean--Daily--Sea-Surface-Temperature--Global--2023-06-24--fullres/oisst-daily-cdr--4096x2051--2023-06-24.tif")
class(sst_raw) # "RasterLayer"
raster::plot(sst_raw)
names(sst_raw)
#
terra::summary(sst_raw)
# raster to terra
sst_raw <- terra::rast(sst_raw)
terra::global(sst_raw, fun = "mean", na.rm=T)
terra::global(sst_raw, fun = "min", na.rm=T) # min 20 , should be around 28F
terra::global(sst_raw, fun = "max", na.rm=T) # max: 252, should be around 90F
# Why does the max and min values differ from that of the original tiff file. Information present
# in the zip file shows that the temperature should be between 28F and 90F?
Information present on the zip file downloaded from site:
https://www.climate.gov/data/Ocean--Daily--Sea-Surface-Temperature--Global/04-full_res_zips/
Thank you very much,
Luis Barqueira