r.sunmask(1grass)
π r.sunmask β the GRASS User's Manual glow-up π
okay bestie, welcome to r.sunmask(1grass), a certified banger from the GRASS User's Manual. she does exactly one thing and she does it beautifully: figuring out where the shadows fall. let's get into it π«Ά
β¨ NAME β¨
r.sunmask β calculates cast shadow areas from sun position and elevation raster map.
and here's the tea, you've got TWO ways to run her: either you hand over the exact sun position (A) yourself, or you give her a date/time and let r.sunmask work out the sun position (B) all by herself. main character energy either way π
π·οΈ KEYWORDS π·οΈ
raster, solar, sun position, shadow
π SYNOPSIS π
r.sunmask
r.sunmask --help
r.sunmask [-zsg] elevation=name [output=name] [altitude=float]
[azimuth=float] [year=integer] [month=integer] [day=integer]
[hour=integer] [minute=integer] [second=integer]
[timezone=integer] [east=value] [north=value] [--overwrite]
[--help] [--verbose] [--quiet] [--ui]
π© Flags π©
-zβ do NOT ignore zero elevation. like, keep the zeros, she said so.-sβ calculate sun position only and exit. no map, just vibes β¨-gβ print the sun position output in shell script style. perfect foreval()bestie π₯--overwriteβ allow output files to overwrite existing files--helpβ print usage summary--verboseβ verbose module output--quietβ quiet module output--uiβ force launching GUI dialog
π Parameters π
elevation=name[required] β name of input elevation raster map. yes queen, this one you MUST give her.output=nameβ name for output raster mapaltitude=floatβ altitude of the sun in degrees above the horizon (A). options: 0-89.999azimuth=floatβ azimuth of the sun in degrees from north (A). options: 0-360year=integerβ year (B). options: 1950-2050month=integerβ month (B). options: 0-12day=integerβ day (B). options: 0-31hour=integerβ hour (B). options: 0-24minute=integerβ minutes (B). options: 0-60second=integerβ seconds (B). options: 0-60. default:0timezone=integerβ timezone. east positive, offset from GMT, also use to adjust daylight savingseast=valueβ easting coordinate (point of interest). default: map centernorth=valueβ northing coordinate (point of interest). default: map center
πΈ DESCRIPTION πΈ
so r.sunmask creates an output map layer based on an input elevation raster map layer and the position of the sun. the output map layer contains the cast shadow areas resulting from sunlight and elevation. and the way you feed her that sun position? two paths, bestie:
you can either specify the sun position directly, OR the module calculates it from the given location and date/time parameters using the SOLPOS (Solar and Moon Position Algorithm) developed by the National Renewable Energy Laboratory (NREL). SOLPOS operates in two modes, so you literally have to pick one:
- (A) parameters to specify the exact known position of the sun, or
- (B) parameters to specify the date/time for the sun position calculation by
r.sunmaskitself
must be used. no third option, she's not doing a secret menu π
The module performs sunset/sunrise checks and refraction correction for sun position calculation. Local coordinate systems are internally transformed to latitude/longitude for the SOLPOS algorithm. Elevation is not taken into account for sunset/sunrise calculations.
The solar zenith angle ("sun angle above horizon") is defined as the angle between the horizon and the vertical (directly overhead or zenith). Its values can range from 90Β°, when the sun is directly overhead, to 0Β°, when the sun is on the horizon. Values lower than 0Β° indicate that the sun is below the horizon. so like, 90Β° = peak noon slay, 0Β° = golden hour, negative = go to bed π΄
The solar azimuth angle ("sun azimuth") defines the direction of the sun. It is the angle between north and the projection of the sun's rays onto the horizontal plane. This angle is measured in a clockwise direction and can vary between 0Β° and 360Β°. Specifically, an azimuth of 0Β° means the sun is in the north, 90Β° in the east, 180Β° in the south and 270Β° in the west. compass class but make it β¨ astro β¨
π NOTES π
r.sunmask and daylight saving time: instead of converting the local time to GMT, the SOLPOS algorithm uses what is known as Local Standard Time, which is generally defined as an offset from GMT. So the key is the offset from GMT, which is the solpos Time Zone parameter. If the user specifies clock time (different for winter and summer), s/he would have to change the Time Zone parameter in r.sunmask (the timezone parameter) seasonally. See also Daylight saving time by region and country. yes bestie, that's a twice-a-year manual edit, sorry π
Note: in latitude/longitude projects the position coordinates pair (east/west) has to be specified in decimal degree (not DD:MM:SS). If not specified, the map center's coordinates will be used. Alsog.region -ldisplays the map center's coordinates in latitude/longitude (org.region -cin the actual coordinate system).
Note for module usage with the -g flag, when performing calculations close to sunset/sunrise:
[...]
sunangleabovehorizont=0.434240
sunrise=07:59:19
sunset=16:25:17
Time (07:59:02) is before sunrise (07:59:19)!
WARNING: Nothing to calculate. Please verify settings.
No map calculation requested. Finished.
In the above calculation it appears to be a mistake as the program indicates that we are before sunrise while the sun angle above horizon is already positive. The reason is that sun angle above horizon is calculated with correction for atmosphere refraction while sunrise and sunset are calculated without correction for atmosphere refraction. The output without the -g flag contains related indications. so no, she's not gaslighting you, it's the refraction π§
π₯ EXAMPLE π₯
Example for North Carolina sample data set for the calculation of sun position angles and more:
# set the region to a place near Raleigh (NC)
g.region raster=elev_lid792_1m -p
# compute only sun position and no output map
r.sunmask -s elev_lid792_1m year=2012 month=2 \
day=22 hour=10 minute=30 timezone=-5
Using map center coordinates: 638650.000000 220375.000000
Calculating sun position... (using solpos (V. 11 April 2001) from NREL)
2012/02/22, daynum: 53, time: 10:30:00 (decimal time: 10.500000)
long: -78.678856, lat: 35.736160, timezone: -5.000000
Solar position: sun azimuth: 143.006409, sun angle above horz. (refraction corrected): 36.233879
Sunrise time (without refraction): 06:58:11
Sunset time (without refraction): 17:58:47
# with -g flag, useful for eval() shell function
r.sunmask -s -g elev_lid792_1m year=2012 month=2 \
day=22 hour=10 minute=30 timezone=-5
Using map center coordinates: 638650.000000 220375.000000
Calculating sun position... (using solpos (V. 11 April 2001) from NREL)
date=2012/02/22
daynum=53
time=10:30:00
decimaltime=10.500000
longitudine=-78.678856
latitude=35.736160
timezone=-5.000000
sunazimuth=143.006409
sunangleabovehorizon=36.233879
sunrise=06:58:11
sunset=17:58:47
π« Acknowledgements π«
Acknowledgements: National Renewable Energy Laboratory for their SOLPOS 2.0 sun position algorithm. shoutout the NREL scientists, they ate and left zero crumbs π
π SEE ALSO π
g.region, r.sun, r.sunhours, r.slope.aspect
π©βπ¬ AUTHORS π©βπ¬
- Janne Soimasuo, Finland, 1994
- update to FP by Huidae Cho, 2001
- SOLPOS algorithm feature added by Markus Neteler, 2001
ποΈ SOURCE CODE ποΈ
Available at: r.sunmask source code (history)
Latest change: Friday Feb 07 19:16:09 2025 in commit: a82a39f673b97fafcfce1604dc3e6015cb96487a
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page, bestie π
that was r.sunmask from the GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team, running under GRASS 8.5.0 π¦ go make some shadows, no cap πβ¨
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· 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