/**
 @file grid.h
 @brief Grid management.
 @author CLS
 */
#ifndef _GRID_H
#define _GRID_H

#include "fes_int.h"

/**
 @fn interp(fes_handler* fes, const double lat, const double lon)

 @brief Perfom bilinear interpolation at asked point from grids

 @param fes   Internal data needed to interpolate.
 @param lat   Latitude asked
 @param lon   Longitude asked

 @return 0 on success otherwise an error status.
 */
int interp(fes_handler* fes, const double lat, const double lon);

/**
 @fn load_grid(const char* const path, const unsigned int n,
 fes_cdf_file* const nc, fes_handler* const fes);

 @brief Read waves definition from netCDF grids files.

 @param path  Absolute or relative file name for netCDF file to be opened.
 @param n     Index of the current grid
 @param nc    Properties of netCDF read
 @param fes   Properties of grid read

 @return 0 on success otherwise an error status.
 */
int load_grid(
        const char* const path,
        const unsigned int n,
        fes_cdf_file* const nc,
        fes_handler* const fes);

#endif
