[gdal-dev] Question on converting netCDF to GTiff

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Wed Oct 23 10:41:45 PDT 2019


Hi,

I have a netCDF grid of Float32 values that I want to convert to GTiff 
with Int16 values. The min/max values will support this without scaling, 
but I'm not sure what will happen to the NODATA value = 
9.96920996838686905e+36.

Ideally, I would like to set it to something like 32000 but not sure how 
to do that.

I've gotten as far as:

gdal_translate -of GTiff -co TILED=YES -ot Int16 -a_srs EPSG:4326
GEBCO_2019.nc  gebco_2019.tif

Which runs and looks ok except NODATA is set the same and that value 
clearly will not fit in an Int16. Now it is possible that the grid 
doesn't actually have any nodata cells set and only has the value 
defined but I'm not sure how to check if that is the case.

Any thoughts appreciated.

Thanks,
   -Steve W


$ gdalinfo GEBCO_2019.nc -stats
Driver: netCDF/Network Common Data Format
Files: GEBCO_2019.nc
Size is 86400, 43200
Coordinate System is `'
Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (0.004166666666667,-0.004166666666667)
Metadata:
   elevation#long_name=Elevation relative to sea level
   elevation#sdn_parameter_name=Sea floor height (above mean sea level) 
{bathymetric height}
   elevation#sdn_parameter_urn=SDN:P01::ALATZZ01
   elevation#sdn_uom_name=Metres
   elevation#sdn_uom_urn=SDN:P06::ULAA
   elevation#standard_name=height_above_reference_ellipsoid
   elevation#units=m
   lat#axis=Y
   lat#long_name=latitude
   lat#sdn_parameter_name=Latitude north
   lat#sdn_parameter_urn=SDN:P01::ALATZZ01
   lat#sdn_uom_name=Degrees north
   lat#sdn_uom_urn=SDN:P06::DEGN
   lat#standard_name=latitude
   lat#units=degrees_north
   lon#axis=X
   lon#long_name=longitude
   lon#sdn_parameter_name=Longitude east
   lon#sdn_parameter_urn=SDN:P01::ALONZZ01
   lon#sdn_uom_name=Degrees east
   lon#sdn_uom_urn=SDN:P06::DEGE
   lon#standard_name=longitude
   lon#units=degrees_east
   NC_GLOBAL#comment=The data in the GEBCO_2019 Grid should not be used 
for navigation or any purpose relating to safety at sea.
   NC_GLOBAL#Conventions=CF-1.6
   NC_GLOBAL#history=Information on the development of the data set and 
the source data sets included in the grid can be found in the data set 
documentation available from https://www.gebco.net
   NC_GLOBAL#institution=On behalf of the General Bathymetric Chart of 
the Oceans (GEBCO), the data are held at the British Oceanographic Data 
Centre (BODC).
   NC_GLOBAL#node_offset=1
   NC_GLOBAL#references=DOI: 10.5285/836f016a-33be-6ddc-e053-6c86abc0788e
   NC_GLOBAL#source=The GEBCO_2019 Grid is the latest global bathymetric 
product released by the General Bathymetric Chart of the Oceans (GEBCO) 
and has been developed through the Nippon Foundation-GEBCO Seabed 2030 
Project. This is a collaborative project between the Nippon Foundation 
of Japan and GEBCO. The Seabed 2030 Project aims to bring together all 
available bathymetric data to produce the definitive map of the world 
ocean floor and make it available to all.
   NC_GLOBAL#title=The GEBCO_2019 Grid - a continuous terrain model for 
oceans and land at 15 arc-second intervals
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000)
Lower Left  (-180.0000000, -90.0000000)
Upper Right ( 180.0000000,  90.0000000)
Lower Right ( 180.0000000, -90.0000000)
Center      (   0.0000000,   0.0000000)
Band 1 Block=86400x1 Type=Float32, ColorInterp=Undefined
   Minimum=-10880.588, Maximum=8613.156, Mean=-1895.032, StdDev=2656.923
   NoData Value=9.96920996838686905e+36
   Unit Type: m
   Metadata:
     long_name=Elevation relative to sea level
     NETCDF_VARNAME=elevation
     sdn_parameter_name=Sea floor height (above mean sea level) 
{bathymetric height}
     sdn_parameter_urn=SDN:P01::ALATZZ01
     sdn_uom_name=Metres
     sdn_uom_urn=SDN:P06::ULAA
     standard_name=height_above_reference_ellipsoid
     STATISTICS_MAXIMUM=8613.15625
     STATISTICS_MEAN=-1895.0320141561
     STATISTICS_MINIMUM=-10880.587890625
     STATISTICS_STDDEV=2656.9226774517
     units=m


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the gdal-dev mailing list