geodezyx.marine package

Submodules

geodezyx.marine.marine module

@author: psakic

This sub-module of geodezyx.marine contains functions to interpolate GEBCO bathymetry.

it can be imported directly with: from geodezyx import marine

The GeodeZYX Toolbox is a software for simple but useful functions for Geodesy and Geophysics under the GNU LGPL v3 License

Copyright (C) 2019 Pierre Sakic et al. (IPGP, sakic@ipgp.fr) GitHub repository : https://github.com/GeodeZYX/geodezyx-toolbox

geodezyx.marine.marine.gebco_bathy_grid_extractor(dataset, latmin, latmax, lonmin, lonmax)

for safety reasons, lat and lon input MUST BE in the dataset, replaced by the closest elsewhere

return latnew , lonnew , Znew

geodezyx.marine.obp module

Created on Sat Aug 5 21:08:05 2023

@author: psakic

This module regroups the functions for the exploitation of the A0A pressure sensors in the context of the REVOSIMA network

It is based on the work of Yann Terden Tranchant

geodezyx.marine.obp.butter_bandpass(lowcut, highcut, fs, order=3)
geodezyx.marine.obp.butter_bandpass_filtfilt(data, lowcut, highcut, fs, order=4)
geodezyx.marine.obp.butter_highpass(cutoff, fs, order=5)
geodezyx.marine.obp.butter_highpass_filtfilt(data, cutoff, fs, order=4)
geodezyx.marine.obp.butter_lowpass(cutoff, fs, order=5)
geodezyx.marine.obp.butter_lowpass_filtfilt(data, cutoff, fs, order=4)
geodezyx.marine.obp.butterworth(df, t0=259200, t1=864000, kind='bandpass', order=4)
geodezyx.marine.obp.compute_dens_profile(profile)
geodezyx.marine.obp.compute_phibot(profile, ssh=None, integration='forward', rho=10.35, remove_median=True)

phibot = Ocean hydrostatic bottom pressure anomaly https://cmr.earthdata.nasa.gov/search/concepts/V2028471168-POCLOUD.html

PHIBOT Bottom Pressure Pot. Anomaly (p/rhonil, m^2/s^2)

To convert to m, divide by g (g=9.81 m/s^2) PHIBOT is the anomaly relative to Depth * rhonil * g The absolute bottom pressure in Pa is: Depth * rhonil * g + PHIBOT * rhonil (rhonil=1027.5 kg/m^3)

http://apdrc.soest.hawaii.edu/doc/Readme_ecco2_cube92

geodezyx.marine.obp.compute_spectrogram(df, max_period=45, nchunks=21600)
geodezyx.marine.obp.compute_steric(profile, integration='forward')
geodezyx.marine.obp.exp(x, a, b, c, d, **kwargs)
geodezyx.marine.obp.exp_linear(x, a, b, c, d, **kwargs)
geodezyx.marine.obp.extract_profile(ds, x, y, method='linear', zbottom=None)
geodezyx.marine.obp.fit_model(data, t_fit, model='log_linear', offset_last=True, maxfev=1000, pn=2)
geodezyx.marine.obp.get_bottom_depth(ds)
geodezyx.marine.obp.interp_time(ds, time, method='linear')
geodezyx.marine.obp.interp_xy(ds, x=None, y=None, method='linear')

frontend for xarray spatial interpolation

Parameters:
  • ds (xarray) – input xarray grid.

  • x (float, optional) – longitude in deg (but depends on ds units). The default is None.

  • y (float, optional) – latitude in deg (but depends on ds units). The default is None.

  • method (str, optional) – interpolation method. The default is ‘linear’.

Returns:

Interpolated values.

Return type:

ds

geodezyx.marine.obp.interp_z(ds, depth, method='linear')
geodezyx.marine.obp.linear(x, A1, A2, A3, A4, **kwargs)
geodezyx.marine.obp.log(x, A1, A2, A3, **kwargs)
geodezyx.marine.obp.log_linear(x, A1, A2, A3, A4, **kwargs)
geodezyx.marine.obp.read_duacs(file)
geodezyx.marine.obp.read_ecco2(file)
geodezyx.marine.obp.read_glorys(file)
geodezyx.marine.obp.read_hycom(file)

geodezyx.marine.obscom module

Created on Thu Nov 17 17:41:32 2022

@author: psakic

This module regroups the functions for the resolution estimation of the REVOSIMA’s OBSCOM-embeded pressure sensor

geodezyx.marine.obscom.counter2freq(n_counted_by_clk, count_sensor, freq_clk, integ_timespan=1, out='freq')

Convert count number to sensor frequency

Parameters:
  • n_counted_by_clk (int or float) – number of counts counted by the sensor.

  • count_sensor (int or float) – number of clock periods counted for one sensor count

  • freq_clk (int or float) – primary frequency of the clock that count period.

  • integ_timespan (int or float, optional) – integration timespan in seconds. The default is 1.

  • out (str, optional) – output ‘freq’ for freqency or ‘tau’ for period (=1/frequency). The default is ‘freq’.

Returns:

freqency (‘freq’) or period (‘tau’) of the sensor

Return type:

float

Note

usually, count_sensor=30e3 for pressure, count_sensor=168e3 for temperature and freq_clk=4.096e6

geodezyx.marine.obscom.freq2U(ft_in, U0)

Convert temperature sensor frequency to coefficient U

Parameters:
  • ft_in (float) – frequency of the temperature sensor in Hertz.

  • U0 (float) – input coefficient U0.

Returns:

coefficient U.

Return type:

float

geodezyx.marine.obscom.freq2counter(freq_or_tau_sensor, count_sensor, freq_or_tau_clk, integ_timespan=1, inp='freq', round_fct=<ufunc 'floor'>)

