I've downloaded an 8-day composite (4x4km) of "chlorophyll a" for May 1, 2014. https://oceancolor.gsfc.nasa.gov/cgi/l3?per=8D&prd=CHL_chlor_a.nc&sen=A&res=4km&num=24&ctg=Standard&date=1May2015

I opened the chlorophyll file in r:


I then made the following polygon in r:

proj4string(polygonsp)<-CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")

I used the polygon to crop the chlorophyll raster to my study area:

chloro_area<-crop(chloro, polygonsp)

I wanted to look at the distribution of chlorophyll values in the region so I extracted the data as a data frame:


I can open this df and see the values without any problem. However, because of the format of my other data files, it is preferable for me to project the raster in UTM.

chloro_area_utm<-projectRaster(chloro_area, crs="+proj=utm +zone=9 ellps=WGS84 datum=WGS84")

However, when I try the same code, I get a data frame filled with NA values.


Why won't it work? I would like the raster to be in UTM so that I can overlay SpatialPoints, and calculate distances, etc.

  • Reprojecting is a destructive resampling process. What are the data like before that? – mdsumner Mar 15 '17 at 6:18
  • "Filled" with NA's? I get a border of NAs round the data, but if I plot it I can still see the data, and if I plot a transformed version of your polygon it fits round the data quite nicely. I'm not sure why there's a border of NAs. I suggest you crop the original to a wider area, transform the raster, then crop using a polygon in UTM coordinates. – Spacedman Mar 15 '17 at 7:42
  • We'll, that's embarrassing. Spacedman, turns out I didn't scroll through the df. There are lots of NAs for the borders, but the values are in there too. If reprojecting is a destructive resampling process, should I try to avoid it if I can? I've always been told that working with data that's only projected in latlong is poor practice. – Splash1199 Mar 15 '17 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.