7.3.3.18. Shape Dataloader

The shape dataloader is designed to create abstract shapes with well known boundaries, and cast it into a data source for mesh construction. It was primarily used in testing to debug cellbox generation. As such, there is no data source for this dataloader.

class meshiphi.dataloaders.scalar.shape.ShapeDataLoader(bounds, params)
add_default_params(params)

Set default values for abstract shape dataloaders, starting by including defaults for scalar dataloaders.

Parameters:

params (dict) – Dictionary containing attributes that are required for the shape being loaded. Must include ‘shape’.

Returns:

Dictionary of attributes the dataloader will require, completed with default values if not provided in config.

Return type:

(dict)

gen_checkerboard(bounds)

Generates a checkerboard pattern within bounds of lat/long min/max Square size can be defined in the config, as well as resolution of simulated datapoints :param bounds: Limits of lat/long to generate within :type bounds: Boundary

gen_circle(bounds)

Generates a circle within bounds of lat/long min/max. Circle centre and radius can be defined in the config, as well as resolution of simulated datapoints :param bounds: Limits of lat/long to generate within :type bounds: Boundary

gen_gradient(bounds)

Generates a gradient within bounds of lat/long min/max. Gradient direction can be defined in the config, as well as resolution of simulated datapoints :param bounds: Limits of lat/long to generate within :type bounds: Boundary

gen_rectangle(bounds)

Generates a rectangle within bounds of lat/long min/max. Side lengths and centroid can be defined in the config, as well as resolution of simulated datapoints :param bounds: Limits of lat/long to generate within :type bounds: Boundary

import_data(bounds)

Generates data in the form of an abstract shape, such as circle, checkerboard, or gradient. This method acts like a factory in that it simply selects the correct shape method to enact

Parameters:

bounds (Boundary) – Initial boundary to limit the dataset to

Returns:

xarray with coordinates within bounds, and values between [0:1]. xarray has dimensions ‘lat’, ‘long’, ‘time’, and ‘dummy_data’ (by default)

Return type:

data_xr (xarray)