2.3.12.2. vacumm.misc.phys.units – Units

2.3.12.2.2. Content

Unit conversions

kt2ms(nd)[source]

Convert nds to m/s

ms2kt(ms)[source]

Convert m/s to nds

deg2m(degrees, lat=None)[source]

Convert a distance in degrees to meters

  • degrees: Distance in degrees
  • lat: optional latitude, defaults to 0.

Return: Distance in meters

See also

m2deg()

m2deg(meters, lat=None)[source]

Convert a distance in meters to degrees

  • meters: Distance in meters
  • lat: optional latitude, defaults to 0.

Return: Distance in degrees

See also

deg2m()

ms2bf(ms)[source]

Convert from m/s to Beauforts (wind)

  • ms: Wind speed in m/s.
dms2deg(d, m=0, s=0)[source]

Convert from degrees/minutes/seconds to degrees

  • d: degrees
  • m: minutes [default: 0]
  • s: seconds [default: 0]

See also

deg2dms()

deg2dms(deg)[source]

Convert from degrees to degrees/minutes/seconds

  • deg: degrees

See also

dms2deg()

mph2ms(mph)[source]

Convert from mph to m/s

ms2mph(ms)[source]

Convert from m/s to mph

tometric(units, value=1.0, munits=['m', 'm/s'])[source]

Try to convert units to metric system using udunits

Return:a float or None if conversion failed.
kel2degc(tk)[source]

Convert from degrees Kelvin to degrees Celsius

  • tk: Temperature in Kelvin.
degc2kel(dc)[source]

Convert from degrees Celsius to degrees Kelvin

  • dc: Temperature in degrees Celsius.
convert_units(value, oldunits, newunits)

Change units using unidata units connverter

basic_proj(lon, lat, inverse=False)[source]

Convert a position from degrees to meters like a geographic projection

Params:
  • lon: Longitude in degrees or meters.
  • lat: Latitude in degrees or meters.
  • inverse, optional: Invert the projection from meters to degrees.
uuconvert(value, oldunits, newunits)[source]

Change units using unidata units connverter

rad2deg(r)[source]
deg2rad(d)[source]
vect2mod(u, v)[source]
vect2dir(u, v)[source]
vect2moddir(u, v)[source]
moddir2vectx(m, d)[source]
moddir2vecty(m, d)[source]
moddir2vectxy(m, d)[source]
strfsize(size, fmt=None, si=None)[source]

Format a size in bytes using the appropriate unit multiplicator (Ko, Mo, Kio, Mio)

Params:
  • size: the size in bytes
  • fmt: the format to use, will receive the size and the unit as format arguments
    (None will automatically use “%.3f %s” or “%d %s”)
  • si: whether to use International System units (10^3, …) or not (2**10, …)
Return:

a string

strpsize(size, si=True)[source]

Parse a size in Ko, Mo, Kio, Mio, …

Params:
  • size: the size string
  • si: whether to use International System units (10^3, …) or not (2**10, …)
Return:

the float number of bytes

uuconvert(value, oldunits, newunits)[source]

Change units using unidata units connverter