I need to use raster data from Copernicus Marine Service, that comes as netCDF format, and with ORCA025 tri-polar grid (1440 x 1021 grid points, the three poles are located over Antarctic, Central Asia and North Canada).

But what I need it's just simple rasters using regular latitudes and longitudes (I think that's called equirectangular projection, WSG84...) I don't have a GIS software (and even, not enough knowledge to use them), just R.

So I guess that the conversion could be done with R and maybe gdal package, but I have no idea of how to do it.

  • Check this page, this one and this question. After open your netCDF file as raster, you can reproject to equirectangular projection with projectRaster – aldo_tapia Sep 28 '17 at 11:03
  • Are you sure you need that? Presumably you'll have a long time series so it will be expensive to warp all these grids into this inferior non-format (with no metadata) - expensive in compute power and expensive in risk given that you are remodelling the entire product. Maybe you just need to project some other data into this space so you can use raster's efficient ?extract and cell-based functions. – mdsumner Sep 28 '17 at 13:16
  • thanks mdsummer, but yes, absolutely, I need that. Most of the other data I have (some also from Copernicus) are in equirectangular projection. And I need all data to make distribution models and other analyses, with different software tools that all use this projection. I don't know why Copernicus provides some data in one projection and other ones in another. But that's why I need to perform the conversion. – modestprog Sep 28 '17 at 14:10
  • many thanks @aldo_tapia, that helps a lot. But I didn't found the parameters to indicate that origin projection is ORCA. Googling I read that maybe proj4 (which is mentioned in the links you provided) don't support this projection. So I'm still stuck... – modestprog Sep 28 '17 at 14:22
  • I can't find any reference to this projection, so I do not know if it is supported by Proj4. However, you can perform the remap with the free tool CDO regardless of the initial grid, provided that you know the details of the output grid (or that you already have a fine on the output grid to extract the details from). If you are interested I can elaborate. As @mdsnumner points out, I would advise against going from a much superior format (NetCDF) to ESRI ASCII raster, which is way less efficient in speed, features, and space used. – AF7 Sep 29 '17 at 5:59

You can run gdalinfo on the netcdf file to see that it has the following subdatasets:

SUBDATASET_1_DESC=[1021x1442] longitude (32-bit floating-point)
SUBDATASET_2_DESC=[1021x1442] latitude (32-bit floating-point)
SUBDATASET_3_DESC=[1x75x1021x1442] mass_concentration_of_chlorophyll_in_sea_water (32-bit floating-point)

So gdalwarp can take the lon and lat information from the first two subdatasets, and store the result in a +/-180/90 degree raster with quarter-degree resolution by using this command line:

gdalwarp -overwrite -geoloc -t_srs EPSG:4326 -tr 0.25 0.25 NETCDF:"BIOMER_FREEGLORYS2V3_20161215_R20170703_gridCHL.nc":CHL out.tif

The result looks quite good, except for the edge of the source file in the Indian Ocean:

enter image description here


You can add -wo SOURCE_EXTRA=200 to the gdalwarp command to reduce the artefact, but that takes longer to compute, and does not remove it completely.

  • thank you very much @AndreJ !! I almost found a solution using gdalwarp, but it was largely more complicated than yours! What bothers me is this strange void band. I have the same problem with my netCDF file using both your solution and mine. Even worstm in my case band is about 10 degree width!! And source data seems to be correct (at least when displayed using a netCDFviewer). Any idea about which could be the problem? – modestprog Oct 2 '17 at 14:46
  • you probably saved our research work, @AndreJ ! It's almost OK. Even Copernicus staff was unable to provide us a solution so straightforward. – modestprog Oct 4 '17 at 8:56

Well, we finally made it using CDO, as suggested by Copernicus support, because we weren't able to solve the problems detected using GDAL. For Windows it requires installing Cygwin first. Hoping It can help other people, we did a PDF with the steps that worked for us, and an example grid description file used with CDO. This can be found on Copernicus users forum: http://forum.marine.copernicus.eu/discussion/506/raster-conversion-from-orca025-netcdf-to-esri-ascii#Item_1 .

Essentially it requires:

  • Installing Cygwin for Windows with the packages: netcd , udunits , libproj,gcc-core , gcc-g++
  • Go to CDO website https://code.mpimet.mpg.de/projects/cdo and download last version labeled as cygwin64.
  • Add cdo.exe to cygwin \bin folder.
  • use this command in cywin terminal:

cdo remapnn,grid.txt input_file.nc output_file.nc

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.