axis

- class climlab.domain.axis.Axis(axis_type='abstract', num_points=10, points=None, bounds=None)[source]
Bases:
objectCreates a new climlab Axis object.
An
Axisis an object where information of a spacial dimension of a_Domainare specified.These include the type of the axis, the number of points, location of points and bounds on the spatial dimension, magnitude of bounds differences delta as well as their unit.
The axes of a
_Domainare stored in the dictionary axes, so they can be accessed throughdom.axesifdomis an instance of_Domain.Initialization parameters
An instance of
Axisis initialized with the following arguments (for detailed information see Object attributes below):- Parameters:
- Raises:
ValueErrorifaxis_typeis not one of the valid types or their euqivalents (see below).- Raises:
ValueErrorifpointsare given and not array-like.- Raises:
ValueErrorifboundsare given and not array-like.
Object attributes
Following object attributes are generated during initialization:
- Variables:
axis_type (str) –
Information about the type of axis. Valid axis types are:
'lev''lat''lon''depth''abstract'(default)
num_points (int) – number of points on axis
units (str) – Unit of the axis. During intialization the unit is chosen from the
defaultUnitsdictionary (see below).points (array) – array with all points of the axis (grid)
bounds (array) – array with all bounds between points (staggered grid)
delta (array) – array with spatial differences between bounds
Axis Types
A couple of differing axis type strings are rendered to valid axis types. Alternate forms are listed here:
'lev''p''press''pressure''P''Pressure''Press'
'lat''Latitude''latitude'
'lon''Longitude''longitude'
'depth''Depth''waterDepth''water_depth''slab'
The default units are:
defaultUnits = {'lev': 'mb', 'lat': 'degrees', 'lon': 'degrees', 'depth': 'meters', 'abstract': 'none'}
If bounds are not given during initialization, default end points are used:
defaultEndPoints = {'lev': (0., climlab.constants.ps), 'lat': (-90., 90.), 'lon': (0., 360.), 'depth': (0., 10.), 'abstract': (0, num_points)}
- Example:
Creation of a standalone Axis:
>>> import climlab >>> ax = climlab.domain.Axis(axis_type='Latitude', num_points=36) >>> print ax Axis of type lat with 36 points. >>> ax.points array([-87.5, -82.5, -77.5, -72.5, -67.5, -62.5, -57.5, -52.5, -47.5, -42.5, -37.5, -32.5, -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, 32.5, 37.5, 42.5, 47.5, 52.5, 57.5, 62.5, 67.5, 72.5, 77.5, 82.5, 87.5]) >>> ax.bounds array([-90., -85., -80., -75., -70., -65., -60., -55., -50., -45., -40., -35., -30., -25., -20., -15., -10., -5., 0., 5., 10., 15., 20., 25., 30., 35., 40., 45., 50., 55., 60., 65., 70., 75., 80., 85., 90.]) >>> ax.delta array([ 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5.])