Convert vertices to bounds for nD arrays
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
Piste de recherche
Start with cf_xarray/helpers.py and the vertices_to_bounds entry point shown in the traceback. Reproduce the supplied nD DataArray example and compare it with the working single-profile call. Done means the full array with x, y, time, and test dimensions is accepted and converted into the requested bnds and test bounds.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Thank you for developing this amazing package, I am only slowly appreciating its full amazingness.
I am currently trying to convert an array of layer depths that varies in time and space, which represent cell vertices in the vertical into a bound style array.
This is my original array lev_vertices:

For a minimal example you can create a similar array with:
lev_vertices = xr.DataArray(np.arange(9), dims='test').expand_dims(x=2,y=2, time=2)
lev_vertices
I would like to convert the dimension test into bounds.
This works as expected when operating on a single profile:
cf_xarray.vertices_to_bounds(
lev_bounds.isel(time=0,x=0, y=0).load(), out_dims=["bnds", "test"]
)

But I cant figure out how to make this work on the full array...
cf_xarray.vertices_to_bounds(
lev_vertices.load(), out_dims=["bnds", "test"]
)
gives
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-76-4487305bbcdc> in <module>
----> 1 cf_xarray.vertices_to_bounds(
2 lev_vertices.load(), out_dims=["bnds", "test"]
3 )
/scratch/gpfs/jbusecke/conda_tigercpu/envs/aguadv_omz_busecke_2021/lib/python3.8/site-packages/cf_xarray/helpers.py in vertices_to_bounds(vertices, out_dims)
116 )
117 else:
--> 118 raise ValueError(
119 f"vertices format not understood. Got {vertices.dims} with shape {vertices.shape}."
120 )
ValueError: vertices format not understood. Got ('x', 'y', 'time', 'test') with shape (2, 2, 2, 9).
I am wondering if I am missing an option to ignore dimensions here? I was thinking of using xr.map_blocks, but that would impose restrictions on my chunking (which might affect performance). So I first wanted to check in here, and see if there is an easy fix.
- Langage dominant
- Python
- Étoiles
- 183
- Forks
- 52
- Merge moyen
- 2 h 41 min
- PR mergées (30 j)
- 3
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de xarray-contrib/cf-xarray
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
xarray-contrib/cf-xarray#623 ·
Les mainteneurs répondent en général sous 1 jour
-
Consider adding opt-in support for circular axes when calling `bounds_to_vertices` (related to #594)Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
xarray-contrib/cf-xarray#596 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
assert no variable with spaces in name is used for compression by gatheringPeut-être pris @nawaaaaaAaar l’a pris il y a 4 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 25/100
xarray-contrib/cf-xarray#570 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 15/100
xarray-contrib/cf-xarray#568 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
xarray-contrib/cf-xarray#566 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de xarray-contrib/cf-xarray
Issues similaires
-
tests/strategies_test.py:174 goes uncovered on about 1 run in 100, failing the coverage ratchetOuverteflaky-watch
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
btclib-org/btclib#2839 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
nion-software/nionswift#2018 ·
Les mainteneurs répondent en général sous 1 jour
-
Deleting a member fails when another member's share transfer points to themPeut-être pris @Beerlesklopfer l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
FoodCoopX/wirgarten-tapir#1336 ·
Les mainteneurs répondent en général sous 3 jours
-
pydanty:is-working
Difficulté 2/5 1-3 heures Accessibilité débutants 71/100
pydantic/pydantic-ai#11467 ·
Les mainteneurs répondent en général sous 1 jour
-
Link Checker ReportOuverteautomated issue linkchecker report
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
QuantEcon/lecture-python.myst#1098 ·
Les mainteneurs répondent en général sous 1 jour