You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a proof-of-concept for the geoxarray project where I'd like to store coordinate reference system (CRS) information in the coordinates of a DataArray or Dataset object. I'd like to avoid subclassing objects and instead depend completely on xarray accessors to implement any utilities I need.
I'm having trouble deciding what the best place is for this CRS information so that it benefits the user; .coords made the most sense. My hope was that adding two DataArrays together with two different crs coordinates would cause an error, but found out that since crs is not a dimension it doesn't get treated the same way; even when changing join method to 'exact'.
In the above code I was hoping that because the crs coordinates are different (lat_0 and lat_1 are different and crs1 != crs2) that I could get it to raise an exception.
Any ideas for how I might be able to accomplish something like this? I'm not an expert on xarray/pandas indexes, but could this be another possible solution?
Edit: xr.merge with compat='no_conflicts' does detect this difference.
The text was updated successfully, but these errors were encountered:
I think the ideal solution to this would be to make CRS coordinates a virtual "index" of sorts associated with the x/y coordinates that gets checked for equality (and maybe that supports alignment).
Code Sample, a copy-pastable example if possible
I'm working on a proof-of-concept for the
geoxarray
project where I'd like to store coordinate reference system (CRS) information in the coordinates of a DataArray or Dataset object. I'd like to avoid subclassing objects and instead depend completely on xarray accessors to implement any utilities I need.I'm having trouble deciding what the best place is for this CRS information so that it benefits the user;
.coords
made the most sense. My hope was that adding two DataArrays together with two differentcrs
coordinates would cause an error, but found out that sincecrs
is not a dimension it doesn't get treated the same way; even when changingjoin
method to'exact'
.In the above code I was hoping that because the
crs
coordinates are different (lat_0 and lat_1 are different andcrs1 != crs2
) that I could get it to raise an exception.Any ideas for how I might be able to accomplish something like this? I'm not an expert on xarray/pandas indexes, but could this be another possible solution?
Edit:
xr.merge
withcompat='no_conflicts'
does detect this difference.The text was updated successfully, but these errors were encountered: