 

nctofelt
Convert from netcdf format to FELT file format
nctofelt d fdef netcdffile feltfile <specification_file
where fdef is the name of a flt2flt grid definition file.
Selected fields from the netcdf file are transferred to a FELT
file, which will be created.
The nctofelt command reads a specification from standard input
on how to convert from the netcdf file to the FELT file.
The specification contains a description of which variables in
the netcdf file are to be transferred to the FELT file, and how
corresponding fields in the two files are identified.
The following sections gives details about the specification file.
The first line in the specification file contains the following 10
whole numbers:

The number of twodimensional FELT fields to be produced.
This number is also equal to the number of lines comprising
the rest of the file.

The type of the FELT file (999,998 or 997). Normally, type=998 will be the
most useful one.
999 = standard felt file (one time step)
998 = archive felt file (several time steps)
997 = cyclic archive felt file (several time steps)

Producer number. This utility only allows one producer in the
FELT file. This number has only a descriptive function. Any
number in the range 1  99 will work.

Three numbers giving the base date/time for the data
(corresponding to word 57, record 1 in a standard FELT file;
corresponding to the first date/time for an archive FELT file).
(Year, month*100+day, hour*100+minute).

Number of time steps in the FELT file (FELT record 1 word 26)
(for standard, type=999 FELT files, this can only be 1).

Number of index slots in ``innholdsfortegnelse'' per time step
(FELT record 1 word 27). This must correspond to the maximum
number of 2D fields to be converted for one time step.

Unit for time step resolution (1=year, 2=month, 3=day, 4=hour,
5=minute) (FELT record 1 word 29)

Length of time step (using unit as above) (FELT record 1 word 30)
Then follows lines of the following type:
FELT(date,grid,dtyp,fcl,lev1,lev2,vco,par) = varname(arg1,arg2,...)<LC>
<LC> is an optional linear conversion clause (see Linear conversion below).
The date field is optional. So, an alternative form is:
FELT(grid,dtyp,fcl,lev1,lev2,vco,par) = varname(arg1,arg2,...)<LC>
Each line describes one twodimensional field in the FELT file,
and the variable in the netcdf file from where the data are to be
transferred.
The words date,grid,dtyp,fcl,lev1,lev2,vco,par,varname,arg1,arg2,...
should be substituted by the following values:
 date

(Optional). Date/time on the form: YYYYMMDD:HHMM
If not given, then the date/time given in line one
(for a standard, type=999 FELT file) is used. Othervise,
the date/time for the previous field is used.
See also: NOTE about date/time below.
 grid

Grid area
This is the grid number described in felt.txt.
The grid number must be found in the flt2flt grid
definition file given by the 'd' option on
the command line.
This value may also take the form gn:x1x2:y1y2,
where gn = grid number,
x1 = lower x index, x2 = upper x index and y1, y2 =
the lower and upper y indices. The lower x,y indices
represent the indices in the resulting FELT array
corresponding to the first value copied from the
netcdf variable. x1,y1 defaults to 1,1. The upper
x,y indices correspond to the last value copied from
the netcdf variable. When x1x2, y1y2 is
explisitly given as two integer ranges,
only the rectangular part of the FELT
array given by taking (x1,y1) as the lower left
and (x2,y2) as the upper right corner,
is filled with values. The other parts of the FELT
array is filled with the missing value code.
 dtyp

Data type (1,2,3 or 4  described in felt.txt)
1 : Analysis fields
2 : Prognostic fields
3 : Computed/interpolated/initialized fields
4 : Parameter fields
 fcl

Forecast length (hours). For fields other than prognostic fields,
this number should be 0. For prognostic fields, added to
the date/time given in date above, this number represents
the valid time for the physical state described by the 2D field.
 lev1

Level 1 vertical coordinate value in units corresponding to
vco below.
 lev2

Level 2 vertical coordinate value (=0 if the level can be
described by only one value).
 vco

Type of vertical coordinate used:
1 : Pressure (hPa)
2 : sigma atmosphere
3 : h
4 : theta (isentropical surfaces)
5 : z (depth, ocean)
6 : level (ocean)
7 : sigma ocean
8 : surface of the earth/oceans
9 : pv, potential vorticity
10 : eta (hybrid) atmosphere
11 : ``sigma height'' = (ZZs)/(HZs), (H: height in meter)
(Descriptions taken from felt.txt)
 par

Parameter code. (Described in felt.txt)
 variable

Variable name identifying an array in the netcdf file
 arg1,...

Arguments to define which part of the netcdf array
to use.
These arguments may either have values
found for the corresponding dimension in the
netcdf file, or they have the special values #1 or #2.
Exactly one of the arguments must have the value
#1. Another argument may have the value #2.
If only the #1 argument is found, the twodimensional
field is defined by varying the array index
corresponding to the #1 argument from 1 up to the
size of the dimension. If both the #1 and #2
arguments are given, then values are copied from
the netcdf array by first setting the #2 index
to 1 while traversing all values of the #1 index
from 1 and up to the dimension size, then setting
the #2 index to 2 etc.
If the argument is neither #1 or #2, it either
corresponds to an index value in the netcdf array,
or to a value found in another netcdf variable
having the same name as the dimension corresponding
to the argument. If such dimension variable exists,
this alternative is the only possibility. Care
should be taken to make unambiguous arguments
corresponding to values in a dimension variable.
If this variable is of type float or double, the
argument should always include a decimal point.
The 2D FELT field, which is produced, may be seen
as a 2D array a(x,y) where the x index corresponds
to the #1 argument and y corresponds to the #2
argument. For latlon grids, x (and #1) correspnds to
the longitude dimension, while y (and#2) corresponds to the
latitude dimension.
The optional linear conversion clause, <LC>, is used if the values
in the netcdf file are to be transformed by a linear function before
they are stored in the FELT file. This clause must correspond to one
of the following forms:
* r1
* (r1)
* r1 + r2
* r1  r2
* (r1) + r2
* (r1)  r2
+ r2
 r2
where r1 and r2 are nonnegative numbers (with or without a decimal
point). Scientific notation is not allowed. Spaces as shown in the
forms above are not neccessary.
The number of lines corresponding to one date/time value must
not exceed the available number of index slots in the
``innholdsfortegnelse'' for the given date/time value. This
number is given on line one (described above).
Also, lines must be sorted in incresing date/time order, and
each date/time must correspond to one of the date/times
defined in line one ('base date/time' + n * 'time step',
n = 0,1,2,...).

