Issue: I'm trying to extract a NetCDF layer to GeoTIFF. The output GeoTIFF image has the South up.

What I need: The output GeoTIFF image with North up.

GDAL version: 3.2.2, released 2021/03/05; OS: Windows 10

The test NetCDF file (~42 mb) is available from DropBox:


gdal_translate -of GTiff -ot float32 -a_nodata none -strict -q -unscale -co TFW=yes -a_srs EPSG:4326 NETCDF:test.nc:chlor_a_diff test.tif

The output GeoTIFF image has the South up: enter image description here

So far, I have tried:

  1. creation option: -co GDAL_NETCDF_BOTTOMUP=NO. This creation option is not recognized
  2. Used NumPy (np.rot90, with k=2): it did not help.

I might be missing something more fundamental.

How to get the image with North up?

  • Looks like they has the same problem (dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/…) see the metadata, they used the ArcGIS FLip tool – If you do not know- just GIS May 19 at 1:16
  • Thanks for adding to the discussion. I have used an alternative approach as stated in my comments below simply using Python and it worked with the same efficiency as it would with direct GDAL use. Trying to stick to open source resources as I am not conversant with ArcGIS but I am sure it must be efficient too. – PDash May 20 at 7:10

Try this:

gdal_translate -a_ullr -180 90 180 -90 NETCDF:test.nc:chlor_a_diff test.tif

Original file:

=> (0.0, 1.0, 0.0, 0.0, 0.0, 1.0)

gdal_translate -a_ullr -180 90 180 -90 NETCDF:test.nc:chlor_a_diff test.tif
=> (-180.0, 0.020830922346950585, 0.0, 90.0, 0.0, -0.020884093282283328)

The TIFF has the correct sign for the dY and starts from +90 latitude. It also has reasonable pixel spacings. But it looks flipped left to right when zoomed out. When zoomed in, it looks OK. In tha maps below, it is displayed above the OSM basemap, which looks encouraging.

Zoomed In

enter image description here

UK Area

enter image description here

It looks quite chloroful.

Zoomed Out

Is this flipped from left to right?

  • Thank you, but I still have the same issue - the South up if I simply view the output TIF in a desktop image viewer. (I cannot attach an image in this comment). Please note that the georeferencing is not wrong in the original post; only that the map starts displaying -90 on top and the North-South increment is positive. About the mismatch between OSM and your map, it is likely because of EPSG 3857 (OSM) and this map (EPSG 4326). So, that is expected. Are you using QGIS to show the map? If yes, QGIS somehow orients it as desired. – PDash Apr 16 at 16:40
  • GeoTiff images are generally stored top-down. QGIS orients it with its embedded GeoTransform. By flipping the transform, it displays correctly in QGIS as mentioned earlier. That won't change its appearance in an image viewer if the viewer ignores the transform of course, or if both the raster and the transform are flipped. If you just want to flip the raster data, np.flipud() might help. Are you trying to display this in an image viewer or a GIS? – wingnut Apr 17 at 3:02
  • I figured it out but had to use an alt approach. The issue is due to 2 things: (a) the way the NetCDF file is written even if it is CF1.6 compliant (b) gdal_translate's precision check for lat/lon. This particular file was detected to have non-uniform lat increment by 'gdal_translate' and some built-in mechanism kicks in. SOLUTION: I just read the NetCDF in Python, extract lat, lon, data, perform necessary steps & write to GeoTIFF using osgeo/gdal (from osgeo import gdal)- not the command line gdal. Some info on GeoTIFF generation with this approach is here drr.ikcest.org/tutorial/k8024 – PDash Apr 18 at 6:49
  • That should work. I take it you flipped the raster. Does it display correctly in a GIS? – wingnut Apr 18 at 6:57
  • 1
    That's what the -a_ullr does :-) – wingnut Apr 21 at 9:02

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.