r.null(1)
π r.null β the GRASS GIS bestie manual π
okay so. hi. you're reading the manual page for r.null(1), which lives in the GRASS GIS User's Manual. yes bestie, it's a real one, and it's about to become your favorite little raster-hygiene tool. let's go π¦
β¨ NAME β¨
r.null β manages NULL-values of a given raster map. that's it. that's the job. null data management, but make it cute. π
πΈ KEYWORDS πΈ
raster, map management, null data, no-data
iykyk β it's giving data hygiene energy β¨
π SYNOPSIS π
r.null
r.null --help
r.null [-fincrz] map=name [setnull=val[-val][,val[-val],...]]
[null=float] [--help] [--verbose] [--quiet] [--ui]
π Flags
-fβ only do the work if the map is floating-point. like, if it's not float, it's not the vibe, and it just doesn't engage.-iβ only do the work if the map is integer. same energy, opposite direction.-nβ only do the work if the map doesn't have a NULL-value bitmap file.-cβ create the NULL-value bitmap file, validating all data cells.-rβ remove the NULL-value bitmap file. bye bye π-zβ re-create the NULL-value bitmap file (to compress or uncompress). the glow-up flag β¨--helpβ print usage summary.--verboseβ verbose module output.--quietβ quiet module output. shhh π€«--uiβ force launching GUI dialog.
π Parameters
map=name[required] β name of the raster map for which to edit null values. you gotta have this one, no cap.setnull=val[-val][,val[-val],...]β list of cell values to be set to NULL.null=floatβ the value to replace the null value by.
π DESCRIPTION π
so the whole function of r.null is to explicitly create the NULL-value bitmap file. the intended usage is to update maps that don't have a NULL-value bitmap file β like, to indicate for each pixel whether zero is a valid value, or whether it should be considered NULL, i.e. a no data value. also: the module does not work with reclassified or external maps. noted π
the design is flexible, bestie. ranges of values can be set to NULL, and/or the NULL value can be eliminated and replaced with a specified value. options on options π
the setnull parameter is what you use to specify values in the ranges to be set to NULL. a range is either a single value (e.g., 5.3), or a pair of values (e.g., 4.76-34.56). existing NULL-values are left NULL, unless the null argument is requested. so they just chill there unless you say otherwise β¨
the null parameter eliminates the NULL value and replaces it with a value. this argument is applied only to existing NULL values, and not to the NULLs created by the setnull argument. important distinction, don't mix them up π
π₯ NOTES π₯
note that the value is restricted to integer if the map is an integer map. fr fr, integer map = integer values only.
π§ r.null and reclassified maps
r.null does not support reclassified maps, and here's why: if r.null was run on the reclass raster, it would alter the original and any other reclass rasters of the original. so yeah, r.null does not allow recoding reclassified maps (products of r.reclass). that's a whole mess we're avoiding π
as a workaround, the way to recode such a map is: the user creates a raster map out of the reclassified map by copying it:
r.mapcalc "newmap = reclass"
there you go, workaround secured π«Ά
π NULL data compression
by default no data files (i.e., NULL files) are not compressed unless a specific environment variable is set. the NULL file compression must be explicitly turned on with:
export GRASS_COMPRESS_NULLS=1
Warning: such raster maps can then only be opened with GRASS GIS 7.2.0 or later. NULL file compression can be managed with r.null -z.
so like, turn it on, but know the consequences bestie π
π¦ External maps
straight from the r.external documentation: GDAL-linked (r.external) maps do not have or use a NULL bitmap, hence r.null cannot manipulate them directly. here NULL cells are those whose value matches the value reported by the GDALGetRasterNoDataValue() function. to apply the GDAL-linked, the user needs to either create a MASK (e.g. with r.mask) and then "apply" it using e.g. r.resample, or use r.mapcalc to create a copy with the appropriate categories changed to NULL (if() condition). pick your path, both slay β¨
β EXAMPLES β
set specific values of a classified map to NULL:
r.null map=landcover.30m setnull=21,22
set NULL-values of a map to a specific value:
r.null map=fields null=99
ate. no crumbs. π₯
π«Ά SEE ALSO π«Ά
r.compress, r.support, r.quant
π AUTHOR π
U.S.Army Construction Engineering Research Laboratory
π SOURCE CODE π
available at: r.null source code (history)
accessed: Saturday Jan 17 05:40:51 2026
main index | raster index | topics index | keywords index | graphical index | full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
and that's the whole page bestie β GRASS 8.4.2, r.null(1), signed off with love. go forth and null responsibly πβ¨π
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms