I have a problem when import my NetCDF files in R.

When I import .nc file which downloaded from Copernicus (CMIP6 product - Sea surface height above geoid - CanESM5-CanOE (Canada)), I use raster(), stack() or brick() but I don't have CRS identified:

nc_vars <- raster(paste0(dossier_vars, "/", list_vars[i]))

class      : RasterBrick
dimensions : 291, 360, 104760, 12  (nrow, ncol, ncell, nlayers)
resolution : 1, 1  (x, y)
extent     : -0.5, 359.5, -0.5, 290.5  (xmin, xmax, ymin, ymax)
crs        : NA
source     : H:/Variables_predictives/CMIP6__SSH2030.nc
names      : X2030.01.16, X2030.02.15, X2030.03.16, X2030.04.16, X2030.05.16, X2030.06.16, X2030.07.16, X2030.08.16, X2030.09.16, X2030.10.16, X2030.11.16, X2030.12.16
Date       : 2030-01-16, 2030-02-15, 2030-03-16, 2030-04-16, 2030-05-16, 2030-06-16, 2030-07-16, 2030-08-16, 2030-09-16, 2030-10-16, 2030-11-16, 2030-12-16
varname    : zos

When I download others variables of CMIP6 product in Copernicus, the CRS is +proj=longlat +datum=WGS84 +no_defs in my raster.

I try to use terra package with rast() and it's the same problem. I try too nc_open() from ntcd4 package to find the projection of the variable, but I don't have results. I don't find projection information in Copernicus website.

When I use EPSG code 4326 to project this .nc file in QGIS, I have this results (compared to world map in true 4326).

enter image description here

In general, NetCDF files are projected in WGS84 but I think for this files it's another projection but which one? And how can I find it?

  • Hard to fix without a pointer to the data. Your table of info for your raster shows a grid thats 360x4 cells, so that looks wrong. The map overlay shows your overlay data starts at (0,0) on the world map and it looks like a longitudinally-shifted projection starting at about 45E. In other words maybe you need to subtract 90 from the latitudes and then do a longitude "cycling" to get it to -180:180. But can't really help without a pointer to the data file.
    – Spacedman
    Feb 7, 2022 at 17:08
  • I edit my post with more precisions and true raster output because there was an error.
    – Romain
    Feb 8, 2022 at 7:53
  • I can't see how to get your data from the copernicus site. I do have a password but I'm not sure which options you have selected. Can you detail all the options, or maybe post the API request code that you get from the green button at the bottom of the form?
    – Spacedman
    Feb 8, 2022 at 15:56
  • My API request for this variable : import cdsapi c = cdsapi.Client() c.retrieve( 'projections-cmip6', { 'format': 'zip', 'temporal_resolution': 'monthly', 'experiment': 'ssp2_4_5', 'level': 'single_levels', 'variable': 'sea_surface_height_above_geoid', 'model': 'canesm5_canoe', 'date': '2030-01-01/2030-12-31', }, 'download.zip')
    – Romain
    Feb 8, 2022 at 18:53

1 Answer 1


I think a colleague found a solution. You need to use the libraries ROTATE (takes form (0,360) to (-180,180) and FLIP (vertical rotation).

See here for rotate https://stackoverflow.com/questions/25730625/how-to-convert-longitude-from-0-360-to-180-180

Since I'm new t this, it would be great if someone can confirm whether this is a sensible solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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