ftool: Some useful tools for use with PyFEHM

Various tools for use with PyFEHM.

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

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.latlong_to_UTM(lat, long)

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)

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”.
ftool.SI(quantity, unit=None)

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.dict_key_check(dict, keys, dict_name)

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

ftool.flatten(l)

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)

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.cubes_intersect(cube1, cube2)

Returns True if two cubes intersect.

This Page