The finding of the optimal radius of influence makes assumption on the ordering of the dimensions in the longitude array
@adybbroe is already working on this.
Since Nov 17, 2023.
- Dominant language
- Python
- Stars
- 385
- Forks
- 102
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 9
Description
Code Sample, a minimal, complete, and verifiable piece of code
The problem is well illustrated by reading and trying to remap the AWS tesdata:
>>> from satpy import Scene
>>> FILENAMES = ["/home/a000680/data/aws_testdata_from_nigel/W_XX-OHB-Stockholm,SAT,AWS1-MWR-1B-RAD_C_OHB_20230816120142_G_D_20240115111111_20240115125434_T_B____radsim.nc"]
>>> AREAID = 'eurol'
>>> scn = Scene(filenames=FILENAMES, reader='aws_l1b_nc')
>>> scn.load(['1'])
>>> local = scn.resample(AREAID)
>>> local.show('1')
Could not calculate source definition resolution
See the comments in the Satpy PR here: https://github.com/pytroll/satpy/pull/2565
In the method to determine the optimal radius of influence to be used when reampping data (https://github.com/pytroll/pyresample/blob/6a8afc0085e0b4269f00991ab79fe1b3766bb817/pyresample/geometry.py#L664) the assumption is that the first dimension on the longitude array dscribes the scanlines/rows of the (e.g. channel) dataset.
The specific code lines that should be adapted in case that self.lons is an xarray.DataArray is this part I believe:
rows = self.shape[0]
start_row = rows // 2 # middle row
src = CRS('+proj=latlong +datum=WGS84')
if radius:
dst = CRS("+proj=cart +a={} +b={}".format(radius, radius))
else:
dst = CRS("+proj=cart +ellps={}".format(ellps))
# simply take the first two columns of the middle of the swath
lons = self.lons[start_row: start_row + 1, :2]
lats = self.lats[start_row: start_row + 1, :2]
I would propose something like this instead:
rows = self.lons['y'].shape[0]
start_row = rows // 2 # middle row
src = CRS('+proj=latlong +datum=WGS84')
if radius:
dst = CRS("+proj=cart +a={} +b={}".format(radius, radius))
else:
dst = CRS("+proj=cart +ellps={}".format(ellps))
# simply take the first two columns of the middle of the swath
lons = self.lons.sel(y=start_row)[:2]
lats = self.lats.sel(y=start_row)[:2]
Problem description
[this should also explain why the current behaviour is a problem and why the
expected output is a better solution.]
Expected Output
Actual Result, Traceback if applicable
Versions of Python, package at hand and relevant dependencies
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.