hazimp.calcs.calcs

Calculations

Module Contents

Classes

Calculator

Abstract Calculator class. Should use abc then.

MultiplyTest

Simple test class, multiplying args.

MultipleValuesTest

Simple test class, returning two values.

ConstantTest

Simple test class, returning two values.

Add

Simple test class, adding args together.

CalcLoss

Multiply the structural and the structural_value to calc

CalcFloorInundation

Calculate the water depth above ground floor;

Attributes

STRUCT_LOSS

FLOOR_HEIGHT_CALC

WATER_DEPTH

FLOOR_HEIGHT

FLOOD_X_AXIS

CALCS

hazimp.calcs.calcs.STRUCT_LOSS = structural_loss
hazimp.calcs.calcs.FLOOR_HEIGHT_CALC = floor_height
hazimp.calcs.calcs.WATER_DEPTH = water_depth
hazimp.calcs.calcs.FLOOR_HEIGHT = floor_height_(m)
hazimp.calcs.calcs.FLOOD_X_AXIS = water depth above ground floor (m)
class hazimp.calcs.calcs.Calculator

Bases: hazimp.jobs.jobs.Job

Abstract Calculator class. Should use abc then.

calc(self)

The actual calculation.

Note, the returned value is a LIST. This is done so multiple values can be returned.

__call__(self, context, **kwargs)

This calls calc, passing in context.exposure_att and **kwargs.

class hazimp.calcs.calcs.MultiplyTest

Bases: Calculator

Simple test class, multiplying args.

calc(self, a_test, c_test)

Multiply values element-wise :param a_test: an array of values :param c_test: an array of values :return: the product of a_test and c_test, elementwise.

class hazimp.calcs.calcs.MultipleValuesTest

Bases: Calculator

Simple test class, returning two values.

calc(self, a_test, b_test)

Testing how two values could be returned.

Parameters:
  • a_test

  • b_test

Returns:

class hazimp.calcs.calcs.ConstantTest

Bases: Calculator

Simple test class, returning two values. A Constant class to use is in the jobs file

calc(self, constant=None)

Testing returning a constant value, multiplied by two.

Parameters:

constant

Returns:

class hazimp.calcs.calcs.Add

Bases: Calculator

Simple test class, adding args together.

Note, jobs has a general adding method.

calc(self, a_val, b_val)

Add a_test and b_test.

Parameters:
  • a_val – Can be a number or a string.

  • b_val – Can be a number or a string.

Returns:

Return the sum of a_test and b_test.

class hazimp.calcs.calcs.CalcLoss

Bases: Calculator

Multiply the structural and the structural_value to calc the structural_loss.

calc(self, structural, structural_value)

Calculate the structural loss, given the structural value and the loss ratio.

Parameters:
  • structural – Structural loss ratio

  • structural_value – Structural value (in dollar terms)

Returns:

The structural loss in dollar terms

class hazimp.calcs.calcs.CalcFloorInundation

Bases: Calculator

Calculate the water depth above ground floor; water depth(m) - floor height(m) = water depth above ground floor(m)

calc(self, water_depth, floor_height)

Note the water depth and floor height have to have the same datum. e.g. above ground or Australian Height Datum

Parameters:
  • water_depth – water depth (m)

  • floor_height – floor height (m)

Returns:

water depth above ground floor (m)

hazimp.calcs.calcs.CALCS