1

I am trying to reproject some climate data that I downloaded from http://gdo-dcp.ucllnl.org/downscaled_cmip_projections/dcpInterface.html#Welcomein

The BCSD-CMIP5 data is found under the tab "Projections: Complete Archives".

The files are in netCDF format, but am running into some issues. The original raster data (let's call it rast1) when imported has the extent

xmin 235.25
xmax 293
ymin 25.125
ymax 52.875

and a crs of +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0

The other objects (both sp and raster) I am working with contain negative values for xmin and xmax

xmin        : -122.8021 
xmax        : -75.38249 
ymin        : 31.78881 
ymax        : 47.15952

When I try to reproject rast1 using the other objects (rast2), the extent does not change and even though the reprojected rast1 is in the same crs, the extents don't line up.

rast_new = projectRaster(rast1, rast2)

So I had to do the following:

rast_new = projectExtent(rast1,rast2)
rast_new = projectRaster(rast1,rast_new)
values(rast_new) = values(rast1) ### This is necessary because all the values were NA

However, even though rast_new is in the same projection as rast2

+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83
+units=m +no_defs +ellps=GRS80+towgs84=0,0,0

the plotting isn't the same. See image plots of two images with same crs

Just wondering what I can do to correct this? Needless to say, I am relatively new to understanding projections in R ( and projections in general!)

I have exported the two rasters and viewed in ArcGIS, to see if it was a plot() issue in R, but the images are the same as above, yet the projections are the same (according to ArcGIS 10.2). Even when I reproject the "bad" raster in ArcGIS, the projection does not appear to be in Albers Equal Area. When I import directly from the netCDF file into ArcGIS, the projection looks correct.

1

It looks like the first image is using the WSG84 geodetic reference system, whereas the second image is using GRS80, which is why is looks curved. This suggests the objects haven't been converted to the same CRS.

Can you provide the climate data, or a sample, so I or another user can look into this further?

  • I added some additional information to the question. – user44796 Dec 18 '14 at 17:45
  • Please can you link directly to the relevant files. I don't know which item on the website is rast1, rast2, etc. – Phil Dec 18 '14 at 19:22
  • rast1 would be one of the netcdf files in the archive (e.g. gdo-dcp.ucllnl.org/pub/dcp/archive/cmip5/bcsd/BCSD/access1-0/… It doesn't matter which one, all have the same extent and projection. rast2 is simply a spatial object in another projection. In my case albers equal area. – user44796 Dec 18 '14 at 21:29
  • 1
    I tried to obtain an appropriate file for rast1, but I'm not hunting around. If you can provide a minimal reproducible example, with explicit links to objects rast1, rast2, etc. I can try to recreate the issue and suggest a solution. As it stands, I can't help you further. – Phil Dec 22 '14 at 15:41
1

I posted at R-SIG-GEO and got this response from Dr. Hijmans.

http://r-sig-geo.2731867.n2.nabble.com/Raster-projection-alignment-issues-td7587564.html

Basically, you need to manually adjust the extent of the raster object. Specifically,

extent(r) <- extent(235.25-360, 293-360, 25.125, 52.875), 

or use the rotate function from the raster package

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.