Closed v-morello closed 2 weeks ago
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! If you have an idea for a solution, we would really welcome a Pull Request with proposed changes. See the Contributing Guide for more. It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better. Thank you!
Because to infer these values, we'd have to execute the whole computation. The model here is to stay lazy, which requires that the user specify a lot of information in the template
.
More generally, since time
is an "indexed coordinate" here, we must know its values eagerly at least for now.
What can we add to the docstring to make this clearer?
@dcherian Thanks for your reply!
The model here is to stay lazy.
OK, I get it now. If we require map_blocks()
to be lazy, then for example .sel()
still needs to work on the result without requiring execution of the map_blocks()
call, and for that the coordinate value must already be present.
What can we add to the docstring to make this clearer?
I leave whether that is necessary to your better judgement (no one seems to have asked that question in the few years of existence of the map_blocks()
function). Something along the lines of what I wrote just above would do the trick IMHO.
What is your issue?
Hello,
I am not sure whether to treat this as a bug or as a feature request yet. The title says it all, and I've attached a minimum example below. Let's say I want to average some data by blocks, but also average its attached time coordinate:
The error is:
Everything works as expected if I provide the correct time coordinate values in the
template
argument. In fact, the example shown in the function documentation does precisely this, but does not explain why it is necessary.I understand why "template" must specify the length of every output dimension and be chunked properly. However, is there a fundamental reason why coordinate values are treated differently from data variables here? I am wondering if that limitation could be removed in principle, because that would help our actual use case (and we might be able to help with a hypothetical fix).