data_sources.satellite
Satellite data sources and functions
data_sources.satellite.satellite_model
Model for output of satellite data
Satellite Objects
class Satellite(DataSourceOutput)
Class to store satellite data as a xr.Dataset with some validation
model_validation
@classmethod
def model_validation(cls, v)
Check that all values are non negative
data_sources.satellite.satellite_data_source
Satellite Data Source
SatelliteDataSource Objects
@dataclass
class SatelliteDataSource(ZarrDataSource)
Satellite Data Source.
__post_init__
def __post_init__(image_size_pixels: int, meters_per_pixel: int)
Post Init
open
def open() -> None
Open Satellite data
We don't want to open_sat_data in init. If we did that, then we couldn't copy SatelliteDataSource instances into separate processes. Instead, call open() after creating separate processes.
get_data_model_for_batch
def get_data_model_for_batch()
Get the model that is used in the batch
datetime_index
def datetime_index(remove_night: bool = True) -> pd.DatetimeIndex
Returns a complete list of all available datetimes
Arguments:
remove_night
- If True then remove datetimes at night. We're interested in forecasting solar power generation, so we don't care about nighttime data :)
In the UK in summer, the sun rises first in the north east, and sets last in the north west [1]. In summer, the north gets more hours of sunshine per day.
In the UK in winter, the sun rises first in the south east, and sets last in the south west [2]. In winter, the south gets more hours of sunshine per day.
Summer | Winter | |
---|---|---|
Sun rises first in | N.E. | S.E. |
Sun sets last in | N.W. | S.W. |
Most hours of sunlight | North | South |
Before training, we select timesteps which have at least some sunlight. We do this by computing the clearsky global horizontal irradiance (GHI) for the four corners of the satellite imagery, and for all the timesteps in the dataset. We only use timesteps where the maximum global horizontal irradiance across all four corners is above some threshold.
The 'clearsky solar irradiance' is the amount of sunlight we'd expect on a clear day at a specific time and location. The SI unit of irradiance is watt per square meter. The 'global horizontal irradiance' (GHI) is the total sunlight that would hit a horizontal surface on the surface of the Earth. The GHI is the sum of the direct irradiance (sunlight which takes a direct path from the Sun to the Earth's surface) and the diffuse horizontal irradiance (the sunlight scattered from the atmosphere). For more info, see: https://en.wikipedia.org/wiki/Solar_irradiance
References:
open_sat_data
def open_sat_data(zarr_path: str, consolidated: bool) -> xr.DataArray
Lazily opens the Zarr store.
Adds 1 minute to the 'time' coordinates, so the timestamps are at 00, 05, ..., 55 past the hour.
Arguments:
zarr_path
- Cloud URL or local path. If GCP URL, must start with 'gs://'consolidated
- Whether or not the Zarr metadata is consolidated.