Contributions

This sub-package of simkit contains contributions that are considered important parts of development, but have not been merged into the core sub-package yet.

Readers

Custom data readers including simkit.contrib.readers.ArgumentReader, simkit.contrib.readers.DjangoModelReader and simkit.contrib.readers.HDF5Reader.

Argument Reader

class simkit.contrib.readers.ArgumentReader(parameters, meta=None)[source]

Read arguments passed directly to a simulation.

The argument parameters dictionary should have two keys: args and kwargs which consist of the names and attributes of the positional and keyword arguments respectively. For example:

{
    'GHI': {'units': 'W/m**2', 'isconstant': False, 'argpos': 0},
    'azimuth': {'units': 'degrees', 'isconstant': False, 'argpos': 1},
    'DNI': {'units': 'W/m**2', 'isconstant': False},
    'zenith': {'units': 'degrees', 'isconstant': False}
}
apply_units_to_cache(data)[source]

Applies units to data when a proxy reader is used. For example if the data is cached as JSON and retrieved using the JSONReader, then units can be applied from the original parameter schema.

Parameters

data – Data read by proxy reader.

Returns

data with units applied

is_file_reader = False

True if reader accepts filename argument

load_data(*args, **kwargs)[source]

Collects positional and keyword arguments into data and applies units.

Returns

data

Django Model Reader

class simkit.contrib.readers.DjangoModelReader(parameters=None, meta=None)[source]

Reads arguments that are Django objects or lists of objects.

load_data(model_instance, *args, **kwargs)[source]

Apply units to model. :return: data

model = None

Django model

HD5F Reader

class simkit.contrib.readers.HDF5Reader(parameters, meta=None)[source]

Reads data from an HDF5 file

is_file_reader = True

True if reader accepts filename argument

load_data(h5file, *args, **kwargs)[source]

Collects positional and keyword arguments into data and applies units.

Returns

data