The EWA resampler currently fails when trying to resample a METimage/VII swath.
To reproduce:
scn = Scene(filenames=filenames, reader='vii_l1b_nc')
scn.load(["vii_10690"])
scn_r = scn.resample("EPSG_4326_720x360", resampler='ewa', rows_per_scan=24)
scn_r.save_datasets(writer='simple_image')
results in
Traceback (most recent call last):
File "/tcenas/home/andream/anaconda3/envs/devenv/lib/python3.11/site-packages/dask/base.py", line 662, in compute
results = schedule(dsk, keys, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tcenas/home/andream/code/satpy_latest/pyresample/pyresample/ewa/dask_ewa.py", line 60, in _call_ll2cr
swath_points_in_grid, cols, rows = ll2cr(new_src, target_geo_def)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tcenas/home/andream/code/satpy_latest/pyresample/pyresample/ewa/ewa.py", line 78, in ll2cr
swath_points_in_grid = _ll2cr.ll2cr_static(lons, lats, fill,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pyresample/ewa/_ll2cr.pyx", line 242, in pyresample.ewa._ll2cr.ll2cr_static
File "<stringsource>", line 664, in View.MemoryView.memoryview_cwrapper
File "<stringsource>", line 352, in View.MemoryView.memoryview.__cinit__
ValueError: ndarray is not C-contiguous
A simple fix seems to be adding the following lines after this block (where the lonlats are already computed ndarrays)
|
lons, lats = swath_def.get_lonlats() |
|
# ll2cr requires 64-bit floats due to pyproj limitations |
|
# also need a copy of lons, lats since they are written to in-place |
|
try: |
|
lons = lons.astype(np.float64, copy=copy) |
|
lats = lats.astype(np.float64, copy=copy) |
|
except TypeError: |
|
lons = lons.astype(np.float64) |
|
lats = lats.astype(np.float64) |
|
|
lons = np.ascontiguousarray(lons)
lats = np.ascontiguousarray(lats)
Is this a good idea? Or is there a better way?
Fixing it at the source without breaking lazyness is probably not trivial, due to the lon-lats of METimage being computed with rather complex geotiepoints interpolations and coordinate transforms...
cc @cesclc
The EWA resampler currently fails when trying to resample a METimage/VII swath.
To reproduce:
results in
A simple fix seems to be adding the following lines after this block (where the lonlats are already computed ndarrays)
pyresample/pyresample/ewa/ewa.py
Lines 59 to 68 in 5d91b3a
Is this a good idea? Or is there a better way?
Fixing it at the source without breaking lazyness is probably not trivial, due to the lon-lats of METimage being computed with rather complex geotiepoints interpolations and coordinate transforms...
cc @cesclc