Convert sensor frequency to count number

Parameters:
  • freq_or_tau_sensor – freqency (‘freq’) or period (‘tau’) of the sensor.

  • count_sensor (int or float) – number of clock periods counted for one sensor count

  • freq_or_tau_clk – primary frequency/period of the clock that count period..

  • integ_timespan (int or float, optional) – integration timespan in seconds. The default is 1.

  • inp (str, optional) – input ‘freq’ for freqency or ‘tau’ for period (=1/frequency). The default is ‘freq’.

  • round_fct (function, optional) – the function that round the count values. The default is np.floor.

Returns:

number of counts counted by the sensor..

Return type:

n_count

Note

usually, count_sensor=30e3 for pressure, count_sensor=168e3 for temperature and freq_clk=4.096e6

geodezyx.marine.obscom.freq2pres(fp_in, t_or_ft_in, C1, C2, C3, D1, D2, U0, Y1, Y2, Y3, T1, T2, T3, T4, T5, out='psi', inp_temp='temp')

Convert pressure sensor frequency to pressure or equivalent distance

Parameters:
  • fp_in – frequency of the pressure sensor in Hertz.

  • t_or_ft_in (float) – temperature in Celsius or temperature sensor frequency in Hertz. depends on inp_temp

  • D2 (C1 C2 C3 D1) – Calibration coefficients provided by PAROS.

  • U0 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • Y1 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • Y2 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • Y3 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • T1 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • T2 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • T3 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • T4 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • T5 (float) – Calibration coefficients provided by PAROS for the temperature sensor.

  • out (str, optional) – output as pressure (‘psi’, ‘bar’, ‘mbar’, ‘pa’) or distance (‘meter’). The default is “psi”.

  • inp_temp (str) – ‘freq’ temperature sensor frequency in Hertz, ‘temp’ temperature in Celsius, default is ‘temp’

Returns:

pressure or equivalent distance.

Return type:

float

Note

Using temperature as input is unstable because of the root finding of U frequency as input is recommended

geodezyx.marine.obscom.freq2pres_old(f, U, F0, C1=-22682.65, C2=-1143.743, C3=70903.62, D1=0.040903, D2=0.0)

freqence capteur pression > pression OLD version

geodezyx.marine.obscom.freq2temp(ft_in, U0, Y1, Y2, Y3)

Convert temperature sensor frequency to temperature

Parameters:
  • ft_in – frequency of the temperature sensor in Hertz.

  • U0 (float) – Calibration coefficients provided by PAROS.

  • Y1-3 (float) – Calibration coefficients provided by PAROS.

Returns:

temperature in Celsius.

Return type:

float

geodezyx.marine.obscom.get_coeffs(sens_type='all', sens_id=158073)
geodezyx.marine.obscom.import_presure_df(csv_pres_inp, dic_coeffs, freq_clk=4096000.0, count_sensor_temp=168000.0, count_sensor_pres=30000.0, integ_timespan_temp=10, integ_timespan_pres=100, epoc_idx=True, out_pres='pa')
geodezyx.marine.obscom.pres2freq(p_in, t_in, C1, C2, C3, D1, D2, U0, Y1, Y2, Y3, T1, T2, T3, T4, T5, inp='psi', return_optimize_object=False)

Convert pressure to pressure sensor frequency

There is no analytic solution, thus an root find is required

Parameters:
  • p_in – pressure in psi.

  • t_in – temperature in Celsius.

  • inp (optional) – input for p_in as pressure (‘psi’, ‘bar’, ‘mbar’, ‘pa’) or distance (‘meter’). The default is ‘psi’.

  • return_optimize_object (bool, optional) – if True, return the object of scipy’s optimize.root function. if False, return the root value The default is False.

Returns:

pressure sensor frequency (Hertz).

Return type:

float

geodezyx.marine.obscom.pres_resolution(val_presin, val_temp_in, val_clkin, count_presin, count_temp_in, input_val='freq', output_val='meter', relative_delta=True)
geodezyx.marine.obscom.resolution_grid_compute(Tau_pres, Tau_temp, fe, count_pres, count_temp, output_val='meter', relative_delta=False)
geodezyx.marine.obscom.resolution_plot_as_gradient_grid(PresVals, TempVals, ResVals, temp_ref, freq_input=False, coef_res=1000, relative_delta=False)
geodezyx.marine.obscom.temp2freq(t_in, U0, Y1, Y2, Y3, out='freq', force_root=False)

Convert temperature to temperature sensor frequency

Parameters:
  • t_in – temperature in Celsius.

  • U0 (float, optional) – Calibration coefficients provided by PAROS.

  • Y1-3 (float, optional) – Calibration coefficients provided by PAROS.

  • out (float, optional) – freqency (‘freq’) or period (‘tau’) or coefficient U (‘U’) of the sensor. The default is ‘freq’.

  • force_root (bool or int) – force the finded root for U if integer (1 or 2), use the first or second root default is False

Returns:

temperature sensor frequency or period.

Return type:

float

Note

This function is unstable because of the root finding

You can force it with force_root

geodezyx.marine.obscom.temp2freq_legacy(T, U0, Y, output='freq')
geodezyx.marine.obscom.temp2freq_old(T, out='freq')

temperature > frequence du capteur de temperature (output == “freq”) OU coef U (output == “U”) OU periode du capteur U (output == “tau”)

geodezyx.marine.obscom.unitary_tests(sens_id=158073)

return the correct values for pressure/temperature and intermediates parameters @ ftemp=172600.0 Hz and fpres=36300.0 Hz with the cofficients of the sensor #158073 (1st OBSCOM)

Return type:

ftemp (Hz), fpres (Hz), temp (°C), f0 (Hz), p (psi)