Vertical axes object reference¶
- class pygeode.ZAxis[source]¶
Inherits from
Axis
Generic parent class for axes representing vertical coordinates, plotted by default on the vertical axis in line plots and in contour plots. No new or overridden methods.
- class pygeode.Height[source]¶
Inherits from
ZAxis
Represents a geometric height. No new or overridden methods.
- class pygeode.Pres[source]¶
Inherits from
ZAxis
Represents a pressure vertical coordinate.
New and overridden methods
Pres.logPAxis
([p0, H])logPAxis(p0, H) - returns a pygeode axis with log pressure heights corresponding to this axis.
Returns a matplotlib locator object for use in plotting.
Pres.formatvalue
(value[, fmt, units, unitstr])Returns formatted string representation of pressure
value
.
- class pygeode.Hybrid[source]¶
Inherits from
ZAxis
Represents a hybridized pressure coordinate, of the form \(p(\eta) = A(\eta) p_0 + B(\eta) p_s\).
Auxilliary arrays:
A
andB
New and overridden methods
Hybrid.__init__
(values, A, B, **kwargs)Create a new Axis object with the given values.
Returns a matplotlib locator object for use in plotting.
- Pres.logPAxis(p0=1000.0, H=7.1)[source]¶
logPAxis(p0, H) - returns a pygeode axis with log pressure heights corresponding to this axis. By default p0 = 1000 hPa and H = 7.1 (km).
- Pres.formatvalue(value, fmt=None, units=True, unitstr=None)[source]¶
Returns formatted string representation of pressure
value
.- Parameters
- valuefloat or int
Value to format.
- fmtstring (optional)
Format specification; see Notes. If the default
None
is specified,self.formatstr
is used.- unitsboolean (optional)
If
True
, will include the units in the string returned. Default isTrue
.- unitstrstring (optional)
String to use for the units; default is
self.units
.
- Returns
- Formatted representation of the pressure. See notes.
Notes
If
fmt
includes the character ‘<’, it is interpreted as ‘fmt<break’, such that values less than float(break) are formatted using the format string fmt, while those greater than float(break) are formatted as integers. Otherwise the behaviour is likeVar.formatvalue()
.Examples
>>> from pygeode.tutorial import t2 >>> print(t2.pres.formatvalue(1000)) 1000 hPa >>> print(t2.pres.formatvalue(1.52)) 1.5 hPa >>> print(t2.pres.formatvalue(20, '%.1g')) 2e+01 hPa >>> print(t2.pres.formatvalue(20, '%.1g<10')) 20 hPa
- Hybrid.__init__(values, A, B, **kwargs)[source]¶
Create a new Axis object with the given values.
- Parameters
- valuesnumpy.ndarray
A one-dimensional coordinate defining the axis grid.
- namestring (optional)
What to call the axis (i.e. for plot titles & when saving to file)
- attsdict (optional)
Any additional metadata to associate with the axis. The dictionary keys should be strings.
- plotattsdict (optional)
Parameters that control plotting behaviour; default values are available. The dictionary keys should be strings.
- rtolfloat
A relative tolerance used for identifying an element of this axis.
Notes
All subclasses of
Axis
need to call this __init__ method within their own __init__, to properly initialize all attributes.