LEEClab / LS_METRICS

A tool for calculating landscape connectivity and other ecologically scaled landscape metrics
GNU General Public License v2.0
22 stars 9 forks source link

LSMetrics does not keep MASKs and process the whole maps #6

Open bniebuhr opened 5 years ago

bniebuhr commented 5 years ago

Just to remark it here: in each function/metric, we need to alow the possibility of processing the metrics either to the whole map or to the MASK, if present.

bniebuhr commented 4 years ago

@miltinhoastronauta , @mauriciovancine

This was based on some user that used LSMetrics before. Do you think we need to include this explicitly in the functions? I guess the mask is already considered, i.e., if there is a mask, the LSMetrics funtions well not change it. However, in the beginning of each calculation, we make sure to do a g.region raster=input_map, which means the region will be the whole map (even if a mask for a smaller part is present). maybe we could just check at this point if a mask is present, and if it is, use g.region raster=MASK.

Does it make sense?

mauriciovancine commented 4 years ago

Hi @bniebuhr.

I do not know if I understand.

My idea was that LSM will perform the calculation of the metrics for the region and mask defined, no?

JohnWRRC commented 4 years ago

Vou no português sorry!

Ola pessoal, Bom dia. Tô acompanhando aqui. Posso dar um palpite? Então faz tempo que não abro o LSMetrics, mas essa função de calcular com máscara é para caso eventuais, geralmente a pessoa já insere o seu dado recortado no tamanho correto, pelo menos é isso que temos que incentivar. Mas, no caso da pessoa ter que fazer diversas em diferentes quadrantes ai blz, pode se utilizar um shp de máscara ou raster para fechar o processamento em determinado local.

Esse lance de máscara tem que ficar bem explicado, porque dá um problemão se a pessoa não entender o que faz.

Precisa ver as extensões dos mapas que estão sendo usadas como máscara como estão, e se o Grass está se orientando por isso. Às vezes o polígono está mostrando um tamanho, mas a real extensão é outra no xmin ymin xmax ymax, entende? Isso pode dar problema também. Para testar isso é só fazer um zoom to layer na camada máscara e ver se ele vai se aproximar da tela ou se vai lá pro fundo.

John

Em sex., 12 de jun. de 2020 às 09:51, Maurício Vancine < notifications@github.com> escreveu:

Hi @bniebuhr https://github.com/bniebuhr.

I do not know if I understand.

My idea was that LSM will perform the calculation of the metrics for the region and mask defined, no?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LEEClab/LS_METRICS/issues/6#issuecomment-643253681, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYCJJZAMV2VP7RGS2SNSR3RWIQFTANCNFSM4GH7QRVQ .

--

John Wesley Ribeiro Empresário OMNILIFE

https://portal.omnilife.com/start

*Desenvolvedor e *Analista e Geotecnologias LATTES:Lattes: http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 Fones: (19)988896342

JohnWRRC commented 4 years ago

Só reforçando agora na dúvida do Mau. São duas coisa bem distintas. Sobre processar com máscara tem que ter um "tic" na interface perguntando (caso já tenha desconsiderem) use mask to process? mesmo que a pessoa tenha setado uma máscara. O fato do usuário simplesmente indicar um mapa como mascara não significa que ele será usado, ele precisará deixar habilitado no tic que irá usar. Parece meio redundante mas não é, veja esse exemplo:.imagine que a pessoa esteja fazendo testes de parametrização e pra economizar tempo setou uma máscara, mas na hora que for pra valer ela não queira máscara, é só desmarcar a opção "use mask to process" ,desmarque o tic.

Em sex., 12 de jun. de 2020 às 10:17, John Wesley Ribeiro < jw.ribeiro.rc@gmail.com> escreveu:

Vou no português sorry!

Ola pessoal, Bom dia. Tô acompanhando aqui. Posso dar um palpite? Então faz tempo que não abro o LSMetrics, mas essa função de calcular com máscara é para caso eventuais, geralmente a pessoa já insere o seu dado recortado no tamanho correto, pelo menos é isso que temos que incentivar. Mas, no caso da pessoa ter que fazer diversas em diferentes quadrantes ai blz, pode se utilizar um shp de máscara ou raster para fechar o processamento em determinado local.

Esse lance de máscara tem que ficar bem explicado, porque dá um problemão se a pessoa não entender o que faz.

Precisa ver as extensões dos mapas que estão sendo usadas como máscara como estão, e se o Grass está se orientando por isso. Às vezes o polígono está mostrando um tamanho, mas a real extensão é outra no xmin ymin xmax ymax, entende? Isso pode dar problema também. Para testar isso é só fazer um zoom to layer na camada máscara e ver se ele vai se aproximar da tela ou se vai lá pro fundo.

John

Em sex., 12 de jun. de 2020 às 09:51, Maurício Vancine < notifications@github.com> escreveu:

Hi @bniebuhr https://github.com/bniebuhr.

I do not know if I understand.

My idea was that LSM will perform the calculation of the metrics for the region and mask defined, no?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LEEClab/LS_METRICS/issues/6#issuecomment-643253681, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYCJJZAMV2VP7RGS2SNSR3RWIQFTANCNFSM4GH7QRVQ .

--

John Wesley Ribeiro Empresário OMNILIFE

https://portal.omnilife.com/start

*Desenvolvedor e *Analista e Geotecnologias LATTES:Lattes: http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 Fones: (19)988896342

