|
Copy the structure of a COARDS compliant netCDF file
|
Imported modules
|
|
import Numeric
import Scientific.IO.NetCDF
import string
import sys
import time
|
|
Functions
|
|
create_bare_COARDS
nccopystruct
|
|
|
create_bare_COARDS
|
create_bare_COARDS (
ncname,
tdat=None,
zdat=None,
latdat=None,
londat=None,
)
Create a bare COARDS compliant netCDF file with a minimum typing
The created file may hold 4D variables as in the COARDS standard:
var[time,Z,lat,lon], but the variables may hold less dimensions
(like in a zonal average, for instance).
Arguments:
-
ncname
- is the name of the netCDF file to be created
Optional arguments:
-
tdat
- Tuple with first element the NumPy array of items to be held
(
None for a record variable) and with second element the
units attribute of the created time variable. If tdat itself is
None, no time variable will be created (This is the default).
-
zdat
- Tuple with two elements. The first one is the NumPy array of
vertical levels. The last one is the units attribute of the
vertical levels. If
zdat is None, no vertical dimension is
created (Default).
-
latdat
- NumPy array of latitudes. The units attribute is set
to degrees_north. If
None (default), no latitudinal
dimension is created.
-
londat
- NumPy array of longitudes. The units attribute
is set to degrees_east. If
None (default), no zonal dimension
is created.
|
|
|
nccopystruct
|
nccopystruct (
name,
inc,
dims=None,
vars=None,
varcontents=None,
)
Duplicate the definition of the input netCDF file in the output file
Arguments:
-
name
- Name of the output file
-
inc
- Input netCDF object
Optional arguments:
-
dims
- Tuple (list) with the name of the dimensions to be copied.
Defaults to
None.
-
vars
- Tuple (list) with the name of the variables to be copied.
Defaults to
None.
-
varcontents
- Tuple (list) with the name of the variables whose
contents are to be copied. They must have been previously
defined in
vars or otherwise. Defaults to None.
|
|