swvo.io.RBMDataSet.utils#

Functions

cart2pol(x, y)

transforms cartesian coordinates x, y to polar coordinates theta (in rad) and radius

get_file_path_any_format(folder_path, ...)

Get the file path for a given file stem and preferred extension.

join_var(var1, var2)

Join two variables along the first axis.

load_file_any_format(file_path)

Load a file in any supported format and return its content.

matlab2python(datenum)

Convert MATLAB datenum to Python datetime.

pol2cart(theta, radius)

transforms polar coordinates theta (in rad) and radius to cartesian coordinates x, y

python2matlab(datenum)

Convert Python datetime to MATLAB datenum.

read_all_datasets_netcdf(file_path)

Reads all datasets (variables) from a NetCDF file, including those in groups.

round_seconds(obj)

Round datetime object to the nearest second.

swvo.io.RBMDataSet.utils.join_var(var1: ndarray[tuple[Any, ...], dtype[generic]], var2: ndarray[tuple[Any, ...], dtype[generic]]) ndarray[tuple[Any, ...], dtype[generic]][source]#

Join two variables along the first axis.

swvo.io.RBMDataSet.utils.get_file_path_any_format(folder_path: Path, file_stem: str, preferred_ext: str, nc_mode: bool) Path | None[source]#

Get the file path for a given file stem and preferred extension.

swvo.io.RBMDataSet.utils.read_all_datasets_netcdf(file_path: str | Path) dict[str, Any][source]#

Reads all datasets (variables) from a NetCDF file, including those in groups.

This function recursively traverses all groups and variables in a NetCDF-4 file and stores their data in a dictionary. The key for each dataset is its full hierarchical path.

Parameters:

file_path (str | Path) – The path to the NetCDF file.

Returns:

A dictionary where keys are the full variable paths

and values are the corresponding NumPy arrays.

Return type:

Dict[str, Any]

swvo.io.RBMDataSet.utils.load_file_any_format(file_path: Path) dict[str, Any][source]#

Load a file in any supported format and return its content.

swvo.io.RBMDataSet.utils.round_seconds(obj: datetime) datetime[source]#

Round datetime object to the nearest second.

swvo.io.RBMDataSet.utils.python2matlab(datenum: datetime) float[source]#

Convert Python datetime to MATLAB datenum.

swvo.io.RBMDataSet.utils.matlab2python(datenum: float | Iterable[float]) Iterable[datetime] | datetime[source]#

Convert MATLAB datenum to Python datetime.

swvo.io.RBMDataSet.utils.pol2cart(theta: ndarray[tuple[Any, ...], dtype[float64]], radius: ndarray[tuple[Any, ...], dtype[float64]]) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]#

transforms polar coordinates theta (in rad) and radius to cartesian coordinates x, y

swvo.io.RBMDataSet.utils.cart2pol(x: ndarray[tuple[Any, ...], dtype[float64]], y: ndarray[tuple[Any, ...], dtype[float64]]) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]#

transforms cartesian coordinates x, y to polar coordinates theta (in rad) and radius