Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dim handling issues #18

Closed
rob-taggart opened this issue Jun 15, 2023 · 4 comments
Closed

dim handling issues #18

rob-taggart opened this issue Jun 15, 2023 · 4 comments

Comments

@rob-taggart
Copy link
Collaborator

I did some testing of dim handling using mse from main in a jupyter notebook.

Here is some code and problems I found.

fcst = xr.DataArray(
    data=[[1., 2, 3], [2, 3, 4]],
    dims=['stn', 'date'],
    coords=dict(stn=[101, 102], date=['2022-01-01', '2022-01-02', '2022-01-03'])
)
obs = xr.DataArray(
    data=[[0., 2, 4], [.5, 2.2, 3.5]],
    dims=['source', 'date'],
    coords=dict(source=['a', 'b'], date=['2022-01-01', '2022-01-02', '2022-01-03'])
)
  1. mse(fcst, obs, reduce_dims=[]) returns a single value (i.e. reduces all dimensions). It would be preferable if it reduced no dimensions.
  2. mse(fcst, obs, preserve_dims=['source', 'date', 'stn']) returns a single value (i.e. reduces all dimensions) rather than an array with all dimensions preserved. Same as mse(fcst, fcst, preserve_dims=fcst.dims)
  3. The docstring for mse says, for 'preserve_dims', that "the forecast and observed dimensions must match precisely". This can be removed as it works perfectly fine if they don't match (using usual xarray broadcasting) and I don't think it is even desirable that fcst and obs have matching dimensions.
@rob-taggart
Copy link
Collaborator Author

@tennlee , @aidanjgriffiths

@tennlee
Copy link
Collaborator

tennlee commented Jun 22, 2023

Thank you very much for your investigations. I will start on fixes for each point and raise new issues for each individually, and then link those back here.

@tennlee
Copy link
Collaborator

tennlee commented Jul 26, 2023

All three of these points ended up being addressed through the response to issue #19, and so this can now be closed.

@tennlee tennlee closed this as completed Jul 26, 2023
@tennlee
Copy link
Collaborator

tennlee commented Jul 26, 2023

Closing

tennlee pushed a commit that referenced this issue Jun 24, 2024
* Draft paper for submission to JOSS
For editing history, see branch 51-joss-paper-draft
This branch will track the submission process

* Adjust in statement of need
* Adding contingency table metrics to categorical section of table
tennlee pushed a commit that referenced this issue Jun 24, 2024
* Draft paper for submission to JOSS
For editing history, see branch 51-joss-paper-draft
This branch will track the submission process

* Adjust in statement of need
* Adding contingency table metrics to categorical section of table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants