Skip to content

ByChunks(): unecessary checks on target_dims

Hi @nperez

I found one possible bug in ByChunks(). At line 358, the function checks if all the dimensions of input data are consistent. That is, if there are exp and obs, they must have the same lengths of all the common dimensions, like the following dimensions except for member.

# exp.
     data       var    member     sdate      time  latitude longitude 
        1         1        25        36         3        11        51 
# obs
     data       var     sdate      time  latitude longitude 
        1         1        36         3        11        51 

However, the target dimensions for Apply() don't require to have identical lengths. For example, if latitude and longitude are the target dimensions, the lengths don't need to be the same between exp and obs. I changed the check to be on margin dimensions only and it worked well. I also use Apply() directly to the data and it also had no problem. You can find the example at the new use case.

Please let me know if you have any doubts about this change. Meanwhile, I want to include those Compute() use cases into the unit test so we can be more confident in the development.

Cheers,
An-Chi

Edited by aho