cf.DimensionCoordinate.create_bounds¶

DimensionCoordinate.
create_bounds
(bound=None, cellsize=None, flt=0.5, max=None, min=None)[source]¶ Create cell bounds.
Parameters:  bound: optional
If set to a value larger (smaller) than the largest (smallest) coordinate value then bounds are created which include this value and for which each coordinate is in the centre of its bounds. Ignored if create is False.
 cellsize: optional
Define the exact size of each cell that is created. Created cells are allowed to overlap do not have to be contigious. Ignored if create is False. The cellsize parameter may be one of:
A datalike scalar (see below) that defines the cell size, either in the same units as the coordinates or in the units provided. Note that in this case, the position of each coordinate within the its cell is controlled by the flt parameter.
 Parameter example:
To specify cellsizes of 10, in the same units as the coordinates:
cellsize=10
. Parameter example:
To specify cellsizes of 1 day:
cellsize=cf.Data(1, 'day')
(seecf.Data
for details). Parameter example:
For coordinates
1, 2, 10
, settingcellsize=1
will result in bounds of(0.5, 1.5), (1.5, 2.5), (9.5, 10.5)
. Parameter example:
For coordinates
1, 2, 10
kilometres, settingcellsize=cf.Data(5000, 'm')
will result in bounds of(1.5, 3.5), (0.5, 4.5), (7.5, 12.5)
(seecf.Data
for details). Parameter example:
For decreasing coordinates
2, 0, 12
setting,cellsize=2
will result in bounds of(3, 1), (1, 1), (11, 13)
.
A
cf.TimeDuration
defining the cell size. Only applicable to reference time coordinates. It is possible to “anchor” the cell bounds via thecf.TimeDuration
parameters. For example, to specify cell size of one calendar month, starting and ending on the 15th day:cellsize=cf.M(day=15)
(seecf.M
for details). Note that the flt parameter is ignored in this case. Parameter example:
For coordinates
19841201 12:00, 19841202 12:00, 20000415 12:00
setting,cellsize=cf.D()
will result in bounds of(19841201, 19841202), (19841202, 19841203), (20000515, 20000416)
(seecf.D
for details). Parameter example:
For coordinates
19841201, 19841202, 20000415
setting,cellsize=cf.D()
will result in bounds of(19841201, 19841202), (19841202, 19841203), (20000515, 20000416)
(seecf.D
for details). Parameter example:
For coordinates
19841201, 19841202, 20000415
setting,cellsize=cf.D(hour=12)
will result in bounds of(198411:30 12:00, 19841201 12:00), (19841201 12:00, 19841202 12:00), (20000514 12:00, 20000415 12:00)
(seecf.D
for details). Parameter example:
For coordinates
19841216 12:00, 19850116 12:00
setting,cellsize=cf.M()
will result in bounds of(19841201, 19850101), (19850101, 19850201)
(seecf.M
for details). Parameter example:
For coordinates
19841201 12:00, 19850101 12:00
setting,cellsize=cf.M()
will result in bounds of(19841201, 19850101), (19850101, 19850201)
(seecf.M
for details). Parameter example:
For coordinates
19841201 12:00, 19850101 12:00
setting,cellsize=cf.M(day=20)
will result in bounds of(19841120, 19841220), (19841220, 19850120)
(seecf.M
for details). Parameter example:
For coordinates
19840301, 19840601
setting,cellsize=cf.Y()
will result in bounds of(19840101, 19850101), (19840101, 19850101)
(seecf.Y
for details). Note that in this case each cell has the same bounds. This becausecf.Y()
is equivalent tocf.Y(month=1, day=1)
and the closest 1st January to both coordinates is 1st January 1984.
{+datalikescalar} TODO
 flt:
float
, optional When creating cells with sizes specified by the cellsize parameter, define the fraction of the each cell which is less its coordinate value. By default flt is 05, so that each cell has its coordinate at it’s centre. Ignored if cellsize is not set.
 Parameter example:
For coordinates
1, 2, 10
, settingcellsize=1, flt=0.5
will result in bounds of(0.5, 1.5), (1.5, 2.5), (9.5, 10.5)
. Parameter example:
For coordinates
1, 2, 10
, settingcellsize=1, flt=0.25
will result in bounds of(0.75, 1.75), (1.75, 2.75), (9.75, 10.75)
. Parameter example:
For decreasing coordinates
2, 0, 12
, settingcellsize=6, flt=0.9
will result in bounds of(2.6, 3.4), (0.6, 5.4), (11.4, 17.4)
.
 min: optional
Limit the created bounds to be no less than this number.
 Parameter example:
To ensure that all latitude bounds are at least 90:
min=90
.
 max: optional
Limit the created bounds to be no more than this number.
 Parameter example:
To ensure that all latitude bounds are at most 90:
max=90
.
 copy:
bool
, optional If
False
then the returned bounds are not independent of the existing bounds, if any, or those inserted, if create and insert are both True. By default the returned bounds are independent.
Returns: Examples:
>>> c.create_bounds() >>> c.create_bounds(bound=9000.0)