Hi would it be possible to include checking for null values in the input raster and then transform it to 0 values before calculating the landscape metrics?
Maybe using
grass.run_command('r.null', map = map_for_define_region, null = '0')
Thanks again!