YetAnotherCoupler 3.4.0
Loading...
Searching...
No Matches
read_woa_data.c File Reference
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <netcdf.h>
#include "read_woa_data.h"
#include "utils_common.h"
#include "io_utils.h"
Include dependency graph for read_woa_data.c:

Go to the source code of this file.

Functions

int yac_open_woa_output (char const *input_file)
 
void yac_close_woa_output (int ncid)
 
void yac_read_woa_dimensions (int fileId, char const *fieldName, struct yac_fieldMetadata *fieldInfo)
 
double * yac_get_woa_memory (struct yac_fieldMetadata fieldInfo)
 
void yac_free_woa_memory (double *data)
 
void yac_read_woa_timestep_level (int fileId, double *cell_data, struct yac_fieldMetadata fieldInfo, int timeStep, int level)
 

Function Documentation

◆ yac_close_woa_output()

void yac_close_woa_output ( int fileId)

To close a NetCDF file

Parameters
[in]fileIdNetCDF file ID as it was returned by yac_open_woa_output
Examples
test_read_woa_data.c.

Definition at line 41 of file read_woa_data.c.

◆ yac_free_woa_memory()

void yac_free_woa_memory ( double * data)

To release allocated memory

Parameters
[in]datamemory for data from NetCDF file
Examples
test_read_woa_data.c.

Definition at line 152 of file read_woa_data.c.

◆ yac_get_woa_memory()

double * yac_get_woa_memory ( struct yac_fieldMetadata fieldInfo)

To get the appropriate memory for the data to be read in

Parameters
[in]fieldInfometadata information for the array
Returns
pointer to memory that is big enough to hold a single level of a single time step of the field associated to fieldInfo
Examples
test_read_woa_data.c.

Definition at line 144 of file read_woa_data.c.

◆ yac_open_woa_output()

int yac_open_woa_output ( char const * input_file)

To open a NetCDF file

Parameters
[in]input_filefile name of the NetCDF input file including the file extension The function returns an integer value (the NetCDF ID) which has to be used by subsequent calls when this file is accessed.
Examples
test_read_woa_data.c.

Definition at line 22 of file read_woa_data.c.

Here is the call graph for this function:

◆ yac_read_woa_dimensions()

void yac_read_woa_dimensions ( int fileId,
char const * fieldName,
struct yac_fieldMetadata * fieldInfo )

To read in the dimensions for arrays stored in the file

Parameters
[in]fileIdNetCDF file ID as it was returned by yac_open_woa_output
[in]fieldNamename of the array that shall be read in
[out]fieldInfometadata information for the array
Examples
test_read_woa_data.c.

Definition at line 57 of file read_woa_data.c.

Here is the call graph for this function:

◆ yac_read_woa_timestep_level()

void yac_read_woa_timestep_level ( int fileId,
double * cell_data,
struct yac_fieldMetadata fieldInfo,
int timestep,
int level )

To read in on timestep of one particular field

Parameters
[in]fileIdNetCDF file ID as it was returned by yac_open_woa_output
[out]cell_dataone level of the requested field
[out]fieldInfometadata information for the array
[in]timesteptime step to be read from the NetCDF file
[in]levelvertical level to be read from the NetCDF file
Examples
test_read_woa_data.c.

Definition at line 158 of file read_woa_data.c.