Skip to content

r.out.gdal: add offset/scale options #1992

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

Merged
merged 7 commits into from
Nov 30, 2021
Merged

Conversation

landam
Copy link
Member

@landam landam commented Nov 27, 2021

This PR adds two new parameters to r.out.gdal:

     offset   Assign a specified offset value to output bands
      scale   Assign a specified scale value to output bands

Example:

r.out.gdal input=random output=random.tif offset=100 scale=0.01

gdalinfo random.tif
...
Band 1 Block=100x40 Type=UInt16, ColorInterp=Palette
  Description = random
    Computed Min/Max=1.000,3661.000
  NoData Value=65535
  Offset: 100,   Scale:0.01
...

@landam landam requested review from neteler and metzm November 27, 2021 17:19
@landam landam self-assigned this Nov 27, 2021
@landam landam added enhancement New feature or request raster Related to raster data processing labels Nov 27, 2021
@landam landam added this to the 8.2.0 milestone Nov 27, 2021
@landam landam added the C Related code is in C label Nov 27, 2021
@metzm
Copy link
Contributor

metzm commented Nov 28, 2021

Explanation for my suggested changes:
Offset is only relevant if not zero. Scale is only relevant if not 1.
PR approval comes after your comments to my suggestions.

The motivation for my suggestions is to not clutter metadata with irrelevant information.

How about the need to set different offset and scale parameters for different bands in case a group is exported? I guess there is no such need, most probably you also don't see such a need.

@landam
Copy link
Member Author

landam commented Nov 29, 2021

Offset is only relevant if not zero. Scale is only relevant if not 1. PR approval comes after your comments to my suggestions.
The motivation for my suggestions is to not clutter metadata with irrelevant information.

OK, make sense.

How about the need to set different offset and scale parameters for different bands in case a group is exported? I guess there is no such need, most probably you also don't see such a need.

You are right, it's limitation of the current implementation.

@landam landam requested a review from metzm November 29, 2021 19:36
Copy link
Contributor

@metzm metzm left a comment

Choose a reason for hiding this comment

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

Looks good. Let's see if there is a need for different offset/scale values per band.

@landam landam merged commit eca1d2f into OSGeo:main Nov 30, 2021
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
* Apply suggestions from code review

Co-authored-by: Markus Metz <[email protected]>
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
* Apply suggestions from code review

Co-authored-by: Markus Metz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C enhancement New feature or request raster Related to raster data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants