[gdal-dev] Scale / offset query

Tobias Reinicke ramotswa at gmail.com
Thu Oct 25 11:22:39 PDT 2018


Thanks Even,
So doing that command, and then looking at;
"gdalinfo -hist out.vrt" gives me a list of wrong looking buckets;

Band 1 Block=128x128 Type=Int16, ColorInterp=Undefined
0...10...20...30...40...50...60...70...80...90...100 - done.
  256 buckets from 0 to 0:
  6483600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

(and the resulting tif from the gdal_warp of that also doesn't display
properly in qgis).

For info, the original netcdf gdalinfo is;

Driver: netCDF/Network Common Data Format
Files: MACC-IFS_forecasts_of_total_column_CO_2018-08-05.nc
       MACC-IFS_forecasts_of_total_column_CO_2018-08-05.nc.aux.xml
Size is 3600, 1801
Coordinate System is `'
Origin = (-0.049999999152054,90.049999999999997)
Pixel Size = (0.099999998304108,-0.100000000000000)
Metadata:
  latitude#long_name=latitude
  latitude#units=degrees_north
  longitude#long_name=longitude
  longitude#units=degrees_east
  NC_GLOBAL#Conventions=CF-1.6
  NC_GLOBAL#history=2018-10-16 12:30:21 GMT by grib_to_netcdf-2.8.0:
grib_to_netcdf
/data/data01/scratch/64/10/_mars-atls14-a82bacafb5c306db76464bc7e824bb75-stvecY.grib
-o
/data/data03/scratch/20/51/_grib2netcdf-atls13-98f536083ae965b31b0d04811be6f4c6-1XurHN.nc
-utime
  NETCDF_DIM_EXTRA={time}
  NETCDF_DIM_time_DEF={1,4}
  NETCDF_DIM_time_VALUES=1039560
  tcco#add_offset=0.005068144666631755
  tcco#long_name=Total column Carbon monoxide
  tcco#missing_value=-32767
  tcco#scale_factor=1.473959627507736e-07
  tcco#units=kg m**-2
  tcco#_FillValue=-32767
  time#calendar=gregorian
  time#long_name=time
  time#units=hours since 1900-01-01 00:00:0.0
Corner Coordinates:
Upper Left  (  -0.0500000,  90.0500000)
Lower Left  (  -0.0500000, -90.0500000)
Upper Right (     359.950,      90.050)
Lower Right (     359.950,     -90.050)
Center      ( 179.9499969,  -0.0000000)
Band 1 Block=3600x1 Type=Int16, ColorInterp=Undefined
  Min=-32766.000 Max=32767.000
  Minimum=-32766.000, Maximum=32767.000, Mean=-29973.406, StdDev=1279.310
  NoData Value=-32767
  Unit Type: kg m**-2
  Offset: 0.00506814466663176,   Scale:1.47395962750774e-07
  Metadata:
    add_offset=0.005068144666631755
    long_name=Total column Carbon monoxide
    missing_value=-32767
    NETCDF_DIM_time=1039560
    NETCDF_VARNAME=tcco
    scale_factor=1.473959627507736e-07
    STATISTICS_MAXIMUM=32767
    STATISTICS_MEAN=-29973.406142881
    STATISTICS_MINIMUM=-32766
    STATISTICS_STDDEV=1279.3102503388
    units=kg m**-2
    _FillValue=-32767

On Thu, 25 Oct 2018 at 19:11, Even Rouault <even.rouault at spatialys.com>
wrote:

> Tobias,
>
> >
> > Is there a way to pass the scale / offset information from the original
> NC
> > file to the output of gdal_warp?
>
> You can 'unscale' priorly with "gdal_translate -unscale in.nc out.vrt -of
> VRT"
> and gdalwarp the VRT.
>
> Even
>
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181025/b4cf6867/attachment-0001.html>


More information about the gdal-dev mailing list