Пример #1
0
def tempgradient(depth, latitude, temperature, salinity) -> np.ndarray:
    """
    Calculates the adiabatic temp gradient of sea water.

    Required Arguments:
        * depth: Depth in meters
        * latitude: Latitude in degrees North
        * temperature: Temperatures in Celsius
        * salinity: Salinity
    """

    depth, latitude, temperature, salinity = __validate_depth_lat_temp_sal(
        depth, latitude, temperature, salinity)

    press = __calc_pressure(depth, latitude)

    tempgradient = seawater.adtg(salinity, temperature, press)
    return np.array(tempgradient)
Пример #2
0
iws.make_metadata_file()
iws.run(coords=coords)

#Mapping Sound Profile onto IW Field
try:
    T = mprof['T']
    S = mprof['S']

except KeyError:
    print("No scalars to map")
    exit(0)

#Compute interpolation and potential derivative of T&S
tprof = interp.UnivariateSpline(mprof['depth'], mprof['T'])
adtg = interp.UnivariateSpline(mprof['depth'],
                               sw.adtg(mprof['S'], mprof['T'], mprof['depth']))
sprof = interp.UnivariateSpline(mprof['depth'], mprof['S'])
sg = sprof.derivative()

cprof = interp.UnivariateSpline(
    mprof['depth'], sw.svel(mprof['S'], mprof['T'], mprof['depth']))

#Maps displacment to anomaly
mat = functools.partial(map_anom, mean=tprof, grad=adtg)
mas = functools.partial(map_anom, mean=sprof, grad=sg)
mac = functools.partial(map_svel, func=sw.svel)
maca = functools.partial(map_svel_anom, func=cprof)

map_scalars(p['path'], 'T', mat)
map_scalars(p['path'], 'S', mas)
map_scalars(p['path'], 'c', mac)