pyhazards.models package¶
Catalog Summary¶
This page links the public model catalog, the developer registry workflow, and the package submodules used to implement model builders.
For the curated browsing experience, use Models.
Wildfire¶
Implemented Models¶
ASUFM, DNN-LSTM-AutoEncoder, FireCastNet, ForeFire Adapter, Wildfire Forecasting, WildfireSpreadTS, WRF-SFIRE Adapter, CNN-ASPP.
Earthquake¶
Implemented Models¶
Flood¶
Implemented Models¶
EA-LSTM, FloodCast, Google Flood Forecasting, NeuralHydrology LSTM, UrbanFloodCast, HydroGraphNet.
Tropical Cyclone¶
Implemented Models¶
Hurricast, SAF-Net, TCIF-fusion, Tropical Cyclone MLP, TropiCycloneNet.
Experimental Adapters¶
FourCastNet TC Adapter, GraphCast TC Adapter, Pangu TC Adapter.
Developer Registry Workflow¶
Use this section when you need the package-level builder and registry interface rather than the public catalog presentation.
Build a Registered Model¶
from pyhazards.models import build_model
model = build_model(
name="phasenet",
task="regression",
in_channels=3,
)
Register a Custom Model¶
import torch.nn as nn
from pyhazards.models import build_model, register_model
def my_custom_builder(task: str, in_dim: int, out_dim: int, **kwargs) -> nn.Module:
hidden = kwargs.get("hidden_dim", 128)
return nn.Sequential(
nn.Linear(in_dim, hidden),
nn.ReLU(),
nn.Linear(hidden, out_dim),
)
register_model("my_mlp", my_custom_builder, defaults={"hidden_dim": 128})
model = build_model(name="my_mlp", task="regression", in_dim=16, out_dim=1)
Notes¶
Builders receive
taskplus any kwargs you pass.register_modelstores optional defaults so configs can stay small.Use Implementation Guide for the full contributor workflow.
Submodules¶
pyhazards.models.backbones module¶
- class pyhazards.models.backbones.CNNPatchEncoder(in_channels=3, hidden_dim=64)[source]¶
Bases:
ModuleLightweight CNN encoder for raster patches.
pyhazards.models.heads module¶
- class pyhazards.models.heads.ClassificationHead(in_dim, num_classes)[source]¶
Bases:
ModuleSimple classification head.
pyhazards.models.builder module¶
pyhazards.models.registry module¶
Module contents¶
- class pyhazards.models.ASUFM(input_dim=7, hidden_dim=64, output_dim=5, lookback=12, dropout=0.1)[source]¶
Bases:
ModuleTemporal convolution baseline for wildfire activity forecasting.
- class pyhazards.models.CNNPatchEncoder(in_channels=3, hidden_dim=64)[source]¶
Bases:
ModuleLightweight CNN encoder for raster patches.
- class pyhazards.models.ClassificationHead(in_dim, num_classes)[source]¶
Bases:
ModuleSimple classification head.
- class pyhazards.models.ConvLEMCell(in_channels, out_channels, kernel_size=3, dt=1.0, activation='tanh', use_reset_gate=False)[source]¶
Bases:
ModuleConvolutional Long Expressive Memory (ConvLEM) cell used by WaveCastNet.
- class pyhazards.models.EQNet(in_channels=3, hidden_dim=48, num_heads=4, num_layers=2, dropout=0.1)[source]¶
Bases:
ModuleTransformer-style earthquake phase-picking baseline.
- class pyhazards.models.EQTransformer(in_channels=3, hidden_dim=48, num_layers=2, dropout=0.1)[source]¶
Bases:
ModuleCompact sequence model for joint earthquake phase picking.
- class pyhazards.models.FireCastNet(in_channels=12, hidden_dim=32, out_channels=1, dropout=0.1)[source]¶
Bases:
ModuleCompact encoder-decoder wildfire spread network.
- class pyhazards.models.FloodCast(in_channels=3, history=4, hidden_dim=32, out_channels=1, dropout=0.1)[source]¶
Bases:
ModuleCompact spatiotemporal inundation baseline.
- class pyhazards.models.ForeFireAdapter(in_channels=12, out_channels=1, diffusion_steps=2)[source]¶
Bases:
ModuleLightweight deterministic spread adapter inspired by simulator-style fronts.
- class pyhazards.models.FourCastNetTC(input_dim=8, history=6, hidden_dim=96, horizon=5, output_dim=3, dropout=0.1)[source]¶
Bases:
ModuleExperimental wrapper-style FourCastNet storm adapter.
- class pyhazards.models.GPD(in_channels=3, hidden_dim=32, dropout=0.1)[source]¶
Bases:
ModuleSimple CNN baseline for generalized phase detection style picking.
- class pyhazards.models.GoogleFloodForecasting(input_dim=2, hidden_dim=64, out_dim=1, history=4, dropout=0.1)[source]¶
Bases:
ModuleSequence baseline for streamflow-style flood forecasting.
- class pyhazards.models.GraphCastTC(input_dim=8, hidden_dim=96, horizon=5, output_dim=3, num_layers=2, num_heads=4, dropout=0.1)[source]¶
Bases:
ModuleExperimental wrapper-style GraphCast storm adapter.
- class pyhazards.models.Hurricast(input_dim=8, hidden_dim=64, num_layers=2, horizon=5, output_dim=3, dropout=0.1)[source]¶
Bases:
ModuleCompact storm-track and intensity baseline for Wave 2 vertical slices.
- class pyhazards.models.HydroGraphNet(node_in_dim, edge_in_dim, out_dim, hidden_dim=64, harmonics=5, num_gn_blocks=5, state_dim=None, rollout_steps=1, enforce_nonnegative=False, dropout=0.0)[source]¶
Bases:
ModulePhysicsNeMo-inspired HydroGraphNet: encoder -> message-passing processor -> residual delta-state decoder.
Supports one-step forward prediction and autoregressive rollout.
- class pyhazards.models.HydroGraphNetLoss(supervised_weight=1.0, continuity_weight=0.0)[source]¶
Bases:
ModuleSupervised regression loss with optional continuity regularization.
- class pyhazards.models.MLPBackbone(input_dim, hidden_dim=256, depth=2)[source]¶
Bases:
ModuleSimple MLP for tabular features.
- class pyhazards.models.NeuralHydrologyEALSTM(input_dim=2, hidden_dim=64, num_layers=1, out_dim=1, dropout=0.1)[source]¶
Bases:
ModuleEntity-aware LSTM style streamflow baseline.
- class pyhazards.models.NeuralHydrologyLSTM(input_dim=2, hidden_dim=64, num_layers=2, out_dim=1, dropout=0.1)[source]¶
Bases:
ModuleAdapter-style LSTM streamflow baseline.
- class pyhazards.models.PanguTC(input_dim=8, hidden_dim=96, horizon=5, output_dim=3, dropout=0.1)[source]¶
Bases:
ModuleExperimental wrapper-style Pangu-Weather storm adapter.
- class pyhazards.models.PhaseNet(in_channels=3, hidden_dim=32)[source]¶
Bases:
ModuleLightweight phase-picking network for synthetic waveform smoke runs.
- class pyhazards.models.RegressionHead(in_dim, out_dim=1)[source]¶
Bases:
ModuleRegression head for scalar or multi-target outputs.
- class pyhazards.models.SAFNet(input_dim=8, hidden_dim=64, horizon=5, dropout=0.1)[source]¶
Bases:
ModuleSpatiotemporal intensity-focused storm baseline.
- class pyhazards.models.SegmentationHead(in_channels, num_classes)[source]¶
Bases:
ModuleSegmentation head for raster masks.
- class pyhazards.models.TCIFFusion(input_dim=8, hidden_dim=64, horizon=5, output_dim=3, dropout=0.1)[source]¶
Bases:
ModuleKnowledge-guided fusion baseline for tropical cyclone forecasting.
- class pyhazards.models.TemporalEncoder(input_dim, hidden_dim=128, num_layers=1)[source]¶
Bases:
ModuleGRU-based encoder for time-series signals.
- class pyhazards.models.TropiCycloneNet(input_dim=8, hidden_dim=64, horizon=5, output_dim=3, num_layers=2, dropout=0.1)[source]¶
Bases:
ModuleGRU + attention baseline for all-basin tropical cyclone forecasting.
- class pyhazards.models.TropicalCycloneMLP(input_dim=8, history=6, hidden_dim=64, horizon=5, output_dim=3, dropout=0.1)[source]¶
Bases:
ModuleCompact MLP baseline for storm track and intensity forecasting.
- class pyhazards.models.TverskyLoss(alpha=0.5, beta=0.5, smooth=1e-06, from_logits=True)[source]¶
Bases:
ModuleTversky loss for binary segmentation.
- class pyhazards.models.UrbanFloodCast(in_channels=3, history=4, base_channels=32, out_channels=1)[source]¶
Bases:
ModuleU-Net style urban inundation baseline.
- class pyhazards.models.WRFSFireAdapter(in_channels=12, out_channels=1, diffusion_steps=3)[source]¶
Bases:
ModuleLightweight raster adapter inspired by WRF-SFIRE style spread diffusion.
- class pyhazards.models.WaveCastNet(in_channels, height, width, temporal_in, temporal_out, hidden_dim=144, num_layers=2, kernel_size=3, dt=1.0, activation='tanh', dropout=0.1)[source]¶
Bases:
ModuleSequence-to-sequence wavefield forecasting model based on ConvLEM cells.
Input shape: (B, C, T_in, H, W) Output shape: (B, C, T_out, H, W)
- class pyhazards.models.WaveCastNetLoss(delta=1.0)[source]¶
Bases:
ModuleHuber loss used in the WaveCastNet paper.
- class pyhazards.models.WavefieldMetrics[source]¶
Bases:
objectACC and RFNE metrics reported in the WaveCastNet paper.
- class pyhazards.models.WildfireASPP(in_channels=12, base_channels=32, aspp_channels=32, dilations=(1, 3, 6, 12), dropout=0.0)[source]¶
Bases:
WildfireCNNASPPBackward-compatible name for the CNN + ASPP wildfire model.
- class pyhazards.models.WildfireCNNASPP(in_channels=12, base_channels=32, aspp_channels=32, dilations=(1, 3, 6, 12), dropout=0.0)[source]¶
Bases:
ModuleCNN + ASPP wildfire segmentation model.
- Input:
x : (B, C, H, W) float tensor
- Output:
logits : (B, 1, H, W) float tensor (sigmoid applied externally)
- class pyhazards.models.WildfireFPA(stage, component)[source]¶
Bases:
ModulePaper-facing wrapper for the two-stage FPA-FOD wildfire framework.
- class pyhazards.models.WildfireForecasting(input_dim=7, hidden_dim=64, output_dim=5, lookback=12, num_layers=2, dropout=0.1)[source]¶
Bases:
ModuleSequence forecaster for weekly wildfire size-group activity.
- class pyhazards.models.WildfireMamba(in_dim, num_counties, past_days, hidden_dim=128, gcn_hidden=64, mamba_layers=2, state_dim=64, conv_kernel=5, dropout=0.1, adjacency=None, with_count_head=False)[source]¶
Bases:
ModuleMamba-based spatio-temporal wildfire model for county-day ERA5 features.
Input shape: (batch, past_days, num_counties, num_features) Output: logits per county for the next day (use sigmoid for probabilities)
- forward(x, adjacency=None)[source]¶
- Parameters:
x (
Tensor) – Tensor shaped (batch, past_days, num_counties, in_dim)adjacency (
Optional[Tensor]) – Optional (N, N) or (B, N, N) adjacency override.
- Returns:
(batch, num_counties) - optional counts: (batch, num_counties) if with_count_head is enabled.
- Return type:
logits
- class pyhazards.models.WildfireSpreadTS(history=4, in_channels=6, hidden_dim=32, out_channels=1, dropout=0.1)[source]¶
Bases:
ModuleTemporal convolution baseline for wildfire spread masks.
- pyhazards.models.asufm_builder(task, input_dim=7, hidden_dim=64, output_dim=5, lookback=12, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.build_model(name, task, **kwargs)[source]¶
Build a model by name and task. This delegates to registry metadata to keep a consistent interface.
- Return type:
Module
- pyhazards.models.cnn_aspp_builder(task, in_channels=12, base_channels=32, aspp_channels=32, dilations=(1, 3, 6, 12), dropout=0.0, **kwargs)[source]¶
PyHazards-style model builder.
- Return type:
Module
- pyhazards.models.eqnet_builder(task, in_channels=3, hidden_dim=48, num_heads=4, num_layers=2, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.eqtransformer_builder(task, in_channels=3, hidden_dim=48, num_layers=2, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.firecastnet_builder(task, in_channels=12, hidden_dim=32, out_channels=1, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.floodcast_builder(task, in_channels=3, history=4, hidden_dim=32, out_channels=1, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.forefire_builder(task, in_channels=12, out_channels=1, diffusion_steps=2, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.fourcastnet_tc_builder(task, input_dim=8, history=6, hidden_dim=96, horizon=5, output_dim=3, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.google_flood_forecasting_builder(task, input_dim=2, hidden_dim=64, out_dim=1, history=4, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.gpd_builder(task, in_channels=3, hidden_dim=32, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.graphcast_tc_builder(task, input_dim=8, hidden_dim=96, horizon=5, output_dim=3, num_layers=2, num_heads=4, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.hurricast_builder(task, input_dim=8, hidden_dim=64, num_layers=2, horizon=5, output_dim=3, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.hydrographnet_builder(task, node_in_dim, edge_in_dim, out_dim, **kwargs)[source]¶
- Return type:
- pyhazards.models.neuralhydrology_ealstm_builder(task, input_dim=2, hidden_dim=64, num_layers=1, out_dim=1, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.neuralhydrology_lstm_builder(task, input_dim=2, hidden_dim=64, num_layers=2, out_dim=1, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.pangu_tc_builder(task, input_dim=8, hidden_dim=96, horizon=5, output_dim=3, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.phasenet_builder(task, in_channels=3, hidden_dim=32, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.saf_net_builder(task, input_dim=8, hidden_dim=64, horizon=5, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.tcif_fusion_builder(task, input_dim=8, hidden_dim=64, horizon=5, output_dim=3, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.tropicalcyclone_mlp_builder(task, input_dim=8, history=6, hidden_dim=64, horizon=5, output_dim=3, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.tropicyclonenet_builder(task, input_dim=8, hidden_dim=64, horizon=5, output_dim=3, num_layers=2, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.urbanfloodcast_builder(task, in_channels=3, history=4, base_channels=32, out_channels=1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.wavecastnet_builder(task, in_channels, height, width, temporal_in, temporal_out, **kwargs)[source]¶
- Return type:
- pyhazards.models.wildfire_forecasting_builder(task, input_dim=7, hidden_dim=64, output_dim=5, lookback=12, num_layers=2, dropout=0.1, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.wildfire_fpa_builder(task, in_dim=None, input_dim=None, out_dim=None, output_dim=None, depth=2, hidden_dim=64, activation='relu', dropout=None, latent_dim=32, num_layers=1, ae_hidden_dim=None, ae_num_layers=None, lookback=50, **kwargs)[source]¶
- Return type:
Module
- pyhazards.models.wildfire_mamba_builder(task, in_dim, num_counties, past_days, **kwargs)[source]¶
Builder used by the model registry.
- Return type: