Package atmopy :: Package io :: Module binary
[show private | hide private]
[frames | no frames]

Module atmopy.io.binary

Function Summary
(list of datetime, numpy.array) filter_config(config, data)
Filters data based on the cells and the days to be discarded according to a given configuration.
int get_filesize(filename)
Gets a file's size.
int get_timesteps(filename, recordLength)
Gets the number of timesteps in a file given its record length (in Bytes).
numpy.array load_binary(filename, shape, type)
Loads a binary file into an array using specified shape.
numpy.array load_binary_first_level(filename, shape, type)
Loads a binary file into an array using specified 3D shape for X, Y and T dimensions (a time sequence of planes).
  save_binary(arrayToSave, filename, type)
Saves a numpy in a binary file using specified type.

Function Details

filter_config(config, data)

Filters data based on the cells and the days to be discarded according to a given configuration.
Parameters:
config - The configuration associated with 'data'.
           (type=Config)
data - The data array to be filtered.
           (type=numpy.array)
Returns:
The dates and the output data. The output data array does not contain:
  1. the first and/or last days if they are missing data, except if 'config.discarded_days' is negative;
  2. days to be removed at the beginning (if the first day is incomplete, it is removed, but not counted as a discarded day) 'config.discarded_days'.
  3. the cells to be removed in the domain edges according to 'config.discarded_cells'.

           (type=(list of datetime, numpy.array))

get_filesize(filename)

Gets a file's size.
Parameters:
filename - The name of the file.
           (type=string)
Returns:
File's size, 0 if no readable file found.
           (type=int)

get_timesteps(filename, recordLength)

Gets the number of timesteps in a file given its record length (in Bytes).
Parameters:
filename - The name of the file.
           (type=string)
recordLength - Size of one record.
           (type=integer)
Returns:
Number of timesteps.
           (type=int)

load_binary(filename, shape, type='f')

Loads a binary file into an array using specified shape. Returns numpy.
Parameters:
filename - The name of the file to load.
           (type=string or Python file object.)
shape - The shape of the array to load from file.
           (type=tuple)
type - Type of data read. Default is 'f'
           (type=string)
Returns:
New array filled with binary data from specified file.
           (type=numpy.array)

load_binary_first_level(filename, shape, type='f')

Loads a binary file into an array using specified 3D shape for X, Y and T dimensions (a time sequence of planes). If the given binary file is a 4D file (XYZT), the plane Z = 1 is extracted.
Parameters:
filename - The name of the file to load.
           (type=string or Python file object.)
shape - The 3D shape of the array to load from file.
           (type=tuple)
type - Type of data read. Default is 'f'
           (type=string)
Returns:
New 3D array os given shape filled with binary data from specified file.
           (type=numpy.array)

save_binary(arrayToSave, filename, type='f')

Saves a numpy in a binary file using specified type.
Parameters:
arrayToSave - The array to save.
           (type=numpy.array)
filename - The name of the file to save the array into.
           (type=string or python file object)
type - Format of data to save the array in file.
           (type=string)

Generated by Epydoc 2.1 on Tue May 19 10:37:13 2009 http://epydoc.sf.net