Error in vertical interpolation on a 3D grid
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza con la llamada a interplevel y la validación en specialdec.py alrededor de la línea 681. Compara la forma reportada de height_levels (10, 159, 154) con la forma de Z (49, 159, 154), y determina las dimensiones esperadas para los niveles verticales 3D. Se considera terminado cuando el caso de interpolación reportado se gestiona de forma coherente o se establece claramente la forma de entrada requerida.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hello all,
I'm trying to vertically interpolate few variables on a 3D grid. I have created 10 vertical levels between the 5m to mixing height. The height_levels are defined separately for each grid point. It is a 3D array with shape (10,159,154), where 159 are the latitudes and 154 are the longitudes.
num_levels= 10
for t in range(len(ds['Time'])):
pblh_t = ds['PBLH'].isel(Time=t).values
height_levels = np.logspace(np.log10(5), np.log10(pblh_t), num_levels)
field = ds[var].isel(Time=t)
Z = ds['Z_center'].isel(Time=t)
interpolated_data = interplevel(field, Z, height_levels)
The shape and the dimension of field and Z is matching exactly. However, this code is giving the following error:
File ~/miniconda3/envs/spyder-env/lib/python3.9/site-packages/wrf/specialdec.py:685 in func_wrapper
"the same leftmost and rightmost "
ValueError: argument 1 and 2 must have the same leftmost and rightmost dimensions.
If i give a list of values to interpolate, for example: height_levels = [50, 100,200,300]. code works fine and give the results without any error.
on inspecting the specialdec.py file, following are the lines which are raising the error
line:681
if is2dlev:
if levels.ndim != 2:
if (levels.shape[0:-2] != z.shape[0:-3] or
levels.shape[-2:] != z.shape[-2:]):
raise ValueError("argument 1 and 2 must have "
"the same leftmost and rightmost "
"dimensions")
For my case, levels.shape[-2:] = z.shape[-2:]),
height_levels.shape[-2:]
Out[99]: (159, 154)
Z.shape[-2:]
Out[100]: (159, 154)
but,
height_levels.shape[0:-2]
Out[101]: (10,)
Z.shape[0:-3]
Out[102]: ()
Z.shape[0:-3] is empty since the Z has only 3 dimensions (49,159,154). Here, 49 is the number of the model levels.
Can anyone please help me fix this.
Thank you for your time!!!
- Lenguaje dominante
- Python
- Estrellas
- 498
- Forks
- 178
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NCAR/wrf-python
-
NCAR/wrf-python#309 · 1 asignado ·
-
Windows builds on conda-forge Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
NCAR/wrf-python#307 · 5 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
NCAR/wrf-python#286 · 3 comentarios ·
-
Windows builds and testing Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
NCAR/wrf-python#282 · 1 comentario ·
-
PyPI releases Abierto
NCAR/wrf-python#274 · 5 comentarios · 1 reacción · 1 asignado ·
Todos los issues de NCAR/wrf-python
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stephrobert/dsoxlab#238 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
sublimehq/package_control#1780 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
nwg-piotr/nwg-displays#145 ·