raster_wcflike: Get raster values from the WCF style of netCDF files

View source: R/readWCFstyleNetCDF.R

raster_wcflikeR Documentation

Get raster values from the WCF style of netCDF files

Description

Raster, GDAL and Terra do not read the WCF and similar files properly. I suspect this is because Matlab produces netCDF files with dimension in an order inconsistent with GDAL and raster: x-dimension first and then y-dimension. There seems to be unreliability with using raster::t() and raster::flip(). Instead this function reads the values as a netcdf file.

Usage

raster_wcflike(file, varname)

Arguments

file

NetCDF file name

varname

Variable name to extract from the netCDF file (can only extract one variable at a time).

Details

At this point it seems like proj.4 string are still in use by raster, even though they seem be obsolete, even according to raster and sp. That means some of the WKT info in the WCF file is discarded and the super fine accuracy will be lost. See https://cran.r-project.org/web/packages/rgdal/vignettes/PROJ6_GDAL3.html#Status_22_April_2020

Value

A raster file in GDA94 / Australian Albers (EPSG:3577).

Examples

file <- "[fillmismatch]http://dapds00.nci.org.au/thredds/dodsC/ub8/au/LandCover/DEA_ALC/17_-39/fc_metrics_17_-39_2000.nc"
varname <- "WCF"
r <- raster_wcflike(file, varname = "WCF")

syd_latlong <- sf::st_sfc(sf::st_point(x = c(151.209900,  -33.865143), dim = "XY"),
      crs = 4326)
syd_ras <- sf::st_transform(syd_latlong, raster::crs(r))

raster::plot(r)
plot(add = TRUE, syd_ras)

sustainablefarms/sflddata documentation built on April 19, 2022, 11:19 a.m.