Skip to content

Value error for hurs if input values are > 100 #137

@SimonTreu

Description

@SimonTreu

Calculatign global counterfactuals for the variable hurs failed because of values > 100. From the input side those cases are rare but possible and allowed. In attrici v1.1.0 this was handled that by masking out those values and skipping detrending for them (https://github.com/ISI-MIP/attrici/blob/v1.1.0/attrici/const.py). Afterwards we just assigned the original values. Since this only affects a few instances this would still be a valid approach.
I attached below the relevant parts of the error log.

conda/673bc5cfe0fa8afa6a75d4216fd38979_/lib/python3.11/site-packages/attrici/variables.py", line 566, in __init__
    self.validate(data)
  File "conda/673bc5cfe0fa8afa6a75d4216fd38979_/lib/python3.11/site-packages/attrici/variables.py", line 571, in validate
    check_bounds(data, lower=0.0, upper=100.0)
  File "/conda/673bc5cfe0fa8afa6a75d4216fd38979_/lib/python3.11/site-packages/attrici/variables.py", line 37, in check_bounds
    raise ValueError(data.max(), "is bigger than upper bound", upper, ".")
ValueError: (<xarray.DataArray 'hurs' ()> Size: 4B
array(100.00023, dtype=float32)
Coordinates:
    latlon   object 8B (65.75, 45.75)
    lat      float64 8B 65.75
    lon      float64 8B 45.75, 'is bigger than upper bound', 100.0, '.')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions