I'm using r.patch (within QGIS, GRASS 7) to patch two Float32 rasters both of which have a respective filesize of under 200MB.

When I save the memory layer raster created by the r.patch function, the new GTIFF is float64 and has a filesize in excess of 7GB.

How can I prevent this, or how can I reduce the created file size? I've tried using GDAL-Translate to compress to JPEG but this just created a file with all nan values.

  • Changing byte layout changes compressibility, in addition to raw size. If you failed to request compression, that would also have an impact. You would get a better answer from R people if you provide your code. – Vince May 5 '16 at 11:43

You might look at two things: First check your region settings before running r.patch. You need to make sure that the computational regions covers all the original rasters, and it at the same resolution as the originals. The typical ways to do this is:

g.region -p rast="<list of all your two original maps, separated by comma>"

Next, after doing the r.patch, if the result is still double precision, you can convert to float with:

r.mapcalc "float_map = float(patched_map)"

That should reduce the file size. HTH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.