Open keewis opened 3 years ago
Related: There's some weirdness about _to_temp_dataset
not preserving name
. I had to work around that for map_blocks
that's true. I guess for that there's the name
parameter to _from_temp_dataset
, which of course can't be used if _to_temp_dataset
and _from_temp_dataset
are called in different functions.
That seems very reasonable.
To the extent the goal is "apply a function that takes a dataset to this dataarray", we could make a function that does exactly that and use _to_temp_dataset
within that. Does that make sense?
To the extent the goal is "apply a function that takes a dataset to this dataarray", we could make a function that does exactly that and use
_to_temp_dataset
within that.
yes, I think that would work, too.
Related: There's some weirdness about
_to_temp_dataset
not preservingname
.
It used to preserve name, but now name
is always set to the _THIS_ARRAY
object. This is for two reasons:
name
, if name
is also found on a coordinate.name
in case (1), then it's likely that some functions wouldn't handle names of that form and would produce an error only in that case.To the extent the goal is "apply a function that takes a dataset to this dataarray", we could make a function that does exactly that and use
_to_temp_dataset
within that. Does that make sense?
This sounds like a fine idea to me. It's kind of the opposite of Dataset.map
.
When writing accessors which behave the same for both
Dataset
andDataArray
, it would be incredibly useful to be able to useDataArray._to_temp_dataset
/DataArray._from_temp_dataset
to deduplicate code. Is it safe to use those in external packages (likepint-xarray
)?Otherwise I guess it would be possible to use
but that seems less efficient.