Skip to content

StormScopeDxNSRDB

NANWC202648 GBNVIDIAPyTorch

Import path: earth2studio.models.dx.StormScopeDxNSRDB

View source on GitHub View install commands

Documentation

Bases: Module, AutoModelMixin

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 (Module) –

    Diffusion denoiser.

  • regression_model (Module) –

    Deterministic first-guess model.

  • sigma_min (float) –

    Minimum diffusion noise level.

  • sigma_max (float) –

    Warm-start diffusion noise level.

  • conditioning_means (Tensor) –

    Per-channel GOES means.

  • conditioning_stds (Tensor) –

    Per-channel GOES standard deviations.

  • conditioning_variables (ndarray) –

    GOES input variables.

  • output_variables (ndarray) –

    Output variables, typically ["ghi"].

  • latitudes (Tensor) –

    Native-grid latitudes with shape [H, W].

  • longitudes (Tensor) –

    Native-grid longitudes with shape [H, W].

  • invariants (Tensor | None, default: None ) –

    Static conditioning channels, by default None.

  • valid_mask (Tensor | None, default: None ) –

    Native-grid output mask, by default None.

  • y_coords (ndarray | None, default: None ) –

    Native-grid y coordinates, by default None.

  • x_coords (ndarray | None, default: None ) –

    Native-grid x coordinates, by default None.

  • input_interp_max_dist_km (float, default: 12.0 ) –

    Maximum input interpolation distance, by default 12.0.

  • number_of_samples (int, default: 1 ) –

    Number of GHI samples per input, by default 1.

  • seed (int | None, default: None ) –

    Base random seed, by default None.

  • num_steps (int, default: 12 ) –

    Number of diffusion steps, by default 12.

  • amp (bool, default: True ) –

    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__

__call__(
    x: Tensor, coords: CoordSystem
) -> tuple[Tensor, CoordSystem]

Generate GHI samples from GOES imagery.

Parameters:

  • x (Tensor) –

    GOES tensor with shape [batch, time, variable, y, x].

  • coords (CoordSystem) –

    GOES coordinates.

Returns:

  • tuple[Tensor, CoordSystem] –

    GHI samples and output coordinates.

load_default_package classmethod

load_default_package() -> Package

Default StormScope NSRDB package.

Returns:

  • Package –

    Model package.

load_model classmethod

load_model(
    package: Package,
    number_of_samples: int = 1,
    seed: int | None = None,
) -> DiagnosticModel

Load the StormScope NSRDB diagnostic.

Parameters:

  • package (Package) –

    Package containing model assets.

  • number_of_samples (int, default: 1 ) –

    Number of GHI samples, by default 1.

  • seed (int | None, default: None ) –

    Base random seed, by default None.

Returns:

  • DiagnosticModel –

    Loaded diagnostic model.