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

Load as dataset and use name in data_vars #56

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ValentinaHutter
Copy link

We are saving our netcdf results as xr.DataSets with the variables being either the "bands" or if no "bands" dimension is found, with the single variable "name".

data = data.to_dataarray(dim=band_dim_name)
data = data.to_array(dim=band_dim_name)
except ValueError:
data = xarray.open_dataarray(path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you switch to trying open_dataset first, is it actually still necessary to do the try-except? As far as I know, open_dataset will also work on data arrays, so doing open_dataarray on except might be useless

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not implement the initial try-except code, so I am not sure to be honest. For eodc's results it should not be required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these try-except constructs were originally introduced by @clausmichele I think, e.g. like in c8b6f51 so maybe he can comment if the try-except can be dropped if open_dataset will be used from first time

Copy link
Member

@clausmichele clausmichele Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, on our side we still use DataArray most of the times (which is the internal format used by openeo-processes-dask), that's why I was checking that.

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

Successfully merging this pull request may close these issues.

3 participants