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

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.

2 participants