On 30/05/2024 15:58, sibylle via grass-user wrote:

Dear community

 

The main aim is to produce a mask of a raster file with data > 0


Maybe using r.mapcalc to create the raster mask would be more appropriate:

r.mapcalc "MASK = if(ch_apple_presence_total_pollinator_abundance_spring > 0, 1, null())"

After that command completes, all further raster modules will work only on non-null cells in the MASK raster. You should see the message "[Raster MASK present]"

To remove it, you would do:  r.mask -r


HTH, Micha


Code:

r.mask raster=ch_apple_presence_total_pollinator_abundance_spring   maskcats="0.01 thru 1"

ERROR: The raster map <ch_apple_presence_total_pollinator_abundance_spring> must be integer (CELL type)  in order to use the 'maskcats' parameter

 

Because of the error I followed the help here:

https://gis.stackexchange.com/questions/197145/error-in-r-thin-qgis-grass-input-raster-must-be-of-type-cell

 

However, wen running the code suggested with gdal_translate, I got an error

 

gdal_translate -co "ch_apple_presence_total_pollinator_abundance_spring " ch_apple_presence_total_pollinator_abundance_spring.tif bit_ ch_apple_presence_total_pollinator_abundance_spring.tif

r.null map=ch_apple_presence_total_pollinator_abundance_spring setnull=1

 

gdal_translate -co ch_apple_presence_total_pollinator_abundance_spring  ch_apple_presence_total_pollinator_abundance_spring.tif bit_ ch_apple_presence_total_pollinator_abundance_spring.tif

ERROR 6: Too many command options

'ch_apple_presence_total_pollinator_abundance_spring.tif'

Usage: gdal_translate [--help] [--help-general] [--long-

usage]

       [-ot {Byte/Int8/Int16/UInt16/UInt32/Int32/UInt64/Int6

4/Float32/Float64/

             CInt16/CInt32/CFloat32/CFloat64}] [-strict]

       [-if <format>]... [-of <format>]

       [-b <band>] [-mask <band>] [-expand {gray|rgb|rgba}]

       [-outsize <xsize>[%]|0 <ysize>[%]|0] [-tr <xres>

<yres>]

       [-ovr <level>|AUTO|AUTO-<n>|NONE]

       [-r

{nearest,bilinear,cubic,cubicspline,lanczos,average,mode}]

       [-unscale] [-scale[_bn] [<src_min> <src_max>

[<dst_min> <dst_max>]]]... [-exponent[_bn] <exp_val>]...

       [-srcwin <xoff> <yoff> <xsize> <ysize>] [-epo] [-eco]

       [-projwin <ulx> <uly> <lrx> <lry>] [-projwin_srs

<srs_def>]

       [-a_srs <srs_def>] [-a_coord_epoch <epoch>]

       [-a_ullr <ulx> <uly> <lrx> <lry>] [-a_nodata <value>]

       [-a_gt <gt0> <gt1> <gt2> <gt3> <gt4> <gt5>]

       [-a_scale <value>] [-a_offset <value>]

       [-nogcp] [-gcp <pixel> <line> <easting> <northing>

[<elevation>]]...

       |-colorinterp{_bn}

{red|green|blue|alpha|gray|undefined}]

       |-colorinterp

{red|green|blue|alpha|gray|undefined},...]

       [-mo <META-TAG>=<VALUE>]... [-q] [-sds]

       [-co <NAME>=<VALUE>]... [-stats] [-norat] [-noxmp]

       [-oo <NAME>=<VALUE>]...

       <src_dataset> <dst_dataset>

 

Thanks a lot

Sibylle

 

 

 

 


_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user
-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to