@@ -11954,7 +11954,7 @@ def halo(
1195411954 return f
1195511955
1195611956 @_inplace_enabled(default=False)
11957- def pad_missing(self, axis, pad_width, inplace=False):
11957+ def pad_missing(self, axis, pad_width=None, to_size=None , inplace=False):
1195811958 """Pad an axis with missing data.
1195911959
1196011960 The field's data and all metadata constructs that span the
@@ -11972,7 +11972,9 @@ def pad_missing(self, axis, pad_width, inplace=False):
1197211972 ``'X'``, the domain axis construct returned by
1197311973 ``f.domain_axis('X')`` is selected.
1197411974
11975- {{pad_width: sequence of `int`}}
11975+ {{pad_width: sequence of `int`, optional}}
11976+
11977+ {{to_size: `int`, optional}}
1197611978
1197711979 {{inplace: `bool`, optional}}
1197811980
@@ -11984,7 +11986,7 @@ def pad_missing(self, axis, pad_width, inplace=False):
1198411986
1198511987 **Examples*
1198611988
11987- >>> f = cf.example_field(6)
11989+ >>> f = cf.example_field(6)
1198811990 >>> print(f)
1198911991 Field: precipitation_amount (ncvar%pr)
1199011992 --------------------------------------
@@ -12028,6 +12030,17 @@ def pad_missing(self, axis, pad_width, inplace=False):
1202812030 [5.0 6.0 7.0 8.0 -- -- -- -- --]
1202912031 [ -- -- -- -- -- -- -- -- --]]
1203012032
12033+ >>> print(f.pad_missing('time', to_size=6))
12034+ Field: precipitation_amount (ncvar%pr)
12035+ --------------------------------------
12036+ Data : precipitation_amount(cf_role=timeseries_id(2), time(6))
12037+ Dimension coords: time(6) = [2000-01-16 12:00:00, ..., --] gregorian
12038+ Auxiliary coords: latitude(cf_role=timeseries_id(2)) = [25.0, 7.0] degrees_north
12039+ : longitude(cf_role=timeseries_id(2)) = [10.0, 40.0] degrees_east
12040+ : cf_role=timeseries_id(cf_role=timeseries_id(2)) = [x1, y2]
12041+ : altitude(cf_role=timeseries_id(2), 3, 4) = [[[1.0, ..., --]]] m
12042+ Coord references: grid_mapping_name:latitude_longitude
12043+
1203112044 """
1203212045 f = _inplace_enabled_define_and_cleanup(self)
1203312046
@@ -12048,7 +12061,9 @@ def pad_missing(self, axis, pad_width, inplace=False):
1204812061 iaxis = data_axes.index(axis)
1204912062
1205012063 # Pad the field
12051- super(Field, f).pad_missing(iaxis, pad_width, inplace=True)
12064+ super(Field, f).pad_missing(
12065+ iaxis, pad_width=pad_width, to_size=to_size, inplace=True
12066+ )
1205212067
1205312068 # Set new domain axis size
1205412069 domain_axis = f.domain_axis(axis)
@@ -12062,7 +12077,9 @@ def pad_missing(self, axis, pad_width, inplace=False):
1206212077
1206312078 # Pad the construct
1206412079 iaxis = construct_axes.index(axis)
12065- construct.pad_missing(iaxis, pad_width, inplace=True)
12080+ construct.pad_missing(
12081+ iaxis, pad_width=pad_width, to_size=to_size, inplace=True
12082+ )
1206612083
1206712084 return f
1206812085
0 commit comments