-
Notifications
You must be signed in to change notification settings - Fork 96
Open
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: pytroll/satpy#2565
In the method to determine the optimal radius of influence to be used when reampping data (
pyresample/pyresample/geometry.py
Line 664 in 6a8afc0
def geocentric_resolution(self, ellps='WGS84', radius=None, nadir_factor=2): |
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
Metadata
Metadata
Assignees
Labels
No labels