# DINEOF format

### From GHER

(→Input/Output formats: preparing your own data) |
(→Input/Output formats: preparing your own data) |
||

Line 13: | Line 13: | ||

my_matrix = gread('my_variable.dat'); | my_matrix = gread('my_variable.dat'); | ||

- | You can type <tt>help gread</tt> and <tt>help gwrite</tt> to obtain the help for these functions. | + | '''You can type <tt>help gread</tt> and <tt>help gwrite</tt> to obtain the help for these functions.''' |

The matrix containing the data should be three-dimensional, with the first two dimensions being the spatial dimensions, and the third one, the temporal dimension. The missing values should be set to <nowiki> ''NaN'' </nowiki>. A two-dimensional (only spatial) land-sea mask has to be provided to DINEOF. This mask classifies land points with the value <nowiki> ''0''</nowiki> and sea points with <nowiki> ''1''</nowiki>. | The matrix containing the data should be three-dimensional, with the first two dimensions being the spatial dimensions, and the third one, the temporal dimension. The missing values should be set to <nowiki> ''NaN'' </nowiki>. A two-dimensional (only spatial) land-sea mask has to be provided to DINEOF. This mask classifies land points with the value <nowiki> ''0''</nowiki> and sea points with <nowiki> ''1''</nowiki>. |

## Revision as of 20:23, 8 February 2013

## Input/Output formats: preparing your own data

DINEOF accepts two formats, NetCDF and a binary Fortran format. Reading/writting routines are provided, for both Fortran and Octave/Matlab. The Fortran routines are used by DINEOF, and the Octave/Matlab routines are included in the package to help the user in the pre- and post-treatment of the data. Octave is an open-source alternative to matlab available freely at http://www.octave.org.

For the examples given above, the binary format is used.

This is an example on how to read and write a matrix in the binary format using Octave or Matlab. If you have a variable containing your matrix in an Octave/Matlab environment, called ''my_matrix'' , you can do the following to write it to the disk:

gwrite('my_variable.dat',my_matrix);

To read this variable from the disk to your Octave/Matlab environment just type:

my_matrix = gread('my_variable.dat');

**You can type help gread and help gwrite to obtain the help for these functions.**

The matrix containing the data should be three-dimensional, with the first two dimensions being the spatial dimensions, and the third one, the temporal dimension. The missing values should be set to ''NaN'' . A two-dimensional (only spatial) land-sea mask has to be provided to DINEOF. This mask classifies land points with the value ''0'' and sea points with ''1''.

DINEOF also supports netCDF format, but this option is disabled by default. To make DINEOF able to use netCDF variables, you have to uncomment the line

#define NETCDF

in the file ppdef.h, located in the DINEOF folder. An exclamation point at the beginning of the line means it is commented out, and it will not be used by DINEOF. If you take out this exclamation point, then DINEOF will be able to use netCDF format. Don't forget to add the path to the netCDF libraries in the compiler file, as specified above.