ftool: Some useful tools for use with PyFEHM

Various tools for use with PyFEHM.

ftool.SI(quantity, unit=None)[source]

Returns an SI measurement corresponding to a supplied non standard unit, e.g., ‘31.6 gpm’. Output reverts to FEHM format, e.g., pressures and stresses quoted in MPa.

Parameters:
  • quanityt – Number with unit. If a float or list of floats provided, then unit must
  • unit (str) – Flag indicating unit of float supplied in quantity.
Returns:

Quantity in SI units.

ftool.UTM_to_latlong(x, y, zone, hemisphere=1)[source]

Return latitude and longitude corresponding to supplied UTM (Universal Transverse Mercator) coordinates.

Parameters:
  • x (fl64) – Easting inside of zone.
  • y (fl64) – Northing inside of zone.
  • zone (int) – UTM zone (integer between 1 and 60).
  • hemisphere (bool) – Integer denoting hemisphere, 1 = northern, -1 = southern.
Returns:

Two column list of latitudes and longitudes.

ftool.cubes_intersect(cube1, cube2)[source]

Returns True if two cubes intersect.

ftool.dict_key_check(dict, keys, dict_name)[source]

Return False if dict contains only the supplied keys and no extras.

ftool.flatten(l)[source]

Takes a nested list and returns a flattened list (upon list conversion of output). :param l: Nested list. :type l: lst

ftool.in_cube(pos, cube)[source]

Tests if the 3-D point lies in an axis-aligned cube, defined as a two-element list of arrays [bottom left front, top right back].

ftool.latlong_to_UTM(lat, long)[source]

Return UTM easting, northing, zone number and hemisphere corresponding to supplied latitude and longitude.

Parameters:
  • lat (fl64) – Latitude, in deceimal degrees.
  • long (fl64) – Longitude, in decimal degrees.
Returns:

Four column list of UTM easting, northing, zone and hemisphere (1 = northern, -1 = southern).

ftool.powspace(x0, x1, N=10, power=1)[source]

Returns a sequence of numbers spaced according to the power law (x1-x0)**(1-power)*linspace(0,(x1-x0),N)**base + x0

Parameters:
  • x0 (fl64) – First number in sequence.
  • x1 (fl64) – Last number in sequence.
  • N (int) – Total items in sequence.
  • power (fl64) – Index of power law. If negative, spacing order will be reversed from “big-to-small”.