Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/iris/fileformats/pp_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,21 @@ def convert(f):
cell_methods = []
dim_coords_and_dims = []
aux_coords_and_dims = []

class DimCoordParams(namedtuple('DimThing', ['points', 'standard_name', 'long_name', 'var_name', 'units', 'bounds', 'attributes', 'coord_system', 'circular'])):
pass
class Date2NumParams(namedtuple('Date2NumParams', ['unit', 'calendar', 'date'])):
pass
class UnitParams(namedtuple('UnitParams', ['name', 'calendar'])):
def __new__(cls, name, calendar=None):
return super(UnitParams, cls).__new__(cls, name, calendar)

if \
(f.lbtim.ia == 0) and \
(f.lbtim.ib == 0) and \
(f.lbtim.ic in [1, 2, 3]) and \
(len(f.lbcode) != 5 or (len(f.lbcode) == 5 and f.lbcode.ix not in [20, 21, 22, 23] and f.lbcode.iy not in [20, 21, 22, 23])):
aux_coords_and_dims.append((DimCoord(f.time_unit('hours').date2num(f.t1), standard_name='time', units=f.time_unit('hours')), None))
aux_coords_and_dims.append((DimCoordParams(Date2NumParams("hours", f.calendar, f.t1), standard_name='time', units=UnitParams('hours')), None))

if \
(f.lbtim.ia == 0) and \
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/fileformats/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,8 @@ def load_cubes(filenames, user_callback, loader):

for filename in filenames:
for field in loader.field_generator(filename, **loader.field_generator_kwargs):
# Convert the field to a Cube.
cube, factories, references = _make_cube(field, loader.converter)
# Convert the field to Cube creation params.
cube_params, factories, references = _make_cube(field, loader.converter)

# Run any custom user-provided rules.
if loader.legacy_custom_rules:
Expand Down