StormScopeDxNSRDB#

class earth2studio.models.dx.StormScopeDxNSRDB(
diffusion_model,
regression_model,
sigma_min,
sigma_max,
conditioning_means,
conditioning_stds,
conditioning_variables,
output_variables,
latitudes,
longitudes,
invariants=None,
valid_mask=None,
y_coords=None,
x_coords=None,
input_interp_max_dist_km=12.0,
number_of_samples=1,
seed=None,
num_steps=12,
amp=True,
)[source]#
NANWC202660Gb

Estimate Global Horizontal Irradiance from GOES imagery.

This diagnostic model is designed to be used with the earth2studio.models.px.StormScopeGOES prognostic model, consuming its GOES channel outputs to produce solar irradiance estimates.

A regression network produces a first estimate that is refined with a warm-started diffusion sampler. Each requested sample is generated independently at the input observation time.

Note

For more information see the following references:

Parameters:
  • diffusion_model (nn.Module) – Diffusion denoiser.

  • regression_model (nn.Module) – Deterministic first-guess model.

  • sigma_min (float) – Minimum diffusion noise level.

  • sigma_max (float) – Warm-start diffusion noise level.

  • conditioning_means (torch.Tensor) – Per-channel GOES means.

  • conditioning_stds (torch.Tensor) – Per-channel GOES standard deviations.

  • conditioning_variables (np.ndarray) – GOES input variables.

  • output_variables (np.ndarray) – Output variables, typically ["ghi"].

  • latitudes (torch.Tensor) – Native-grid latitudes with shape [H, W].

  • longitudes (torch.Tensor) – Native-grid longitudes with shape [H, W].

  • invariants (torch.Tensor | None, optional) – Static conditioning channels, by default None.

  • valid_mask (torch.Tensor | None, optional) – Native-grid output mask, by default None.

  • y_coords (np.ndarray | None, optional) – Native-grid y coordinates, by default None.

  • x_coords (np.ndarray | None, optional) – Native-grid x coordinates, by default None.

  • input_interp_max_dist_km (float, optional) – Maximum input interpolation distance, by default 12.0.

  • number_of_samples (int, optional) – Number of GHI samples per input, by default 1.

  • seed (int | None, optional) – Base random seed, by default None.

  • num_steps (int, optional) – Number of diffusion steps, by default 12.

  • amp (bool, optional) – Enable automatic mixed precision, by default True.

Example

Using the diagnostic with forecasted GOES imagery from earth2studio.models.px.StormScopeGOES. A earth2studio.data.GOES data source can also be used directly in place of the prognostic model output:

>>> # Load StormScopeGOES prognostic and NSRDB diagnostic models
>>> package = StormScopeBase.load_default_package()
>>> goes_model = StormScopeGOES.load_model(package, conditioning_data_source=None)
>>> goes_model = goes_model.to("cuda").eval()
>>> nsrdb_model = StormScopeDxNSRDB.load_model(StormScopeDxNSRDB.load_default_package())
>>> nsrdb_model = nsrdb_model.to("cuda")
>>>
>>> # Build interpolators from GOES grid to model grid
>>> goes_lat, goes_lon = GOES.grid(satellite="goes16", scan_mode="C")
>>> goes_model.build_input_interpolator(goes_lat, goes_lon)
>>> nsrdb_model.build_input_interpolator(goes_lat, goes_lon)
>>>
>>> # Run one GOES forecast step then estimate GHI
>>> y_goes, y_coords = goes_model(x, coords)
>>> ghi_coords = y_coords.copy()
>>> del ghi_coords["lead_time"]
>>> ghi, ghi_coords = nsrdb_model(y_goes.squeeze(2), ghi_coords)
__call__(x, coords)[source]#

Generate GHI samples from GOES imagery.

Parameters:
  • x (torch.Tensor) – GOES tensor with shape [batch, time, variable, y, x].

  • coords (CoordSystem) – GOES coordinates.

Returns:

GHI samples and output coordinates.

Return type:

tuple[torch.Tensor, CoordSystem]

classmethod load_default_package()[source]#

Default StormScope NSRDB package.

Returns:

Model package.

Return type:

Package

classmethod load_model(package, number_of_samples=1, seed=None)[source]#

Load the StormScope NSRDB diagnostic.

Parameters:
  • package (Package) – Package containing model assets.

  • number_of_samples (int, optional) – Number of GHI samples, by default 1.

  • seed (int | None, optional) – Base random seed, by default None.

Returns:

Loaded diagnostic model.

Return type:

DiagnosticModel