pyteseo.io

Input and Output functionality for specific TESEO file formats

Module Contents

Functions

read_grid(→ pandas.DataFrame)

Read TESEO grid-file to pandas DataFrame

read_coastline(→ pandas.DataFrame)

Read TESEO coastline-file to pandas DataFrame

write_grid(→ None)

Write TESEO grid-file

write_coastline(→ None)

Write TESEO coastline and polygons files

read_currents(→ Tuple[pandas.DataFrame, float, float])

Read TESEO currents-files (2dh: [lon, lat, u, v])

read_winds(→ Tuple[pandas.DataFrame, float, float])

Read TESEO winds-files (2dh: [lon, lat, u, v])

write_currents(dir_path)

write_winds(dir_path)

pyteseo.io.read_grid(path: str | PosixPath, nan_value: int | float = - 999) pandas.DataFrame

Read TESEO grid-file to pandas DataFrame

Parameters
  • path (str | PosixPath) – path to the grid-file

  • nan_value (float | int, optional) – value to set nans. Defaults to -999.

Returns

DataFrame with TESEO grid data [lon, lat, depth]

Return type

pd.DataFrame

pyteseo.io.read_coastline(path: str | PosixPath) pandas.DataFrame

Read TESEO coastline-file to pandas DataFrame

Parameters

path (str | PosixPath) – path to the coastline-file

Returns

DataFrame with TESEO coastline data [lon, lat]

Return type

pd.DataFrame

pyteseo.io.write_grid(df: pandas.DataFrame, path: str | PosixPath, nan_value: int | float = - 999) None

Write TESEO grid-file

Parameters
  • df (pd.DataFrame) – DataFrame with columns ‘lon’, ‘lat’, ‘depth’ (lon:[-180,180], lat:[-90,90])

  • path (str | PosixPath) – path to the new grid-file

  • nan_value (int | float, optional) – define how will be writted nan values in the grid-file. Defaults to -999.

pyteseo.io.write_coastline(df: pandas.DataFrame, path: str | PosixPath) None

Write TESEO coastline and polygons files

Parameters
  • df (pd.DataFrame) – DataFrame with columns ‘lon’, ‘lat’ and polygons separated by nan lines (lon:[-180,180], lat:[-90,90])

  • path (str | PosixPath) – path to the new coastline-file

pyteseo.io.read_currents(path: str | PosixPath) Tuple[pandas.DataFrame, float, float]

Read TESEO currents-files (2dh: [lon, lat, u, v])

Parameters

path (str | PosixPath) – path to TESEO lstcurr.pre file

Returns

DataFrame of currents, number of files (times), and number of nodes

Return type

Tuple[pd.DataFrame, float, float]

pyteseo.io.read_winds(path: str | PosixPath) Tuple[pandas.DataFrame, float, float]

Read TESEO winds-files (2dh: [lon, lat, u, v])

Parameters

path (str | PosixPath) – path to TESEO lstwinds.pre file

Returns

DataFrame of winds, number of files (times), and number of nodes

Return type

Tuple[pd.DataFrame, float, float]

pyteseo.io.write_currents(dir_path)
pyteseo.io.write_winds(dir_path)