<div dir="ltr">I have two integer rasters, A and B, with the same dimensions and cell sizes. I want to compare each cell in A with each cell in B and keep the maximum value. In cases where both have nodata, I want the result to be nodata. In cases where one is nodata, I want the result to be the integer value of the one with data.<br><br>   Raster A                    Raster B<br>|   1     |   1     |             |   3     |   1     |<br>|   1     |nodata|             |nodata|   3     |<br>|nodata|   1     |             |nodata|nodata|<br>|nodata|   4     |             |nodata|   1     |<br><br>--------------------------------------------<br>                Desired result<br>               |   3     |   1     |<br>               |   1     |   3     |<br>               |nodata|   1     |<br>               |nodata|   4     |<br><br>'ve tried combining them in many different ways using gdal_calc but somehow I can't seem to get the answer I'm looking for. My first instinct was to use numpy.fmax since the documentation states that the NaN value is ignored. But this calculation<div><br>--calc "numpy.fmax(A,B)"</div><div><br></div>only gives me the results I want in cells where both datasets have a value. A nodata in either results in nodata in the result:<br><br>              numpy.fmax result<br>               |   3     |   1     |<br>               |nodata|nodata|<br>               |nodata|nodata|<br>               |nodata|   4     |<br><br>Perhaps I'm confused about how nodata translates to NaN in numpy? What is a straightforward way to accomplish this with gdal_calc?<div><br></div><div>Thanks for any help,</div><div>Spencer</div></div>