Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix derivation of correct radius of influence when data layout is not standard #555

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adybbroe
Copy link
Contributor

@adybbroe adybbroe commented Nov 17, 2023

This is supposed to solve #554

Make use of the fact that longitudes are an xarray data array and use 'y' dimension for rows/scanlines

This makes the code resilient towards any other (awkward) data layout than the standard (where first dimension is usually the rows).

…e 'y' dimension for rows/scanlines

This makes the code resillient towards any other (awkward) data layout than the standard (where first dimension is usually the rows.


Signed-off-by: Adam.Dybbroe <[email protected]>
@adybbroe adybbroe self-assigned this Nov 17, 2023
@adybbroe
Copy link
Contributor Author

It looks like I can assume that self.lons is an Xarray DataArray, and never (just) a numpy array, correct?

@djhoese
Copy link
Member

djhoese commented Nov 17, 2023

It looks like I can assume that self.lons is an Xarray DataArray, and never (just) a numpy array, correct?

For Satpy, yes, but we can't (and shouldn't) make that assumption for pyresample.

@adybbroe
Copy link
Contributor Author

It looks like I can assume that self.lons is an Xarray DataArray, and never (just) a numpy array, correct?

For Satpy, yes, but we can't (and shouldn't) make that assumption for pyresample.

Ok, got me there then! I was looking for tests on that, but found only with xarray, but possible that I just overlooked such tests...

Copy link

codecov bot commented Nov 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.14%. Comparing base (6a8afc0) to head (a7650f4).
Report is 341 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #555      +/-   ##
==========================================
+ Coverage   94.11%   94.14%   +0.03%     
==========================================
  Files          82       84       +2     
  Lines       13078    13199     +121     
==========================================
+ Hits        12308    12426     +118     
- Misses        770      773       +3     
Flag Coverage Δ
unittests 94.14% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coveralls
Copy link

coveralls commented Nov 17, 2023

Coverage Status

coverage: 93.725% (+0.04%) from 93.69%
when pulling a7650f4 on adybbroe:finding-geocentric-resolution-resilient-to-data-layout
into 6a8afc0 on pytroll:main.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review my comment on the issue you made:

#554 (comment)

@@ -28,6 +28,7 @@
from typing import Optional, Sequence, Union

import numpy as np
import xarray as xr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes xarray a hard requirement on pyresample which it is not. Plus DataArray is already imported in a try/except below.

Comment on lines 701 to 704
# Data have no information on dimensions, so we assume first dimension (the rows) is the y-axis:
logger.warning('As Numpy data arrays carry no information on the data layout we here ' +
'assume the first dimension (the rows) is the y-axis (the satellite scans)')
rows = self.shape[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So users get a warning for every execution of this method? No, we can't do this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warnings.warn would in theory only issue a warning on the first execution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol right, sure, but the overall point still stands. I would still prefer that users receive no warning for a usage that has existed for years and years and is perfectly fine in 99.9999% of cases that we run into.

My preference is still that the Satpy reader reorient data, but I also have no experience with that instrument.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I take back the "years and years" thing, I thought this was a different method being modified...but still.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that in this particular case, there should be no warning at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, very good, I did trigger a reaction here! I was pretty sure you wouldn't like this when I wrote it, but wanted to discuss it. Done now. So sorry, I take it back again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, very good, I did trigger a reaction here! I was pretty sure you wouldn't like this when I wrote it, but wanted to discuss it. Done now. So sorry, I take it back again.

@adybbroe
Copy link
Contributor Author

@djhoese I made a comment in the issue: #554 (comment)

Which solution do you propose I pursue? And does @gerritholl and @mraspaud have opinions as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants