Understanding Grid Generation with the R receptors Package

When modeling atmospheric dispersion (such as with AERMOD) using R, the receptors package provides convenient functions to generate receptor layouts across different spatial configurations. While polar grids are intuitive to define using the radii argument, creating Cartesian or circular grids with specific distance spacing can cause confusion due to parameter naming.

How to Change Distance Spacing in circle_grid()

In the receptors package, the circle_grid() function creates a Cartesian grid of points that fall within a defined circular boundary. By default, the spacing between adjacent receptor points defaults to spacing = 5 meters.

To change the distance spacing from the default 5 meters to 10 meters, pass the spacing parameter directly into circle_grid():

library(receptors)

# Create a circular grid with a radius of 100m and 10m receptor spacing
recepts <- circle_grid(radius = 100, spacing = 10)

# Export the receptors to your desired file format
write_rou(recepts, "receptors_RStudio-TEST1.rou")

Exploring Other Grid Types in the receptors Package

The package provides several functions to handle different geometry requirements. Here is how you can configure each grid type and control spacing:

1. Rectangular Grid (rectangle_grid)

To define a rectangular boundary with custom spacing in both the X and Y directions:

# Generate a rectangular receptor grid with 10m spacing
rect_recepts <- rectangle_grid(dx = 200, dy = 100, spacing = 10)

2. Polar Rings (ring_grid or polar_grid)

When modeling rings or radial layouts, spacing is dictated by radial distances and angular steps:

# Define custom radial distances using seq(from, to, by)
polar_recepts <- polar_grid(radii = seq(10, 100, by = 10), n_angles = 36)

Summary

Controlling point density in the receptors package is straightforward once you know the parameter names:

  • Use spacing = <value> for Cartesian-based functions like circle_grid() and rectangle_grid().
  • Use step sequences (such as seq(start, end, by = step)) inside the radii parameter for polar configurations.