[GRASS-user] Exporting Grass raster to netCDF via r.out.gdal gives '0' z-values

Hi guys, I am having trouble exporting any Grass raster to netCDF format and preserving the z-values.

Ex:

~> r.info GEBCO2014_Atlantic_Canada_100m -g | grep datatype

datatype=DCELL

~> g.region -p

projection: 99 (unnamed)

zone: 0

datum: wgs84

ellipsoid: wgs84

north: 838800

south: -313000

west: -4400

east: 1225500

nsres: 100

ewres: 100

rows: 11518

cols: 12299

cells: 141659882

~> r.out.gdal in=GEBCO2014_Atlantic_Canada_100m format=netCDF out=GEBCO2014_Grand_Banks_100m.nc type=Float64 --v --o

Exporting to GDAL data type: Float64

Checking GDAL data type and nodata value…

100%

Using GDAL data type

Exporting raster data to netCDF format…

100%

r.out.gdal complete. File <GEBCO2014_Grand_Banks_100m.nc> created.

Now, checking the output .nc file with GMT’s grdinfo:

~> grdinfo GEBCO2014_Grand_Banks_100m.nc

GEBCO2014_Grand_Banks_100m.nc: Title: GDAL Band Number 1

GEBCO2014_Grand_Banks_100m.nc: Command: Wed Dec 04 15:25:18 2019: GDAL Create( GEBCO2014_Grand_Banks.nc, … )

GEBCO2014_Grand_Banks_100m.nc: Remark:

GEBCO2014_Grand_Banks_100m.nc: Pixel node registration used [Cartesian grid]

GEBCO2014_Grand_Banks_100m.nc: Grid file format: nd = GMT netCDF format (64-bit float), CF-1.7

GEBCO2014_Grand_Banks_100m.nc: x_min: -4400 x_max: 1225500 x_inc: 100 name: n_columns: 12299

GEBCO2014_Grand_Banks_100m.nc: y_min: -313000 y_max: 838800 y_inc: 100 name: n_rows: 11518

GEBCO2014_Grand_Banks_100m.nc: z_min: 0 z_max: 0 name: GDAL Band Number 1

GEBCO2014_Grand_Banks_100m.nc: scale_factor: 1 add_offset: 0

GEBCO2014_Grand_Banks_100m.nc: format: classic

Zeros for the z-range. gdalinfo also fails to reveal any z-range info. I’m not sure what I’m doing wrong here.

System Info:

GRASS version: 7.8.1 (installed from UbuntuGIS-unstable PPA)

Code revision: exported

Build date: 2019-12-03

Build platform: x86_64-pc-linux-gnu

GDAL: 3.0.2

PROJ: 6.2.1

GEOS: 3.8.0

SQLite: 3.22.0

Python: 3.6.9

wxPython: 4.0.1

Platform: Linux-5.3.0-24-generic-x86_64-with-LinuxMint-19.2-tina

Any pointers most appreciated!

~ Eric.

···

Eric Patton

GPG ID: rsa4096/0xB72AE021

Fingerprint: 1B0F 7AFD 9B5B 0E59 DCBC 36B4 24CC 056B B72A E021