:py:mod:`pyteseo.io`
====================

.. py:module:: pyteseo.io

.. autoapi-nested-parse::

   Input and Output functionality for specific TESEO file formats



Module Contents
---------------


Functions
~~~~~~~~~

.. autoapisummary::

   pyteseo.io.read_grid
   pyteseo.io.read_coastline
   pyteseo.io.write_grid
   pyteseo.io.write_coastline
   pyteseo.io.read_currents
   pyteseo.io.read_winds
   pyteseo.io.write_currents
   pyteseo.io.write_winds



.. py:function:: read_grid(path: str | PosixPath, nan_value: int | float = -999) -> pandas.DataFrame

   Read TESEO grid-file to pandas DataFrame

   :param path: path to the grid-file
   :type path: str | PosixPath
   :param nan_value: value to set nans. Defaults to -999.
   :type nan_value: float | int, optional

   :returns: DataFrame with TESEO grid data [lon, lat, depth]
   :rtype: pd.DataFrame


.. py:function:: read_coastline(path: str | PosixPath) -> pandas.DataFrame

   Read TESEO coastline-file to pandas DataFrame

   :param path: path to the coastline-file
   :type path: str | PosixPath

   :returns: DataFrame with TESEO coastline data [lon, lat]
   :rtype: pd.DataFrame


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

   Write TESEO grid-file

   :param df: DataFrame with columns 'lon', 'lat', 'depth' (lon:[-180,180], lat:[-90,90])
   :type df: pd.DataFrame
   :param path: path to the new grid-file
   :type path: str | PosixPath
   :param nan_value: define how will be writted nan values in the grid-file. Defaults to -999.
   :type nan_value: int | float, optional


.. py:function:: write_coastline(df: pandas.DataFrame, path: str | PosixPath) -> None

   Write TESEO coastline and polygons files

   :param df: DataFrame with columns 'lon', 'lat' and polygons separated by nan lines (lon:[-180,180], lat:[-90,90])
   :type df: pd.DataFrame
   :param path: path to the new coastline-file
   :type path: str | PosixPath


.. py:function:: read_currents(path: str | PosixPath) -> Tuple[pandas.DataFrame, float, float]

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

   :param path: path to TESEO lstcurr.pre file
   :type path: str | PosixPath

   :returns: DataFrame of currents, number of files (times), and number of nodes
   :rtype: Tuple[pd.DataFrame, float, float]


.. py:function:: read_winds(path: str | PosixPath) -> Tuple[pandas.DataFrame, float, float]

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

   :param path: path to TESEO lstwinds.pre file
   :type path: str | PosixPath

   :returns: DataFrame of winds, number of files (times), and number of nodes
   :rtype: Tuple[pd.DataFrame, float, float]


.. py:function:: write_currents(df: pandas.DataFrame, path: PosixPath | str, nan_value: int = 0) -> None


.. py:function:: write_winds(df: pandas.DataFrame, path: PosixPath | str, nan_value: int = 0) -> None


