cif Files
bin_io.tcl.
get_nao [fileName [dataType [shape]]]"" which is treated as stdin)
c8,
u8,
u16,
u32,
i8,
i16,
i32,
f32 or
f64
put_nao [nap_expr [fileName]]stdout)
get_bin dataType [fileId [mode]]c8,
u8,
u16,
u32,
i8,
i16,
i32,
f32 or
f64
stdin)
binary (default) or swap
put_bin nap_expr [fileId [mode]]stdout)
binary (default) or swap
squares,
writes it to a file, then reads the data from this file into
a NAO called in.
% nap "squares = (0 .. 4)**2" ::NAP::66-66 % $squares all ::NAP::66-66 f32 MissingValue: NaN References: 1 Unit: (NULL) Dimension 0 Size: 5 Name: (NULL) Coordinate-variable: (NULL) Value: 0 1 4 9 16 % set file [open tmp.bin w]; # open file "tmp.bin" for writing file5 % put_bin squares $file; # write data from squares % close $file % set file [open tmp.bin]; # open file "tmp.bin" for reading file5 % nap "in = [get_bin f32 $file]"; # read data into in ::NAP::78-78 % close $file % $in all ::NAP::78-78 f32 MissingValue: NaN References: 1 Unit: (NULL) Dimension 0 Size: 5 Name: (NULL) Coordinate-variable: (NULL) Value: 0 1 4 9 16
cif Files
The cif (conmap input file) format is one which originated
in the Melbourne University Department of Meteorology in the days before netCDF and HDF.
It is now rather obsolete but is still used within CSIRO and other Australian organisations.
A cif is a Fortran unformatted file consisting of one or more frames, each
of which consists of six records as follows:
The main input procedure is get_cif, which
reads one or more matrices from each of one or more cif files.
The main output procedure is put_cif, which writes a NAO as an entire cif.
These procedures call the low-level procedures get_cif1
or put_cif1 for each frame.
get_cif [options] pattern [pattern ...]-g 0|1: 1 (default) for geographic mode,
0 for non-geographic mode
-m real: Input missing value (default: -7777777.0)
-um text: Units for matrix (default: none)
-ux text: Units for x (default: if geographic mode then
degrees_east, else none)
-uy text: Units for y (default: if geographic mode then
degrees_north, else none)
-x text: Name of dimension x
(default: if geographic mode then longitude else x)
-y text: Name of dimension y
(default: if geographic mode then latitude else x)
The following example reads a single-frame cif named 7.cif
into a NAO called in, then
displays it (including the coordinate variables).
% nap "in = [get_cif 7.cif]" ::NAP::357-357 % $in all ::NAP::357-357 f32 MissingValue: NaN References: 1 Unit: (NULL) This data originated from ascii conmap input file 'acif.7' Dimension 0 Size: 3 Name: latitude Coordinate-variable: ::NAP::236-236 Dimension 1 Size: 4 Name: longitude Coordinate-variable: ::NAP::308-308 Value: 1 1 2 -3 1 _ 3 -4 2 0 4 5 % [nap "coordinate_variable(in,0)"] -60 30 60 % [nap "coordinate_variable(in,1)"] -90 30 90 180
put_cif nap_expr [fileName [mode]]stdout)
binary (default) or swap
get_cif1 [options] fileId-g 0|1: 1 (default) for geographic mode,
0 for non-geographic mode
-m real: Input missing value (default: -7777777.0)
-s 0|1: 0 (default) for binary mode,
1 for swap (byte-swapping) mode
-um text: Units for matrix (default: none)
-ux text: Units for x (default: if geographic mode then
degrees_east, else none)
-uy text: Units for y (default: if geographic mode then
degrees_north, else none)
-x text: Name of dimension x
(default: if geographic mode then longitude else x)
-y text: Name of dimension y
(default: if geographic mode then latitude else x)
The following example reads the first frame of a cif named 7.cif
into a NAO called in, then displays it (including the coordinate variables).
% set f [open 7.cif] file5 % nap "in = [get_cif1 $f]" ::NAP::218-218 % close $f % $in all ::NAP::218-218 f32 MissingValue: NaN References: 1 Unit: (NULL) This data originated from ascii conmap input file 'acif.7' Dimension 0 Size: 3 Name: latitude Coordinate-variable: ::NAP::97-97 Dimension 1 Size: 4 Name: longitude Coordinate-variable: ::NAP::169-169 Value: 1 1 2 -3 1 _ 3 -4 2 0 4 5 % ::NAP::97-97 -60 30 60 % ::NAP::169-169 -90 30 90 180
put_cif1 nap_expr [fileId [mode]]stdout)
binary (default) or swap
size_of dataTypeExample:
% size_of i16 2