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 azimuth encoding #73

Merged
merged 1 commit into from
Jul 21, 2020
Merged

Conversation

sfinkens
Copy link
Member

@sfinkens sfinkens commented Jul 17, 2020

Azimuth values are in [-180, 180] since #35, so set offset to 0.0 in order to prevent integer overflow. Relative azimuth difference is in [0, 180] and therefor not affected.

Example: With offset=180 and scale=0.01, a value of azi=-180 would be encoded to -36000, which is beyond the range of int16 (-32768). With offset=0 the maximum encoded values are +/-18000.

Azimuth values are now in [-180, 180], so set offset to 0.0 in
order to prevent integer overflow.
@sfinkens sfinkens self-assigned this Jul 17, 2020
@sfinkens sfinkens added the bug label Jul 17, 2020
Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM

@mraspaud mraspaud merged commit 252045b into pytroll:master Jul 21, 2020
@sfinkens
Copy link
Member Author

For the record: The encoding was fine, because there is actually no offset applied to the angles:

    # Apply scaling & offset
    bt3 -= 273.15
    bt4 -= 273.15
    bt5 -= 273.15
    for array in [bt3, bt4, bt5, ref1, ref2, ref3, sun_zen, sat_zen, sun_azi,
                  sat_azi, rel_azi]:
        array *= 100.0
    for array in [lats, lons]:
        array *= 1000.0

The offset hdf5 attribute (180) was just wrong.

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

Successfully merging this pull request may close these issues.

2 participants