<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font face="Verdana">Hi GDAL team,<br>
<br>
I'm working with the GDAL Python API. I have some HFA (.img) files
that are float32 and that use nan as their NoData value. As far as
I can tell, using nan is allowed but I could be wrong. When I open
them, I get "Warning 1: NaN converted to INT_MAX." Everything
seems to work fine after that. Is this message something I need to
worry about? If not, may I suggest you remove it from the HFA
driver if possible?<br>
<br>
Here's some code demonstrating the message. If need be, I can
provide an example file, or write some code to generate one.<br>
<br>
>>> import numpy as np<br>
>>> from osgeo import gdal<br>
>>> gdal.__version__ # this version is packaged
with ArcGIS Pro 3.4, but I don't think the version matters<br>
'3.9.2e'<br>
>>> ds =
gdal.Open(r'\\conch\denmod\Covariates\NARW25\CMEMS_GLORYS\SST\1999\SST_199901.img',
gdal.GA_ReadOnly)<br>
Warning 1: NaN converted to INT_MAX.<br>
>>> band = ds.GetRasterBand(1)<br>
</font><font face="Verdana">>>>
gdal.GetDataTypeName(band.DataType)<br>
'Float32'<br>
</font><font face="Verdana">>>> band.GetNoDataValue()<br>
nan<br>
>>> arr = band.ReadAsArray() # the data look ok:<br>
>>> np.isnan(arr).sum()<br>
86788<br>
>>> (~np.isnan(arr)).sum()<br>
142985<br>
</font><font face="Verdana">>>> np.max(arr)<br>
nan<br>
</font><font face="Verdana">>>> np.nanmax(arr)<br>
27.078554<br>
<br>
As far as I can tell, the warning comes from this code in
gdal/frmts/hfa/hfafield.cpp:<br>
<br>
else if (std::isnan(dfDoubleRet))<br>
{<br>
CPLError(CE_Warning, CPLE_AppDefined,<br>
"NaN converted to INT_MAX.");<br>
nIntRet = nMax;<br>
}<br>
<br>
But I don't know if there are any negative ramifications that will
result.<br>
<br>
Thank you for your help. And, as always, thank you very much for
developing and maintaining GDAL.<br>
<br>
Jason<br>
<br>
</font>
</body>
</html>