Skip to content

r.colors: fix order of rules#2167

Merged
metzm merged 1 commit intoOSGeo:mainfrom
metzm:r.colors
Feb 7, 2022
Merged

r.colors: fix order of rules#2167
metzm merged 1 commit intoOSGeo:mainfrom
metzm:r.colors

Conversation

@metzm
Copy link
Contributor

@metzm metzm commented Feb 4, 2022

When applying scale and/or offset to r.colors, color rules were written out in reverse order. This PR fixes the ordering of color rules.

GRASS itself has no problems with a reverse order of color rules, but r.colors.out and subsequent r.colors.out_sld create broken output.

@metzm metzm added bug Something isn't working backport_needed raster Related to raster data processing C Related code is in C labels Feb 4, 2022
@metzm metzm added this to the 8.0.1 milestone Feb 4, 2022
@metzm metzm requested a review from neteler February 4, 2022 16:24
@metzm
Copy link
Contributor Author

metzm commented Feb 4, 2022

How to test in the NC sample dataset:

g.region raster=elev_state_500m
g.copy rast=elev_state_500m,my_elev_state_500m
# no scale, all fine
r.colors map=my_elev_state_500m color=srtm_plus
r.colors.out_sld map=my_elev_state_500m
# scale, should not have reverse ordering
r.colors map=my_elev_state_500m color=srtm_plus scale=0.5
r.colors.out_sld map=my_elev_state_500m

Copy link
Member

@neteler neteler left a comment

Choose a reason for hiding this comment

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

Thanks, the example works fine.

@metzm metzm merged commit 150a0e9 into OSGeo:main Feb 7, 2022
@metzm metzm deleted the r.colors branch February 7, 2022 21:06
@metzm
Copy link
Contributor Author

metzm commented Feb 7, 2022

TODO: backport 150a0e9

neteler pushed a commit that referenced this pull request Feb 7, 2022
The order of rules was reversed if scale and/or offset were needed.
@neteler
Copy link
Member

neteler commented Feb 7, 2022

TODO: backport 150a0e9

done!

ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
The order of rules was reversed if scale and/or offset were needed.
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
The order of rules was reversed if scale and/or offset were needed.
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
The order of rules was reversed if scale and/or offset were needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working C Related code is in C raster Related to raster data processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants