I'm working with two rasters that differ in their origin, extent, and resolution. I have a bathymetry raster, with a very high resolution (x=0.0008333333, y=0.0008333333) and a MUCH great spatial extent. I also have a sea surface temperature raster, which has a much coarser resolution (x=0.04166667, y=0.04166667). Both rasters have the same projection (longlat, datum=WGS84). Both rasters also have 'NA' values that correspond to landmasses.
Bathymetry data:
https://www.ngdc.noaa.gov/dem/squareCellGrid/download/4956
Sst data: June 25-July 2 (2016) 8 day composite, cropped to -131.8333, -127.6667, 50.125, 54.54166 (xmin, xmax, ymin, ymax)
I have manipulated the bathymetry raster (using R) to match the extent, origin, and resolution of the sea surface temperature raster.
bathy2<-projectRaster(bathymetry, sst, method="bilinear")
I made a data frame so that I could compare the sea surface temperature values and the bathymetry values at each pixel. I then noticed that I have a problem. Some of the pixels have 'NA' values for bathymetry, but numeric values for SST. How can this be, given that the landmasses should be in the exact same place? The original bathymetry raster has a much finer resolution than the SST raster, so its outline of the landmasses should be accurate.
Is this a result of using projectRaster(), or an issue with the data itself? Anyway I can fix it?
Best Answer
Bathymetry raster that you give us as example isn't worldwide, such SST raster. So, if you try to project the raster to SST with
projectRaster()
you'll get most ofNA
values in resampled data, because function resample to new resolution/extent/CRS. First, crop SST raster and after that, project bathymetry raster:NA data
From product description:
So you can expect valid values in coastlines or inner terrain. Those
NA
values comes from mismatch between valid values of SST in coastline. If you want to complete values for SST, you need to merge bathymetry with a surface DEM.