7.4.3.9. Vector GRF Dataloader

Produces a gaussian random field of vector values, useful for producing artificial, yet somewhat realistic values for real-world variables. Values are broken down into x and y components, and saved in two columns in the final dataframe.

Name in config: 'vector_grf'

Can be used to generate binary masks.

For scalar fields, see the Vector GRF page.

Default parameters for vector GRF dataloader
{
    "loader": "vector_grf",
    "params":{
        "vec_x":     "uC",      # - Name of the first data column
        "vec_y":     "vC",      # - Name of the second 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
        "min":        0,        # - Minimum value of vector magnitude
        "max":        10        # - Maximum value of vector magnitude
    }
}

The dataloader is implemented as follows:

class meshiphi.dataloaders.vector.vector_grf.VectorGRFDataLoader(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