<div dir="ltr">I'm trying to accomplish a seemingly simple task: starting from an HDF file, convert it to GTiff, and divide all values in the raster by 10. The original file uses -1 for nodata, and I want to preserve this value all the way down to the final tiff.<div>In other words, where the original file had -1, the final file should also have -1, and where the original file had a value, the final file should have that value / 10.</div><div><br></div><div>Here are the steps I'm following:</div><div><br></div><div>$ gdal_translate -of GTiff -a_nodata -1 "HDF5:/tmp/myfile.hdf://MYDS /tmp/1.tiff<br>Input file size is 3712, 3712<br>0...10...20...30...40...50...60...70...80...90...100 - done.<br>$ gdal_calc.py -A /tmp/1.tiff --A_band=1 --overwrite --quiet --type=Float32 --NoDataValue -1 --outfile=/tmp/2.tiff --format=GTiff --calc="numpy.around(A/10, 2)"<br><br></div><div>This works, but 2.tiff has NaNs instead of -1's.</div><div><br></div><div>If I do not use the -a_nodata -1 in the first command (not sure it's needed...should it detect it automatically from the file's metadata?), then gdal_calc.py will happily divide the -1's and put -0.1's in the final file, which is not what I want.</div><div><br></div><div>I'm probably missing something very basic here, as I'm not a regular use of these tools and I'm putting together bits and pieces from the documentation and random examples by myself.</div><div><br></div><div>$ gdal_translate --version<br>GDAL 3.6.2, released 2023/01/02<br>$ dpkg -l | grep gdal-bin<br>ii  gdal-bin                    3.6.2+dfsg-1build1                amd64        Geospatial Data Abstraction Library - Utility programs<br></div><div><br></div><div>Thanks for any help.</div></div>