GDAL – How to Reproject a NetCDF File?

gdalgdalwarpgoes-16

I have a .nc file that you can download here. This is satellite imagery.

I want to re-project this and save it to a new .nc file, without saving to raster. Just NetCDF to NetCDF only. Is this possible?

I am getting an error saying "ERROR 4: `test.nc' not recognized as a supported file format."

The code I have tried is :

gdalwarp -t_srs EPSG:3857 test.nc test-projected.nc

I am not a professional with this, but should I even be using gdalwarp to do this? (maybe gdaltransform?) I only want to change the projection – nothing else at this time.

Best Answer

gdalinfo on your data returned below:

Warning 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".
Driver: netCDF/Network Common Data Format
Files: C:\Users\userr\Downloads\OR_ABI-L1b-RadC-M3C01_G16_s20190321802143_e20190321804516_c20190321804558.nc
Size is 5000, 3000
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["unknown",
        DATUM["unknown",
            SPHEROID["Spheroid",6378137,298.2572221]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Geostationary_Satellite"],
    PARAMETER["central_meridian",-75],
    PARAMETER["satellite_height",35786023],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    EXTENSION["PROJ4","+proj=geos +lon_0=-75 +h=35786023 +x_0=0 +y_0=0 +ellps=GRS80 +units=m +no_defs  +sweep=x"]]
Origin = (-3627271.328111211769283,1583173.512170388596132)
Pixel Size = (1002.008657743770527,1002.008657743770527)

Geostationary_Satellite... I honestly don't know anything about this projection... So I tried gdalwarp giving proj4 string explicitly to your nc (Rad layer) as below:

gdalwarp -of netCDF 
-s_srs "+proj=geos +lon_0=-75 +h=35786023 +x_0=0 +y_0=0
+ellps=GRS80 +units=m +no_defs +sweep=x" 
-t_srs EPSG:3857  -tr 1002.008657743770527 1002.008657743770527 
NETCDF:"OR_ABI-L1b-RadC-M3C01_G16_s20190321802143_e20190321804516_c20190321804558.nc":Rad 
"OR_ABI-L1b-RadC-M3C01_G16_s20190321802143_e20190321804516_c20190321804558_3857.nc"

[Below] Both images are underlain by Bing image (in QGIS...Left image is displayed on On-the-fly projection).

enter image description here


[Update]

  1. Following this post we started working on a new scope to create True color image from three GOES-16 images (Band1, 2, and 3).
  2. Initial idea was to reproject the provided NetCDF files along with all variables (Rad for radiance and DQF as QC value). Then with three reprojected bands David's software should be able to convert them into color enhanced Jpeg image... Using GDAL tool I could reproject one variable (Rad) but not two variables together.
  3. Instead, I extracted Rad variable from each band and created RGB composite by SAGA. There was a nice article Bah et al. (2018) how to create "Green" band by mixing red, blue and NIR bands. Following this paper I mixed 45% of Band2 (red), 45% of Band1 (blue) and 10% of Band3 (Nir) by raster calculator. Output composite image is as below:

enter image description here

Related Question