Return the pressure in the specified units.
345621
def value(self, units=None):
        """"""
        if units is None:
            return self._value

        if not units.upper() in CustomPressure.legal_units:
            raise UnitsError("unrecognized pressure unit: '" + units + "'")
        units = units.upper()
        if units == self._units:
            return self._value
        if self._units == "IN":
            mb_value = self._value * 33.86398
        elif self._units == "MM":
            mb_value = self._value * 1.3332239
        else:
            mb_value = self._value
        if units in ("MB", "HPA"):
            return mb_value
        if units == "IN":
            return mb_value / 33.86398
        if units == "MM":
            return mb_value / 1.3332239

        raise UnitsError("unrecognized pressure unit: '" + units + "'")
1325135
def unitResponse(self,band):
        """"""
        wave=band.wave
        total = band.trapezoidIntegration(wave,band.throughput/wave)
        modtot = total * (1.0e-29/H)
        return 1.0/modtot
367475
def _water(cls, T, P):
        """"""
        water = IAPWS95(P=P, T=T)
        prop = {}
        prop["g"] = water.h-T*water.s
        prop["gt"] = -water.s
        prop["gp"] = 1./water.rho
        prop["gtt"] = -water.cp/T
        prop["gtp"] = water.betas*water.cp/T
        prop["gpp"] = -1e6/(water.rho*water.w)**2-water.betas**2*1e3*water.cp/T
        prop["gs"] = 0
        prop["gsp"] = 0
        prop["thcond"] = water.k
        return prop
222751
def _force(self,z,t=0.):
        
        return self._Pot.zforce(self._R,z,phi=self._phi,t=t,use_physical=False)\
            -self._Pot.zforce(self._R,0.,phi=self._phi,t=t,use_physical=False)
1126331
def temp_unit(self):
        """"""
        if CONST.UNIT_FAHRENHEIT in self._get_status(CONST.TEMP_STATUS_KEY):
            return CONST.UNIT_FAHRENHEIT
        elif CONST.UNIT_CELSIUS in self._get_status(CONST.TEMP_STATUS_KEY):
            return CONST.UNIT_CELSIUS
        return None
178410
def _handlePressure(self, d):
        
        press = d['press']
        if press != '////':
            press = float(press.replace('O', '0'))
            if d['unit']:
                if d['unit'] == 'A' or (d['unit2'] and d['unit2'] == 'INS'):
                    self.press = CustomPressure(press / 100, 'IN')
                elif d['unit'] == 'SLP':
                    if press < 500:
                        press = press / 10 + 1000
                    else:
                        press = press / 10 + 900
                    self.press = CustomPressure(press)
                    self._remarks.append("sea-level pressure %.1fhPa" % press)
                else:
                    self.press = CustomPressure(press)
            elif press > 2500:
                self.press = CustomPressure(press / 100, 'IN')
            else:
                self.press = CustomPressure(press)
760204
def string(self, units: typing.Optional[str] = None) -> str:
        """"""
        if not units:
            _units: str = self._units
        else:
            if not units.upper() in CustomPressure.legal_units:
                raise UnitsError("unrecognized pressure unit: '" + units + "'")
            _units = units.upper()
        val = self.value(units)
        if _units == "MB":
            return "%.0f mb" % val
        if _units == "HPA":
            return "%.0f hPa" % val
        if _units == "IN":
            return "%.2f inches" % val
        if _units == "MM":
            return "%.0f mmHg" % val

        raise ValueError(_units)
652774
def get_units(unit, binary=False):
    ''' 
    '''
    result = None

    if unit == 'b':
        result = 1, 'Byte'

    elif binary:    # 2^X
        if   unit == 'k':
            result = 1024, 'Kibibyte'
        elif unit == 'm':
            result = 1048576, 'Mebibyte'
        elif unit == 'g':
            if opts.precision == -1:
                opts.precision = 3
            result = 1073741824, 'Gibibyte'
        elif unit == 't':
            if opts.precision == -1:
                opts.precision = 3
            result = 1099511627776, 'Tebibyte'

    else:           #  10^x
        if   unit == 'k':
            result = 1000, 'Kilobyte'
        elif unit == 'm':
            result = 1000000, 'Megabyte'
        elif unit == 'g':
            if opts.precision == -1:
                opts.precision = 3      # new defaults
            result = 1000000000, 'Gigabyte'
        elif unit == 't':
            if opts.precision == -1:
                opts.precision = 3
            result = 1000000000000, 'Terabyte'

    if not result:
        print(f'Warning: incorrect parameter: {unit}.')
        result = _outunit

    if opts.precision == -1:  # auto
        opts.precision = 0
    return result
312335
def stress_vert(self, depth_within=0, effective=False):
        """"""
        assert depth_within <= self.thickness
        stress_vert = self._stress_vert + depth_within * self.unit_wt
        if effective:
            pore_pressure = self._profile.pore_pressure(self.depth +
                                                        depth_within)
            stress_vert -= pore_pressure
        return stress_vert
147764
def pressure_series(self):
        
        return [(tstamp, \
                self._station_history.get_measurements()[tstamp]['pressure']) \
                for tstamp in self._station_history.get_measurements()]
1337585
def read_units(self, fid):
        """"""
        lin = self.read_line(fid)                   
        while lin[0] != ':':
            parts = lin.split()
            if parts[0]=='mass':
                self.mass = float(parts[1])
            elif parts[0]=='length':
                self.length = float(parts[1])
            elif parts[0]=='angle':
                self.angle = parts[1]
            lin = self.read_line(fid)
        return lin
916996
def get_pressure(self):
        

        self._init_pressure()  # Ensure pressure sensor is initialised
        pressure = 0
        data = self._pressure.pressureRead()
        if (data[0]):  # Pressure valid
            pressure = data[1]
        return pressure
1278230
def scan_pressures(cryst, lo, hi, n=5, eos=None):
    '''
    
    '''
    # Inverse B-M EOS to get volumes from pressures
    # This will work only in limited pressure range p>-B/B'.
    # Warning! Relative, the V0 prefactor is removed.
    def invbmeos(b, bp, x):
        return array([pow(b/(bp*xv+b), 1/(3*bp)) for xv in x])

    if eos is None:
        raise RuntimeError('Required EOS data missing')

    # Limit negative pressures to 90% of the singularity value.
    # Beyond this B-M EOS is bound to be wrong anyway.
    lo = max(lo, -0.9*eos[1]/eos[2])

    scale = (eos[0]/cryst.get_volume())*invbmeos(eos[1], eos[2],
                                                 linspace(lo, hi, num=n))
    # print(scale)
    uc = cryst.get_cell()
    systems = [Atoms(cryst) for s in scale]
    for n, s in enumerate(scale):
        systems[n].set_cell(s*uc, scale_atoms=True)

    return systems
1140499
def unit_vector(x):
    """"""
    y = np.array(x, dtype='float')
    return y/norm(y)
263034
def get_inches(self):
    '''  '''
    if self._obs_value in self.MISSING:
      return 'MISSING'
    if self._obs_units == self.MILLIMETERS:
      return round(self.INCH_CONVERSION_FACTOR * self._obs_value, 4)
1116510
def get(self):
        
        if self.num_inst == 0:
            return (self.name, float('nan'))
        else:
            return (self.name, self.sum_metric / self.num_inst)
766300
def re_pipe(FlowRate, Diam, Nu):
    """"""
    #Checking input validity
    ut.check_range([FlowRate, ">0", "Flow rate"], [Diam, ">0", "Diameter"],
                   [Nu, ">0", "Nu"])
    return (4 * FlowRate) / (np.pi * Diam * Nu)