Resampling and Interpolation#

class physicsnemo.nn.module.resample_layers.DownSample2D(in_dim, input_resolution, output_resolution)[source]#

Bases: Module

Revise from WeatherLearn lizhuoq/WeatherLearn 2D Down-sampling operation

Parameters:
  • in_dim (int) – Number of input channels.

  • input_resolution (tuple[int]) – [latitude, longitude]

  • output_resolution (tuple[int]) – [latitude, longitude]

forward(x: Tensor)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class physicsnemo.nn.module.resample_layers.DownSample3D(in_dim, input_resolution, output_resolution)[source]#

Bases: Module

Revise from WeatherLearn lizhuoq/WeatherLearn 3D Down-sampling operation Implementation from: 198808xc/Pangu-Weather

Parameters:
  • in_dim (int) – Number of input channels.

  • input_resolution (tuple[int]) – [pressure levels, latitude, longitude]

  • output_resolution (tuple[int]) – [pressure levels, latitude, longitude]

forward(x)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class physicsnemo.nn.module.resample_layers.UpSample2D(in_dim, out_dim, input_resolution, output_resolution)[source]#

Bases: Module

Revise from WeatherLearn lizhuoq/WeatherLearn 2D Up-sampling operation.

Parameters:
  • in_dim (int) – Number of input channels.

  • out_dim (int) – Number of output channels.

  • input_resolution (tuple[int]) – [latitude, longitude]

  • output_resolution (tuple[int]) – [latitude, longitude]

forward(x: Tensor)[source]#
Parameters:

x (torch.Tensor) – (B, N, C)

class physicsnemo.nn.module.resample_layers.UpSample3D(in_dim, out_dim, input_resolution, output_resolution)[source]#

Bases: Module

Revise from WeatherLearn lizhuoq/WeatherLearn 3D Up-sampling operation. Implementation from: 198808xc/Pangu-Weather

Parameters:
  • in_dim (int) – Number of input channels.

  • out_dim (int) – Number of output channels.

  • input_resolution (tuple[int]) – [pressure levels, latitude, longitude]

  • output_resolution (tuple[int]) – [pressure levels, latitude, longitude]

forward(x: Tensor)[source]#
Parameters:

x (torch.Tensor) – (B, N, C)