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

random multi band raster stack #56

Open
wegmann opened this issue Feb 3, 2019 · 4 comments
Open

random multi band raster stack #56

wegmann opened this issue Feb 3, 2019 · 4 comments

Comments

@wegmann
Copy link

wegmann commented Feb 3, 2019

Hello,

NLMR is a great package and perfect for a variety of random landscapes. I just stumbled across a small issue:

I try to create random multi-band stacks were the band values are corresponding e.g. if low value in raster A always high values in raster B, similar to an actual remote sensing multi-band raster stack.

Have you already had a similar issue and could provide a way how to achieve it? thanks

@marcosci
Copy link
Collaborator

marcosci commented Feb 8, 2019

Hi Martin,

I am not sure if I can follow there - you mean something in the line of RGB bands? Aren't there the values positively correlated?

If you meant something like that, you only want to add noise and not the general direction of the pattern, or? This could be done via:

library(NLMR)
library(landscapetools)

landscape_red <- nlm_fbm(50, 100) 

landscape_blue <- util_merge(landscape_red, 
                             nlm_fbm(50, 100), 
                             scalingfactor = 0.8)

landscape_green <- util_merge(landscape_red, 
                              nlm_fbm(50, 100),
                              scalingfactor = 0.8)


show_landscape(list("Red" = landscape_red,
                    "Blue" = landscape_blue,
                    "Green" = landscape_green))

image

... or is the pattern supposed to look exactly vice versa?

@wegmann
Copy link
Author

wegmann commented Feb 8, 2019

Hi Marco,

thanks I will check it out. Looks good. I wanted to simulate actual multi band remote sensing data patterns. I will check if your suggestions works out. best, martin

@marcosci
Copy link
Collaborator

marcosci commented Feb 8, 2019

Sure, let me know if that is what you wanted, otherwise I'll try to come up with a solution.

@wegmann
Copy link
Author

wegmann commented Feb 15, 2019

Hi Marco,

I tried it but I did not get a result I was expecting. I stacked the raster files and plotted them as RGB.

library(raster)
 x <- stack(landscape_blue, landscape_green, landscape_red)

 plotRGB(x, 3,2,1,stretch="lin")
 plotRGB(x, 1,2,3,stretch="lin")

first the maps should be quite colourful and secondly the band combination should change the colour settings while keeping the patterns.

With an actual remote sensing multi-band raster stack it would look like this:

 library(RStoolbox)
 data(lsat)
 plotRGB(lsat, 3,2,1, stretch="lin")
 plotRGB(lsat, 4,1,3, stretch="lin")

and it would be great to create corresponding random layer for mimicking a multi-band raster set where the single bands/values are linked to each other.

sorry, if I have missed some util_merge options or other commands that could do that already. thanks, Martin

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

No branches or pull requests

2 participants