0

I am new to QGIS and I am having a problem importing my NetCDF raster layers correctly. In the image below, the colored image is my OpenStreetMap basemap (EPSG:3857) and the black and white raster is my NetCDF data.

enter image description here

As you can see, I've got a couple problems. One is that the NetCDF raster is not in the right spot, the other is that it's "smooshed" at the top and bottom relative to the OpenStreetMap map, meaning the features won't align properly even if I could get the raster into the right spot (which I can't figure out how to do).

Here is the structure of the netcdf data:

netcdf rsl_26_2040_out {

dimensions:

    x = 360 ;
    y = 180 ;

variables:

    float x(x) ;
    float slr_he(y, x) ;
    float slr_le(y, x) ;
    float slr_md(y, x) ;
    float y(y) ;

I have tried several ways to add the correct projection information to the netcdf data before importing them, including gdaltranslate, which gives me an error:

$$: gdal_translate -a_srs 'EPSG:3857' -of netCDF rsl_26_2040.nc rsl_26_2040_out.nc

Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute Input file contains subdatasets. Please, select one of them for reading.

Which looks like a syntax error but I can not figure out how to fix it. I also tried the suggestion posted here (Displaying netCDF data with correct CRS?) but there is no effect.

I have also tried simply setting the NetCDF raster layer CRS to EPSG:3857, but this just puts it at the equator and makes it very, very, very, very small.

  • What makes you think that your NetCDF file's CRS is EPSG:3857? Does it come with a CRS definition? If so, what is its actual CRS? If not, what does the auxiliary metadata or description say at the place where you got the file? – bugmenot123 Nov 03 '21 at 14:40
  • What's in the x,y variables? Meters or lon/lat coordinates? The structure you posted doesn't show any attributes. Without attributes, netcdf tries to assume that vars named the same as dimensions hold the coordinate values. The answer on https://gis.stackexchange.com/a/377498/10229 has hints on how to add a CRS attributes to a NetCDF file using the NetCDF Operators. // Also, the gdal_translate netcdf format is pretty basic and can't tell whether you are interested in using your slr_he, slr_le or slr_md var in your output file: https://gdal.org/drivers/raster/netcdf.html – Dave X Nov 04 '21 at 15:16

0 Answers0