1

I'm trying to convert this file to EPSG:3857 with this command:

gdalwarp -t_srs EPSG:3857 S2A_rhow_l2r.nc test-proc.nc

Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Warning 1: Several drivers matching nc extension. Using NETCDF
ERROR 1: Input file S2A_rhow_l2r.nc has no raster bands.

I have no idea how to solve this problem.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
grod
  • 11
  • 2
  • Did you have a look at : https://gis.stackexchange.com/questions/242270/gdalwarp-netcdf-input-file-has-no-raster-bands – Chelmy88 Aug 21 '19 at 18:57
  • 1
    If file does not contain rasters then maybe it contains vectors https://gdal.org/drivers/vector/netcdf.html. Use ogrinfo and check. – user30184 Aug 21 '19 at 19:03
  • I reckon you need to set the source projection with -s_srs, and the subdataset thing – mdsumner Feb 18 '22 at 05:07

1 Answers1

1

The file does indeed contain raster subdatasets and GDAL can see them but there may so something special in the coordinates of that NetCDF file. Gdalinfo with GDAL 2.4 reports this

gdalinfo NETCDF:"S2A_turbidez.nc":rhow_865
Warning 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".
Warning 1: dimension #1 (x) is not a Longitude/X dimension.
Warning 1: dimension #0 (y) is not a Latitude/Y dimension.
Driver: netCDF/Network Common Data Format
Files: S2A_turbidez.nc
Size is 4584, 2976
Coordinate System is `'
Origin = (0.000000000000000,0.000000000000000)
Pixel Size = (0.000000000000000,0.000000000000000)

Gdalinfo with GDAL 3.0.1dev reports this (notice that the syntax has been changed)

gdalinfo NETCDF:"S2A_turbidez.nc":rhow_865
Warning 1: NetCDF driver detected file type=5, but libnetcdf detected type=3
Warning 1: dimension #1 (x) is not a Longitude/X dimension.
Warning 1: dimension #0 (y) is not a Latitude/Y dimension.
ERROR 1: netcdf error #-57 : NetCDF: Start+count exceeds dimension bound .
at (e:\sdk\vc15x64\gdal\gdal\frmts\netcdf\netcdfdataset.cpp,netCDFDataset::SetProjectionFromVar,3260)

Driver: netCDF/Network Common Data Format
Files: S2A_turbidez.nc
Size is 4584, 2976
Origin = (0.000000000000000,0.000000000000000)
Pixel Size = (0.000000000000000,0.000000000000000)

It is not a surprise that gdalwarp fails as well, here tried with 3.0.1dev.

gdalwarp -t_srs EPSG:3857 NETCDF:S2A_turbidez.nc://rhow_865 test-proc.nc
Warning 1: NetCDF driver detected file type=5, but libnetcdf detected type=3
Warning 1: dimension #1 (x) is not a Longitude/X dimension.
Warning 1: dimension #0 (y) is not a Latitude/Y dimension.
ERROR 1: netcdf error #-57 : NetCDF: Start+count exceeds dimension bound .
at (e:\sdk\vc15x64\gdal\gdal\frmts\netcdf\netcdfdataset.cpp,netCDFDataset::SetProjectionFromVar,3260)

Warning 1: Several drivers matching nc extension. Using NETCDF
ERROR 1: Cannot invert geotransform

The error seems to come from the NetCDF library. Reference: https://octave.sourceforge.io/netcdf/function/netcdf_getVar.html

Same error message appears in https://stackoverflow.com/questions/47085101/netcdf-startcount-exceeds-dimension-bound but I can't say if error is in the NetCDF file or in GDAL. I suggest to write mail to the gdal-dev mailing list.

user30184
  • 65,331
  • 4
  • 65
  • 118