Skip to content

Bug in calc_fgdms when doing <yearly processing #960

@mo-gill

Description

@mo-gill

I'm guessing this is low priority as it feels like a rare edge case, so this is mostly just to record some findings if needed.

I ran a request with < 1year start and end date to save some time when iterating development and fgdms_tavg-u-hxy-sea was failing with this error.

*** Starting conversions ***
Loading data for "CMIP7_ocnBgchem.json: fgdms_tavg-u-hxy-sea"
Unable to produce MIP requested variable "fgdms_tavg-u-hxy-sea" for "CMIP7_ocnBgchem": Field and Land Fraction dimensions differ
Unable to produce MIP requested variable "fgdms_tavg-u-hxy-sea" for "CMIP7_ocnBgchem": Field and Land Fraction dimensions differ
Field and Land Fraction dimensions differ
Traceback (most recent call last):
  File "(redacted)/CDDS/mip_convert/mip_convert/request.py", line 124, in convert
    produce_mip_requested_variable(variable_name, stream_id, substream, mip_table, user_config,
  File "(redacted)/729_collect_ukcm2_ll_ancils/CDDS/mip_convert/mip_convert/requested_variables.py", line 132, in produce_mip_requested_variable
    time_slice.process()
  File "(redacted)29_collect_ukcm2_ll_ancils/CDDS/mip_convert/mip_convert/new_variable.py", line 361, in process
    self._apply_expression()
  File "(redacted)t_ukcm2_ll_ancils/CDDS/mip_convert/mip_convert/new_variable.py", line 552, in _apply_expression
    self.cube = plugin.evaluate_expression(expression, self.input_variables)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/(redacted)ncils/CDDS/mip_convert/mip_convert/plugins/ukcm2/ukcm2_plugin.py", line 40, in evaluate_expression
    return eval(expression)
           ^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
  File "(redacted)ds/729_collect_ukcm2_ll_ancils/CDDS/mip_convert/mip_convert/plugins/base/data/processors.py", line 1919, in calc_fgdms
    raise RuntimeError('Field and Land Fraction dimensions differ')
RuntimeError: Field and Land Fraction dimensions differ`

When run >year start and end date it produces fine.

I think it's due to the indexing going on here:

# Check that the input cube and land fraction dimensions match
if cube[0, ...].shape != land_fraction.shape:
raise RuntimeError('Field and Land Fraction dimensions differ')

Here are the input cubes (before that indexing line) if <yearly request is used:
5month cube shapes = (144, 192), land_fraction shape = (144, 192)
And if 5 year request is used:
5year cube shapes = (12, 144, 192), land_fraction shape = (144, 192)

So i'm guessing to fix an adjustment would need to be made to the calc_fgdms processor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions