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

Custom implementation on xdggs.decode for dggs plugin? #117

Open
tik65536 opened this issue Dec 20, 2024 · 2 comments
Open

Custom implementation on xdggs.decode for dggs plugin? #117

tik65536 opened this issue Dec 20, 2024 · 2 comments

Comments

@tik65536
Copy link

Heya @keewis ,

Does it make sense / logical to let different dggs(s) implement their decoding method? Or do you have other suggestions on my case?

For my example, there are two possible cases on the input xarray dataset; one is already converted, and the drop_index method works fine; it just re-instantiates the DGGSIndex.
The second one is in 2D ( with x and y coordinates), which I must flatten for conversion. Currently, I am using the stack method as the conversion entry point, like the following :

ds.stack(cell_ids=[coords[0], coords[1]], index_cls=DGGSIndex)

Thx ~

Happy Holiday ~

Tik

@keewis
Copy link
Collaborator

keewis commented Jan 8, 2025

We'll probably have to discuss this in one of the meetings, but xdggs is very much centered on the assumption that cell ids are 1D (especially since the multi-index coordinate is at the beginning of a deprecation cycle, in the future pandas.MultiIndex will be just another index). As such, I'm somewhat hesitant to add support for something like that.

@tik65536
Copy link
Author

tik65536 commented Jan 8, 2025

Sure, maybe during the meeting next Monday. Probably, I misunderstand the purpose of the decode function? The purpose of it is aim to re-instantiate the cell_ids column with xdggs , instead of conversion?

I will provide a simple use case for the discussion :

The user has a xarray with x,y coordinates as shown below :

To convert the xarray coordinate from x,y to xdggs, the user has to perform
raster_data.stack(cell_ids={x,y}) then xdggs.decode(raster_data).

But the problem is that after the stack, the cell_ids column will be convert to pandas.multiIndex as follow :

Look forward to discuss with u ~

Thanks,
Tik

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