consider using scalaxy.loops:

```scala
import scalaxy.loops._

for(i <- 0 until rd.length optimized) {
  if(rd(i) == userNoData) rd(i) = NODATA
}