Snow Processors
Estimate seasonal snow cover so the texture generator can paint snow onto the selection
texture. The model works in two steps: it estimates a surface temperature for each pixel —
either from a simple built-in climatology (warmer near the equator, colder at altitude, with a
summer/winter swing) or by interpolating a CAMS atmospheric profile onto the terrain — and then
turns that temperature into a snow probability that rises smoothly as it drops below freezing.
Two seasons are supported, June and December. Configured via SnowConfig
(see Scene config).
s2gos_generator.processors.terrain_texture.snow.get_day_of_year
Map Month enum to approximate day of year.
s2gos_generator.processors.terrain_texture.snow.apply_spatial_smoothing
Apply Gaussian spatial smoothing.
s2gos_generator.processors.terrain_texture.snow.calculate_seasonal_amplitude
Seasonal temperature swing as a function of latitude.
Small near the equator, large near the poles (linear interpolation between the two reference latitudes, clamped to that range).
s2gos_generator.processors.terrain_texture.snow.interpolate_cams_temperature
Interpolate temperature from CAMS atmospheric profile.
Temperature is extracted from CAMS vertical profile and interpolated to terrain elevations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
elevations
|
ndarray
|
Terrain elevation in meters, shape (height, width) |
required |
thermoprops
|
Dataset
|
CAMS dataset after squeeze(drop=True), containing: - t: air temperature [z] in Kelvin - z: height [z] in kilometers (0-120km typical) |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Temperature in Celsius, same shape as elevations |
s2gos_generator.processors.terrain_texture.snow.calculate_temperature_field
calculate_temperature_field(
latitudes: ndarray,
elevations: ndarray,
day_of_year: int,
) -> np.ndarray
Estimate surface air temperature from latitude, elevation, and day of year.
Synthetic climatology: start from a warm equatorial reference, cool toward the poles and with altitude, and add a summer/winter swing whose size grows with latitude and whose timing depends on the hemisphere.
s2gos_generator.processors.terrain_texture.snow.calculate_snow_probability_map
calculate_snow_probability_map(
latitudes: ndarray,
elevations: ndarray,
day_of_year: int,
smooth_sigma: float = 0.0,
thermoprops: Optional[Dataset] = None,
) -> Tuple[np.ndarray, np.ndarray]
Estimate the per-pixel probability of snow from temperature.
Temperature comes from a CAMS profile when thermoprops is given, otherwise
from the synthetic model. Probability follows a smooth transition around freezing
— close to 1 well below 0 °C, falling to 0 just above it — and any pixel warmer
than the hard freeze limit (0.3 °C) is left snow-free.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitudes
|
ndarray
|
Latitude in degrees, shape (height, width) |
required |
elevations
|
ndarray
|
Elevation in meters, shape (height, width) |
required |
day_of_year
|
int
|
Day of year (1-365) |
required |
smooth_sigma
|
float
|
Gaussian smoothing sigma (0 = no smoothing) |
0.0
|
thermoprops
|
Optional[Dataset]
|
Optional CAMS dataset (after squeeze). If provided, uses CAMS temperature; otherwise uses synthetic model. |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[ndarray, ndarray]
|
(probabilities, temperatures) - both same shape as inputs |