Raster Export as GeoTIFF, floating point vs integer

Use this Forum to find information on, or ask a question about, NASA Earth Science data.
Post Reply
galzk001
Posts: 2
Joined: Thu Jul 09, 2015 11:39 am America/New_York
Answers: 0

Raster Export as GeoTIFF, floating point vs integer

by galzk001 » Tue Jan 24, 2017 11:27 am America/New_York

I've been using SeaDAS to acquire Modis Aqua level 3 mapped monthly composites for Chl-A and FLH data.  I open the .nc files in SeaDAS and use File>Export>GeoTIFF to export as a GeoTIFF to be used in ESRI's ArcMAP.  I've been doing this for years without problems and the export utility still exports Chl-A files as floating point rasters, preserving pixel values correctly.  For some reason (starting fall of 2016) the exported FLH data are converted to integer rasters and all relevant pixel values are lost.  I just did the export one after the other and Chl-A was correctly opened in ArcMAP as a floating point raster and FLH was written as an unsigned integer raster and pixel data is incorrect.

Can anyone help with this strange data export convention?  There are no advanced options to specify floating point or integer, and it's confusing why Chl-A works correctly and FLH does not.  If there is a work around to get a usable floating point raster in an ESRI friendly format, that would help me as well.

Thanks!

Tags:

gnwiii
Posts: 713
Joined: Fri Jan 29, 2021 5:51 pm America/New_York
Answers: 2
Has thanked: 1 time

Raster Export as GeoTIFF, floating point vs integer

by gnwiii » Wed Jan 25, 2017 8:37 am America/New_York

You don't provide enough detail for someone to reproduce exactly what you have done, but I can tell you that GeoTIFF doesn't support scale and offset transformations.  A good guess is to try the values from the NetCDF files.  One way to check this guess is to use the Statistics tool (with "accuracy" set to the highest value) in the SeaDAS GUI:

# Region Band  average  maximum  median  minimum  p90_threshold  p95_threshold  sigma  total
                   nflh  0.0726  2.8999  0.0511  -0.0000  0.1494  0.2059  0.0760  4323258


Look in the netcdf header for the scale and offset:
ncdump -h A20162452016274.L3m_MO_FLH_nflh_9km.nc
netcdf A20162452016274.L3m_MO_FLH_nflh_9km {
dimensions:
        lat = 2160 ;
        lon = 4320 ;
        rgb = 3 ;
        eightbitcolor = 256 ;
variables:
        short nflh(lat, lon) ;
                nflh:long_name = "Normalized Fluorescence Line Height" ;
                nflh:scale_factor = 8.5e-05f ;
                nflh:add_offset = 2.25f ;
                nflh:units = "W m^-2 um^-1 sr^-1" ;
                nflh:_FillValue = -32767s ;
                nflh:valid_min = -32353s ;
                nflh:valid_max = 32353s ;
                [...]

Using R to load and scale the GeoTIFF raster:

> library(rasterVis)
Loading required package: raster
Loading required package: sp
Loading required package: lattice
Loading required package: latticeExtra
Loading required package: RColorBrewer


> r = raster("A20162452016274.L3m_MO_FLH_nflh_9km.tif")
> r


class       : RasterLayer
dimensions  : 2160, 4320, 9331200  (nrow, ncol, ncell)
resolution  : 0.08333333, 0.08333333  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
data source : /home/seadas/Documents/Testing/SeaDAS/7.3/A20162452016274.L3m_MO_FLH_nflh_9km.tif
names       : A20162452016274.L3m_MO_FLH_nflh_9km
values      : -32768, 32767  (min, max)

> r[r==-32768] = NA
> rs = r*8.5e-05 + 2.25
> summary(r)


        A20162452016274.L3m_MO_FLH_nflh_9km
Min.                                 -26471
1st Qu.                              -26104
Median                               -25869
3rd Qu.                              -25469
Max.                                   7646
NA's                                5007942

> summary(rs)


        A20162452016274.L3m_MO_FLH_nflh_9km
Min.                          -3.500000e-05
1st Qu.                        3.116000e-02
Median                         5.113500e-02
3rd Qu.                        8.513500e-02
Max.                           2.899910e+00
NA's                           5.007942e+06


The Min., Max., and Median values are close to the values obtained using the SeaDAS GUI.

OB.DAAC - SeanBailey
User Services
User Services
Posts: 1464
Joined: Wed Sep 18, 2019 6:15 pm America/New_York
Answers: 1
Been thanked: 5 times

Raster Export as GeoTIFF, floating point vs integer

by OB.DAAC - SeanBailey » Thu Jan 26, 2017 7:54 am America/New_York

Last year we installed l3mapgen in our production stream in place of the older smigen.
The l3mapgen program outputs the maps using the same product definition file as
the l2gen program.  The nflh product is stored as a scaled integer at L2 and now at L3m
as well.

The GeoTIFF exporter also follows this same logic, so it outputs nflh as a scaled integer.
If you wish to have it export as a floating point value, you can use the Math Band feature
to "copy" the product to a new band (uncheck the 'Virtual' band checkbox to create a 'Real' band)
Then export as a GeoTIFF, but select band subset to only export the copied band.  It will be
exported as a floating point value.

Sean

galzk001
Posts: 2
Joined: Thu Jul 09, 2015 11:39 am America/New_York
Answers: 0

Raster Export as GeoTIFF, floating point vs integer

by galzk001 » Thu Jan 26, 2017 1:04 pm America/New_York

The Math Band feature worked; it allowed me to preserve the data in floating point format.  Thank you so much for the help!

Post Reply