Opened 7 years ago

Closed 7 years ago

#5482 closed defect (fixed)

BAG uncertainty NoData value should be 1000000, not 0

Reported by: jdvarner Owned by: warmerdam
Priority: normal Milestone: 1.11.1
Component: GDAL_Raster Version: 1.11.0
Severity: normal Keywords: BAG
Cc: Kurt Schwehr


The NODATA value for the uncertainty in BAG files is being reported as 0. However, I think it should be set to 1000000.

There's some inconsistency in the documentation: From OpenNavSurf? (, page 11): "The *unknown* state for uncertainty is defined to be 0.0"

From IHO S-102 Format Standard (, page 34): "The *undetermined* state for uncertainty is defined to be 1,000,000.0 (1.0e6)."

I've checked a sampling of BAGs that we archive here at NOAA/NGDC. All of them have 1000000 in the uncertainty band in areas with no data.

Thanks to Mike Wilburn from Esri for pointing out this issue.

Change History (7)

comment:1 Changed 7 years ago by Even Rouault

Are you confident that there are no products in the wild that follow the opennavsurf spec ?

comment:2 Changed 7 years ago by jdvarner

I'm not aware of any BAGs that use 0 as the uncertainty NODATA value. At NGDC we're confident that the U.S. NOAA/NOS BAGs (the vast majority of all BAGs out there) use 1000000. I also found a BAG from Scotland that uses 1000000:

comment:3 Changed 7 years ago by jdvarner

These are some constants defined in the BAG API provided by OpenNavSurf? (bag.h). All NULL values should be 1e6, but there can also be a different "Unknown" value of 0.

/* Definitions for NULL values */ #define NULL_ELEVATION 1e6 #define NULL_UNCERTAINTY 1e6 #define NULL_STD_DEV 1e6 #define NULL_GENERIC 1e6


  • Unknown Uncertainty :
  • If there is not enough information present to perform a
  • computation of a node's uncertainty, then this value will
  • be used to distinguish it from NULL. */


comment:4 Changed 7 years ago by Even Rouault

Cc: Kurt Schwehr added

trunk r27383 "BAG: change nodata value for uncertainty band to 1e6 (#5482)"

Kurt, I've CC'ed you since I see you've interest in ocean related drivers. I'm wondering if there are datasets where 0 are found in the uncertainty band, and if so, if we should "patch" those zeros to one millions, so they are considered as nodata as well.

comment:5 Changed 7 years ago by Kurt Schwehr

I'm not sure. My reading would be that Unknown == nodata. I will ping the BAG working group.

comment:6 Changed 7 years ago by Even Rouault

Re: Nodata vrs unknown for uncertainty?
De : Brian Calder <>
UNK_UNCERTAINTY is not used anywhere else in the library, and in my opinion should be removed; an uncertainty of zero is technically possible (although extraordinarily unlikely), and therefore this is not a good constant to use for a special purpose.  The original intent was that NULL_UNCERTAINTY should be the ‘no data’ value, and there was no distinction between NULL and unknown, and therefore no need for a second constant.

The documentation doesn’t reflect that, but should be changed to make sure that it does.  We can do this before the final release of 1.5.2.

The only way, I believe, that you would have anything other than NULL_UNCERTAINTY in the wild is if someone attempted to write a BAG file without using the library from  That’s pretty unlikely, and is almost certainly not the case for any ‘official’ BAG generated by hydrographic agencies (which are overwhelmingly the most likely sources).  I don’t think it’s a major problem.

Unless there’s contrary opinion, I’ll remove the UNK_UNCERTAINTY definition and update the documentation before 1.5.2.


comment:7 Changed 7 years ago by Even Rouault

Milestone: 1.11.1
Resolution: fixed
Status: newclosed

trunk r27393 "BAG: remove FIXME; and do not expose wrong values of minimum and maximum of uncertainty band (#5482)"

branches/1.11 r27394 "BAG: change nodata value for uncertainty band to 1e6; and do not expose wrong values of minimum and maximum of uncertainty band (#5482)"

Note: See TracTickets for help on using tickets.