--

John Wesley Ribeiro Empresário OMNILIFE

https://portal.omnilife.com/start

*Desenvolvedor e *Analista e Geotecnologias LATTES:Lattes: http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 Fones: (19)988896342

bniebuhr commented 4 years ago

Hi @bniebuhr.

I do not know if I understand.

My idea was that LSM will perform the calculation of the metrics for the region and mask defined, no?

Yes. But currently it does not do anything regarding the MASK. Of course the mask works, but the region is defined based on the _inputmap, even if a mask is present. That means that a great part of the output raster may be composed by NULL pixels (if the mask is a small extent of the _inputmap or even all NULL if the mask is outside the _inputmap of interest.

That's why I think we could look for a MASK in the beginning of the function, then use g.region raster=MASK instead of g.region raster=input_map.

As John suggested, we can also think about an option ignore_mask = False/True. If True, everything keeps the same as it is; otherwise we would follow a rule as I described above (g.region raster=MASK is the mask is present, g.region raster=input_map otherwise).

What do you think?

JohnWRRC commented 4 years ago

Esse é o caminho Ber, o que vc sugeriu mesmo.

if ignore_mask = false: r.mask -r # eu sempre garanto fazendo uma remocao mesmo sabendo que nao tem g.region rast=mapainteiro else: g.region map =rastermask r.mask inp= rastermask

r.mask -r # no fim do codigo la no fim remove a mascara pq se nao pode dar problemas depois que fechar a aplicação

Acho que é isso

Em sex., 12 de jun. de 2020 às 21:40, Bernardo Brandão Niebuhr < notifications@github.com> escreveu:

Hi @bniebuhr https://github.com/bniebuhr.

I do not know if I understand.

My idea was that LSM will perform the calculation of the metrics for the region and mask defined, no?

Yes. But currently it does not do anything regarding the MASK. Of course the mask works, but the region is defined based on the input_map, even if a mask is present. That means that a great part of the output raster may be composed by NULL pixels (if the mask is a small extent of the input_map or even all NULL if the mask is outside the input_map of interest.

That's why I think we could look for a MASK in the beginning of the function, then use g.region raster=MASK instead of g.region raster=input_map.

As John suggested, we can also think about an option ignore_mask = False/True. If True, everything keeps the same as it is; otherwise we would follow a rule as I described above (g.region raster=MASK is the mask is present, g.region raster=input_map otherwise).

What do you think?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LEEClab/LS_METRICS/issues/6#issuecomment-643534135, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYCJJ42KQW7YMMGAQQKV3TRWLDGZANCNFSM4GH7QRVQ .

--

John Wesley Ribeiro Empresário OMNILIFE

https://portal.omnilife.com/start

*Desenvolvedor e *Analista e Geotecnologias LATTES:Lattes: http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 Fones: (19)988896342

bniebuhr commented 4 years ago

Hey John,

I'll keep the text in English, is that ok? So, we are trying to disentangle the code of LSMetrics from the graphical interface, so that it can be used from the command line also, as any other GRASS GIS addon. That will make things very useful for other GRASS GIS users. So I do not think it would be useful to couple this functionality with the GUI. That's why I was thinking whether we should include it in the body of the LSMetrics functions...

bniebuhr commented 4 years ago

Esse é o caminho Ber, o que vc sugeriu mesmo. if ignore_mask = false: r.mask -r # eu sempre garanto fazendo uma remocao mesmo sabendo que nao tem g.region rast=mapainteiro else: g.region map =rastermask r.mask inp= rastermask r.mask -r # no fim do codigo la no fim remove a mascara pq se nao pode dar problemas depois que fechar a aplicação Acho que é isso

Great, John, I haven't seen this answer. But we just need to take care and avoid removing masks, since we want it to be used as any other GRASS GIS addon (see last answer above).

JohnWRRC commented 4 years ago

Blz, Ber, Sobre as mascaras, concordo com vc, isso deve ser algo pensado e bem analisado para gente nao ter problema, mas é coisa simples de resolver.

Eu gostaria de acompanhar e se possível ajudar nesse processo de retirar da GUI. Antes de ir pra GUI ele funcionava fora, claro sem algumas funcionalidades que tem hoje. =)

Vc esta pensando em transformar num addon? Vou atualizar meu fork =)

Abs

Em seg., 15 de jun. de 2020 às 13:33, Bernardo Brandão Niebuhr < notifications@github.com> escreveu:

Esse é o caminho Ber, o que vc sugeriu mesmo. if ignore_mask = false: r.mask -r # eu sempre garanto fazendo uma remocao mesmo sabendo que nao tem g.region rast=mapainteiro else: g.region map =rastermask r.mask inp= rastermask r.mask -r # no fim do codigo la no fim remove a mascara pq se nao pode dar problemas depois que fechar a aplicação Acho que é isso

Great, John, I haven't seen this answer. But we just need to take care and avoid removing masks, since we want it to be used as any other GRASS GIS addon (see last answer above).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LEEClab/LS_METRICS/issues/6#issuecomment-644240467, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYCJJ5EVS4MYOBAMOAD5OTRWZEMPANCNFSM4GH7QRVQ .

--

John Wesley Ribeiro Empresário OMNILIFE

https://portal.omnilife.com/start

*Desenvolvedor e *Analista e Geotecnologias LATTES:Lattes: http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4889487Y8 Fones: (19)988896342