Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Resampling swath to another swath: no attribute get_proj_coords

Aperta
#436 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
numpy, python
Ambito
data

Direzione di ricerca

Riproduci il malfunzionamento con SwathDefinition e un resampler bilineare, poi leggi pyresample/bilinear/xarr.py e pyresample/bilinear/_base.py nelle sezioni intorno a get_bil_info, _get_fractional_distances e _get_output_xy. Controlla la documentazione swath-to-swath e determina la gestione prevista delle coordinate e le unità di radius-of-influence. Il lavoro è completato quando sia XArrayBilinearResampler sia NumpyBilinearResampler supportano il caso documentato oppure ne documentano chiaramente la limitazione, con copertura di regressione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

According to the Resampling of swath data docs:

Pyresample can be used to resample a swath dataset to a grid, a grid to a swath or a swath to another swath.

but if

from pyresample import geometry
from pyresample.bilinear import XArrayBilinearResampler

# Missing variable definitions omitted for simplicity,
# but all 2D arrays, and radius_of_influence a number > 0 representing metres
source_def = geometry.SwathDefinition(lons=lons_s, lats=lats_s)
target_def = geometry.SwathDefinition(lons=lons_t, lats=lats_t)
resampler = XArrayBilinearResampler(source_def, target_def, radius_of_influence)
result = resampler.resample(data)

then the following error is raised:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/amell/test/whiteboard.ipynb Cell 27' in <cell line: 1>()
----> [1](vscode-notebook-cell://home/amell/test/whiteboard.ipynb#ch0000027vscode-remote?line=0) resampled_surface_precipitation = resampler.resample(ds_gpm_subset.surface_precipitation.values)

File ~/miniconda3/envs/test/lib/python3.10/site-packages/pyresample/bilinear/xarr.py:71, in XArrayBilinearResampler.resample(***failed resolving arguments***)
     69 """Resample the given data."""
     70 del nprocs
---> 71 self.get_bil_info()
     72 return self.get_sample_from_bil_info(data, fill_value=fill_value, output_shape=None)

File ~/miniconda3/envs/test/lib/python3.10/site-packages/pyresample/bilinear/_base.py:118, in BilinearBase.get_bil_info(self, kdtree_class, nprocs)
    115 self._get_index_array()
    117 # Calculate vertical and horizontal fractional distances t and s
--> 118 self._get_fractional_distances()
    119 self._get_target_proj_vectors()
    120 self._get_slices()

File ~/miniconda3/envs/test/lib/python3.10/site-packages/pyresample/bilinear/_base.py:165, in BilinearBase._get_fractional_distances(self)
    164 def _get_fractional_distances(self):
--> 165     out_x, out_y = self._get_output_xy()
    166     # Get the four closest corner points around each output location
    167     corner_points, self._index_array = \
    168         _get_four_closest_corners(*self._get_input_xy(),
    169                                   out_x, out_y,
...
    217 def _get_output_xy(target_geo_def):
--> 218     out_x, out_y = target_geo_def.get_proj_coords(chunks=CHUNK_SIZE)
    219     return da.compute(np.ravel(out_x), np.ravel(out_y))

AttributeError: 'SwathDefinition' object has no attribute 'get_proj_coords'

The same happens if NumpyBilinearResampler is used in place of XArrayBilinearResampler.

I expected pyresample to be consistent with the docs. On the other hand, in this example I expect that radius_of_influence is used on the WSG84, and not on some Cartesian coordinates.

Versions used:

  • Python: 3.10.4
  • Pyresample: 1.23.0
Lingua principale
Python
Stelle
388
Fork
103
Merge medio
7g 4h
PR unite (30g)
4

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pytroll/pyresample

Tutte le issue di pytroll/pyresample

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.