model.vma

Implementation of the Variable Meta-Analysis module.

def convert_percentages(val):

pd.apply() functions to convert percentages

def convert_NaN(val):

pd.apply() functions to convert NaN

def normalize_units(val):
class VMA:

Meta-analysis of multiple data sources to a summary result.

VMA( filename, title=None, low_sd=1.0, high_sd=1.0, discard_multiplier=3, stat_correction=None, use_weight=False, bound_correction=None, description=None, units=None)

Arguments: filename: (string, pathlib.Path, or io.StringIO) Can be either

  • Path to a CSV file containing data sources. The CSV file must contain columns named "Raw Data Input", "Weight", and "Original Units". It can contain additional columns, which will be ignored.
  • io.StringIO objects are processed as if they are opened CSV files title: string, name of the VMA to extract from an Excel file. This value is unused if filename is a CSV. Will raise an AssertionError if the title is not available in the Excel file. low_sd: number of multiples of the stddev to use for the low result. high_sd: number of multiples of the stddev to use for the high result. discard_multiplier: discard outlier values more than this many multiples of the stddev away from the mean. stat_correction: discard outliers more than discard_multiplier stddev away from the mean. use_weight: if true, use weights provided with the VMA to bias the mean. bound_correction: if true, and the low value calculated with standard deviation would be negative, use min instead of sd on on the lower value. description: optional description of what this VMA describes units: the units to use for this VMA; retrieved from datafile by default
df: pandas.core.frame.DataFrame = None

The source data for this VMA.

def avg_high_low( self, key=None, regime=None, region=None, low_sd=None, high_sd=None, discard_multiplier=None, stat_correction=None, use_weight=None, bound_correction=None):
Args
  • key: (optional) specify 'mean', 'high' or 'low' to get single value
  • regime: string name of the thermal moisture regime to select sources for.
  • region: string name of the world region to select sources for.
  • Other parameters: explicitly override the default parameters for this VMA.
Returns

By default returns (mean, high, low) using low_sd/high_sd. If key is specified will return associated value only

def write_to_file(self, new_df):
def reload_from_file(self):
def essential_parameters(self):

Return a dictionary of "essential" parameters, that is parameters whose value differs from the default

def load_vma_directory(cls, directoryfile):

Load and return an array of VMAs that are defined in a directory json-file

def write_vma_directory(cls, vmacollection, directory):

Write out the directory file for this collection of VMAs. The directory file will only have entries for VMAs that have files _in this directory_. Global VMAs, if present, will be omitted (and a warning will be issued).