Spectra tool-kit#
This module offers several facilities for extracting, manipulating and visualizing the spectral data contained in the RESOURCECODE database.
- resourcecode.spectrum.download_data.get_1D_spectrum(point: str, years: Iterable[str], months: Iterable[str]) Dataset #
Download the 1D spectrum times-series data from IFREMER ftp
- Parameters:
point (location name (string) requested.) – The consistency is checked internally.
years (years (list of string) requested.) – The consistency is checked internally.
months (the month numbers (list of string), with trailing zeros.)
- Returns:
A dataset object with the spectral data read from the downloaded netCDF file.
- Return type:
xarray.DataArray
- resourcecode.spectrum.download_data.get_2D_spectrum(point: str, years: Iterable[str], months: Iterable[str]) Dataset #
Download the 2D spectrum times-series data from IFREMER ftp
- Parameters:
point (location name (string) requested.) – The consistency is checked internally.
years (years (list of string) requested.) – The consistency is checked internally.
months (the month numbers (list of string), with trailing zeros.)
- Returns:
A dataset object with the spectral data read from the downloaded netCDF file.
- Return type:
xarray.DataArray
- resourcecode.spectrum.compute_parameters.compute_parameters_from_1D_spectrum(spectrumDataSet: Dataset, use_depth: bool = True) DataFrame #
Compute Sea-States parameters from 1D spectrum time series
- Parameters:
spectrumDataSet – the spectrum data (as obtained from spec.get_1D_spectrum): a DataSet with time series of spectrum
use_depth (boolean) – if True, the ‘dpt’ field is used to compute dispersion relation. Otherwise, infinite depth is assumed.
- Returns:
A DataArray with Sea-States parameters
- Return type:
xarray.DataArray
- resourcecode.spectrum.compute_parameters.compute_parameters_from_2D_spectrum(spectrumDataSet: Dataset, use_depth: bool = True) DataFrame #
Compute Sea-States parameters from 2D spectrum time series
- Parameters:
spectrumDataSet – the spectrum data (as obtained from spec.get_2D_spectrum): a DataSet with time series of spectrum
use_depth (boolean) – if True, the ‘dpt’ field is used to compute dispersion relation. Otherwise, infinite depth is assumed.
- Returns:
A DataArray with Sea-States parameters
- Return type:
xarray.DataArray
- resourcecode.spectrum.convert_spectrum_2Dto1D(spectrumDataSet: Dataset) Dataset #
Converts a 2D spectrum time series to a 1D spectrum
- Parameters:
spectrumDataSet – the spectrum data (as obtained from spec.get_2D_spectrum): a DataSet with time series of spectrum
- Returns:
xarray.Dataset with 1D spectrum
- Return type:
spectrum_1D