Skip to content

Perform extra checks before allowing report creation. #312

@sentry

Description

@sentry

User reported that they created a report for power and irradiance and were met with an unhelpful error message. Users should be informed that units must match until SolarArbiter/solarforecastarbiter-core#514 is resolved.

Currently if units do not match for all pairs in the report, the report creation does not catch the problem and an error is raised at computation. Perhaps this can be addressed by trying to instantiate a data model object from the posted report? This may simplify keeping these restrictions in sync between packages.

Sentry Issue: WORKER-API-4K

ValueError: All units must be identical.
(8 additional frame(s) were not displayed)
...
  File "solarforecastarbiter/datamodel.py", line 184, in _single_field_processing
    return type_.from_dict(val)
  File "solarforecastarbiter/datamodel.py", line 295, in from_dict
    return model(**kwargs)
  File "<string>", line 12, in __init__
    from typing import Tuple, Union, ClassVar
  File "solarforecastarbiter/datamodel.py", line 1948, in __post_init__
    (k.forecast, k.data_object) for k in self.object_pairs))
  File "solarforecastarbiter/datamodel.py", line 1270, in __check_units__
    raise ValueError('All units must be identical.')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions