Using the default `datatype` in `terra::writeRaster()` produces an `InitialCommunitiesMap` file that LANDIS-II cannot read correctly:
```
Internal error occurred within the program:
Raster band is not byte, short, int, float, double
```
The discussion at
https://groups.google.com/g/landis-ii-users/c/ub7GClEY4Ow suggests a solution (that works), which is to specify using a 16-bit *signed* integer datatype, which for `terra` corresponds to `datatype = "INT2S"`. This requirement is undocumented and suggests a mismatch between the description for `InitialCommunitiesMap` and `InitialCommunities` csv file: `InitialCommunities` table accepts `MapCode` values between 0 and 65535, but using a signed 16-bit integer for the raster cuts the max value roughly in half to 32767. Using `datatype = "INT2U"` would correspond to values between 0 and 65534, but this triggers the error noted above.
This seems like a bug in the LANDIS-II raster/GDAL libraries, but pending a fix there, perhaps the documentation can be updated to reflect this. I can submit a PR for the documentation if it makes sense to do so.
Thank you,
Alex