-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: main
Are you sure you want to change the base?
Load as dataset and use name in data_vars #56
Conversation
data = data.to_dataarray(dim=band_dim_name) | ||
data = data.to_array(dim=band_dim_name) | ||
except ValueError: | ||
data = xarray.open_dataarray(path) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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".