View source: R/readWCFstyleNetCDF.R
| raster_wcflike | R Documentation |
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.
raster_wcflike(file, varname)
file |
NetCDF file name |
varname |
Variable name to extract from the netCDF file (can only extract one variable at a time). |
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
A raster file in GDA94 / Australian Albers (EPSG:3577).
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.