7.3.3.17. Scalar GRF Dataloader

Produces a gaussian random field of scalar values, useful for producing artificial, yet somewhat realistic values for real-world variables.

Name in config: 'scalar_grf'

Can be used to generate binary masks.

For vector fields, see the Vector GRF page.

Default parameters for scalar GRF dataloader.
{
    "loader": "scalar_grf",
    "params":{
        "data_name": "data",    # - Name of the data column
        "seed":       None,     # - Seed for random number generator. Must
                                #   be int or None. None sets a random seed
        "size":       512,      # - Number of datapoints per lat/long axis
        "alpha":      3,        # - Power of the power-law momentum
                                #   distribution used to generate GRF
        "binary":     False,    # - Flag specifying this GRF isn't a binary mask
        "threshold":  [0, 1],   # - Caps of min/max values to ensure normalising
                                #   not skewed by outlier in randomised GRF
        "min":        -10,      # - Minimum value of GRF
        "max":        10,       # - Maximum value of GRF
        "multiplier": 1,        # - Multiplier for entire dataset
        "offset":     0         # - Offset for entire dataset
    }
}

NOTE: min/max are set BEFORE multiplier and offset are used. The actual values for the min and max are

actual_min = multiplier * min + offset
actual_max = multiplier * max + offset

The dataloader is implemented as follows:

class meshiphi.dataloaders.scalar.scalar_grf.ScalarGRFDataLoader(bounds, params)
add_default_params(params)

Set default values for abstract GRF 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)

import_data(bounds)

Creates data in the form of a Gaussian Random Field

Parameters:

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

Returns:

Scalar dataset within limits of bounds. Dataset has coordinates ‘lat’, ‘long’, and variable name ‘data’.

NOTE - In __init__, variable name will be set to data_name if defined in config

Return type:

pd.DataFrame