-
Notifications
You must be signed in to change notification settings - Fork 287
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
AHI HSD true_color incorrect with cache_sensor_angles #2010
Comments
I've started looking at this, but I have a couple questions. Is there a reason you don't cache lonlats while at the same time cache the sensor angles? Could you past the list of filenames your |
So this line seems to be at exactly 140 degrees East longitude. I don't see a clear horizontal line and I also don't see this line go all the way up the image. This makes me wonder if it is some kind of divide by zero that is happening with the arguments being rounded when given to caching. Edit: 🤦 140.25 is the reference longitude of the satellite |
Further debugging where I also see the issue: import os
os.environ["PYTROLL_CHUNK_SIZE"] = "1100"
import satpy
from satpy import Scene, DataQuery
from glob import glob
from dask.diagnostics import ProgressBar
product = DataQuery(name="B03", modifiers=("sunz_corrected", "rayleigh_corrected"))
with ProgressBar(), satpy.config.set(cache_lonlats=False, cache_sensor_angles=True):
scn = Scene(reader="ahi_hsd", filenames=glob("/data/satellite/ahi/hsd/2330/HS_H08_20181112_2330_B??_FLDK*_S*"))
scn.load([product])
new_scn = scn.resample(resampler="native")
new_scn.save_datasets(base_dir=".") |
The above works for B01 also (works as in produces a bad image). I did another hack where I commented out line 229-230 in Edit: And setting the starting date to 2000-01-02 12:00:00 (one day later) seems to work just fine. It must be some divide by zero equivalent with using the initial Greenwich mean sidereal time. |
I was just proving it was caching of sensor angles, as my first guess was it was lat-lon related given the obvious latitudinal deliniation. Mentions of date/time and AHI smells a bit like #1384 - I wonder if there is some connection... |
#1384 was purely for the HRIT variant of the data, and the |
As @pnuu said, #1384 was purely HRIT, but it seems HSD suffers from a similar problem. The start times defined in the HSD data are all slightly different (I don't remember exactly how far off right now) so regular uncache generation of the "sunz_corrected" modifier is actually computing the sun angles 3 separate times for each input band. When caching is used it replaces the start time with one static time when generating sensor zenith angles but not solar zenith angles. Without caching this effects both solar and sensor angle generations, but also includes things like the satellite height which were slightly different between bands. Looking at the HSD reader it looks like there is a As for this issue, I will investigate further but I think this is mainly an issue with the static hardcoded start_time used in the cached angle generation. It results in |
@djhoese How far different are the start times? |
|
That seems pretty much the same as |
So when it comes to sensor angles the main piece of code is the def gmst(utc_time):
"""Greenwich mean sidereal utc_time, in radians.
As defined in the AIAA 2006 implementation:
http://www.celestrak.com/publications/AIAA/2006-6753/
"""
ut1 = jdays2000(utc_time) / 36525.0
theta = 67310.54841 + ut1 * (876600 * 3600 + 8640184.812866 + ut1 *
(0.093104 - ut1 * 6.2 * 10e-6))
return np.deg2rad(theta / 240.0) % (2 * np.pi) The |
And its not like the returned value from In [1]: from pyorbital.astronomy import gmst
In [2]: from datetime import datetime, timedelta
In [3]: gmst(datetime(2000, 1, 1, 12, 0, 0))
Out[3]: 4.894961212823059
In [4]: gmst(datetime(2000, 1, 1, 12, 0, 1)) # one second difference
Out[4]: 4.895034133981612
In [5]: gmst(datetime(2000, 1, 1, 13, 0, 0)) # one hour difference
Out[5]: 5.157477383614096
In [6]: gmst(datetime(2000, 1, 2, 12, 0, 0)) # one day difference
Out[6]: 4.912164004628369 |
Ugh and now I tried hardcoding the start_time to the 2020-01-0112:00:00 but use the real sat position values and that worked fine. |
I figured it out. The caching was swapping the zarr filenames so it was returning sensor azimuth and zenith and sensor zenith as azimuth. Son of a... |
Fixed in #2013. Let me know if you can test it and how it goes. |
Oops. For some reason I thought @Plantain had already tested this. I guess now that it is merged into |
I can confirm this appears to fix the issue! Thanks! |
Expected behaviour:
Imagery should be bit-for-bit, or at least visually indistinguishable with cache_sensor_angles=True or False
Actual Behaviour:
![sensor](https://user-images.githubusercontent.com/319895/152675678-f28deea4-3ce7-49a9-b869-e77d758bf6e5.png)
![no_sensor](https://user-images.githubusercontent.com/319895/152675680-d7fbf976-c11b-4826-b1d8-f51440c2e2bd.png)
Very different imagery, including a large seam line
True
False
Sample code
Environment Info:
satpy git
pyresample git
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: