-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix unstack #67
Fix unstack #67
Conversation
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.
Ça me semble une bonne solution!
Petit questionnement sur la généricité (?) à conserver?
xscen/utils.py
Outdated
@@ -106,13 +116,39 @@ def stack_drop_nans( | |||
-------- | |||
unstack_fill_nan : The inverse operation. | |||
""" | |||
|
|||
original_shape = f"{len(ds.lon)}x{len(ds.lat)}" |
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.
Je sais pas à quel point c'était utile, mais l'ancienne version de cette fonction était indépendante des noms de dimensions. On utilise mask.dims
.
Est-ce que ça serait à garder?
Si oui, je propose:
original_shape = f"{len(ds.lon)}x{len(ds.lat)}" | |
original_shape = "x".join(map(str, mask.shape)) |
et il faudrait rendre le reste du code générique aux dims de mask
...
Et si non, il faudrait juste le dire dans la fonction qu'on s'attend à lat
et lon
.
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.
ah ben oui ça serait bien de garder cette flexibilité là. Je vais faire les changements.
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.
The changes I have added will fail if one of the dimensions of ds_stack have an unrelated attrs also named original_shape
, but that feels very unlikely...
Co-authored-by: Pascal Bourgault <bourgault.pascal@ouranos.ca>
Pull Request Checklist:
pre-commit
hooks are installed/active in my local clone ($ pre-commit install
)number
) and pull request (:pull:number
) has been addedWhat kind of change does this PR introduce?
xs.utils.stack_drop_nans
/xs.utils.unstack_fill_nan
format theto_file
/coords
string to add the domain and the initial shape.Does this PR introduce a breaking change?
I don't think so. If you pass a string without {domain} or {shape} as before, the formatting will be ignored.
Other information: