Skip to content

compute_rpss is not working on generated lightning data #5

Open
@harry9713

Description

I tried with examples given, the function to calculate rpss is giving errors about the absence of dim_0.

version: 1.5.0
python: 3.10.2

code:

import nwpeval as nw

obs, model = lightning_data()
metrics_obj = nw.NWP_Stats(obs.lightning_density, model.lightning_density)
thresholds = {
    'SEDS': 0.6,
    'SEDI': 0.7,
    'RPSS': 0.8
}

# Compute probabilistic metrics with custom thresholds
metrics = ['SEDS', 'SEDI', 'RPSS']
metric_values = metrics_obj.compute_metrics(metrics, thresholds=thresholds)

Error:

[682](file:///C:/Users/kizhu001/AppData/Local/miniforge3/envs/nbase-windows/lib/site-packages/xarray/namedarray/core.py:682) except ValueError:
--> [683](file:///C:/Users/kizhu001/AppData/Local/miniforge3/envs/nbase-windows/lib/site-packages/xarray/namedarray/core.py:683)     raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")

ValueError: 'dim_0' not found in array dimensions ('time', 'lat', 'lon')```

When I tracked the error, it came from the compute_rpss function which expects dim_0 as a native dimension in input. I am not sure if this will be the case in every dataset that we provide.

Possible solution
Standardise the output and input structure of data by enforcing attributes and checking routines.

Please let me know what you think.

Metadata

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomers

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions