Re: [Qgis-user] Raster Calculator - If statements

2014-02-24 Thread Carlos Cerdán
Hi Jonathan:

As I said, this works band by band... so I think maybe you would can do:

ZERO For Band 1 : (band1@1<=145 and band2@1<=145 and band3@1<=145)*band1@1
ZERO For Band 2 : (band1@1<=145 and band2@1<=145 and band3@1<=145)*band2@1
ZERO For Band 3 : (band1@1<=145 and band2@1<=145 and band3@1<=145)*band3@1

NULL For Band 1 : ( ((band1@1<=145 and band2@1<=145 and band3@1<=145)*band1@1)
/ ((band1@1<=145 and band2@1<=145 and band3@1<=145)*band1@1) ) * band1@1
NULL For Band 2 : ( ((band1@1<=145 and band2@1<=145 and band3@1<=145)*band2@1)
/ ((band1@1<=145 and band2@1<=145 and band3@1<=145)*band2@1) ) * band2@1
NULL For Band 3 : ( ((band1@1<=145 and band2@1<=145 and band3@1<=145)*band3@1)
/ ((band1@1<=145 and band2@1<=145 and band3@1<=145)*band3@1) ) * band3@1

After that, you'll must have to merge this bands (Raster-->Miscellany -->
Merge )

Good Luck

Carlos


2014-02-24 9:30 GMT-05:00 Jonathan Moules <
jonathanmou...@warwickshire.gov.uk>:

> Hi Carlos,
>   Thanks for your thoughts. One observation - it appears that you are only
> checking a single band at a time.
> However I only want the values to be changed if ALL bands have a value of
> >145. If only one or even two of the values are >145 then nothing should be
> changed, it's only when all three are that I want it to be triggered.
>
> That makes the problem even more tricky. :-)
> Kind Regards,
> Jonathan
>
>
>
> On 21 February 2014 21:40, Carlos Cerdán  wrote:
>
>> Hi Jonathan:
>>
>> Interesting puzzle. You can get what you wish if you use GRASS (r.mapcalc
>> and r.null). With QGIS I just got zero or null, but band by band:
>>
>> ZERO : (band1@1<=145)*band1@1
>>
>> NULL : ( ((band1@1<=145)*band1@1) / ((band1@1<=145)*band1@1) ) * band1@1
>>
>> Explanation:
>>
>> 1. ZERO: When condition in parenthesis is true, it goes 1, if doesn't, 0.
>> After that, multiply by the same band, so result is 0 in cells that
>> original value was major than 145, and it's the same value as original in
>> other cells.
>>
>> 2. NULL: We have same prior value  divided by himself. In cells where we
>> got 0, now will get NULL, and the original value in other cells.
>>
>> I used 145 according your example.
>>
>> Good luck
>>
>> Carlos
>>
>>
>>
>> 2014-02-21 8:37 GMT-05:00 Jonathan Moules <
>> jonathanmou...@warwickshire.gov.uk>:
>>
>>> Hi List,
>>> I have a three band raster. I want to do the following with:
>>>
>>> If (Band1 > 150 AND Band2 > 150 AND Band3 > 150){
   Band1 = 255
   Band1 = 255
   Band1 = 255
 }
>>>
>>>
>>> Basically set all band values to 255 when all band values are > than a
>>> value of 150. All other band values should remain unchanged.
>>>
>>> How do I do this? I've got as far as the below for the :
>>>
  ( "CR0569TEI_8_modified@1" > 145 AND "CR0569TEI_8_modified@2"
 > 145 AND "CR0569TEI_8_modified@3" > 145 )
>>>
>>>
>>> But am unsure what's next. The tutorials I've found online assume I only
>>> want 1 or 0 as my results.
>>>
>>> Help welcome. :-)
>>> Thanks,
>>> Jonathan
>>>
>>> This transmission is intended for the named addressee(s) only and may
>>> contain sensitive or protectively marked material up to RESTRICTED and
>>> should be handled accordingly. Unless you are the named addressee (or
>>> authorised to receive it for the addressee) you may not copy or use it, or
>>> disclose it to anyone else. If you have received this transmission in error
>>> please notify the sender immediately. All email traffic sent to or from us,
>>> including without limitation all GCSX traffic, may be subject to recording
>>> and/or monitoring in accordance with relevant legislation.
>>> ___
>>> Qgis-user mailing list
>>> Qgis-user@lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>
>>
>>
>> ___
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
>
> This transmission is intended for the named addressee(s) only and may
> contain sensitive or protectively marked material up to RESTRICTED and
> should be handled accordingly. Unless you are the named addressee (or
> authorised to receive it for the addressee) you may not copy or use it, or
> disclose it to anyone else. If you have received this transmission in error
> please notify the sender immediately. All email traffic sent to or from us,
> including without limitation all GCSX traffic, may be subject to recording
> and/or monitoring in accordance with relevant legislation.
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Raster Calculator - If statements

2014-02-24 Thread Jonathan Moules
Hi Carlos,
  Thanks for your thoughts. One observation - it appears that you are only
checking a single band at a time.
However I only want the values to be changed if ALL bands have a value of
>145. If only one or even two of the values are >145 then nothing should be
changed, it's only when all three are that I want it to be triggered.

That makes the problem even more tricky. :-)
Kind Regards,
Jonathan



On 21 February 2014 21:40, Carlos Cerdán  wrote:

> Hi Jonathan:
>
> Interesting puzzle. You can get what you wish if you use GRASS (r.mapcalc
> and r.null). With QGIS I just got zero or null, but band by band:
>
> ZERO : (band1@1<=145)*band1@1
>
> NULL : ( ((band1@1<=145)*band1@1) / ((band1@1<=145)*band1@1) ) * band1@1
>
> Explanation:
>
> 1. ZERO: When condition in parenthesis is true, it goes 1, if doesn't, 0.
> After that, multiply by the same band, so result is 0 in cells that
> original value was major than 145, and it's the same value as original in
> other cells.
>
> 2. NULL: We have same prior value  divided by himself. In cells where we
> got 0, now will get NULL, and the original value in other cells.
>
> I used 145 according your example.
>
> Good luck
>
> Carlos
>
>
>
> 2014-02-21 8:37 GMT-05:00 Jonathan Moules <
> jonathanmou...@warwickshire.gov.uk>:
>
>> Hi List,
>> I have a three band raster. I want to do the following with:
>>
>> If (Band1 > 150 AND Band2 > 150 AND Band3 > 150){
>>>   Band1 = 255
>>>   Band1 = 255
>>>   Band1 = 255
>>> }
>>
>>
>> Basically set all band values to 255 when all band values are > than a
>> value of 150. All other band values should remain unchanged.
>>
>> How do I do this? I've got as far as the below for the :
>>
>>>  ( "CR0569TEI_8_modified@1" > 145 AND "CR0569TEI_8_modified@2"
>>> > 145 AND "CR0569TEI_8_modified@3" > 145 )
>>
>>
>> But am unsure what's next. The tutorials I've found online assume I only
>> want 1 or 0 as my results.
>>
>> Help welcome. :-)
>> Thanks,
>> Jonathan
>>
>> This transmission is intended for the named addressee(s) only and may
>> contain sensitive or protectively marked material up to RESTRICTED and
>> should be handled accordingly. Unless you are the named addressee (or
>> authorised to receive it for the addressee) you may not copy or use it, or
>> disclose it to anyone else. If you have received this transmission in error
>> please notify the sender immediately. All email traffic sent to or from us,
>> including without limitation all GCSX traffic, may be subject to recording
>> and/or monitoring in accordance with relevant legislation.
>> ___
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
>
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>

-- 
This transmission is intended for the named addressee(s) only and may 
contain sensitive or protectively marked material up to RESTRICTED and 
should be handled accordingly. Unless you are the named addressee (or 
authorised to receive it for the addressee) you may not copy or use it, or 
disclose it to anyone else. If you have received this transmission in error 
please notify the sender immediately. All email traffic sent to or from us, 
including without limitation all GCSX traffic, may be subject to recording 
and/or monitoring in accordance with relevant legislation.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Raster Calculator - If statements

2014-02-21 Thread Carlos Cerdán
Hi Jonathan:

Interesting puzzle. You can get what you wish if you use GRASS (r.mapcalc
and r.null). With QGIS I just got zero or null, but band by band:

ZERO : (band1@1<=145)*band1@1

NULL : ( ((band1@1<=145)*band1@1) / ((band1@1<=145)*band1@1) ) * band1@1

Explanation:

1. ZERO: When condition in parenthesis is true, it goes 1, if doesn't, 0.
After that, multiply by the same band, so result is 0 in cells that
original value was major than 145, and it's the same value as original in
other cells.

2. NULL: We have same prior value  divided by himself. In cells where we
got 0, now will get NULL, and the original value in other cells.

I used 145 according your example.

Good luck

Carlos



2014-02-21 8:37 GMT-05:00 Jonathan Moules <
jonathanmou...@warwickshire.gov.uk>:

> Hi List,
> I have a three band raster. I want to do the following with:
>
> If (Band1 > 150 AND Band2 > 150 AND Band3 > 150){
>>   Band1 = 255
>>   Band1 = 255
>>   Band1 = 255
>> }
>
>
> Basically set all band values to 255 when all band values are > than a
> value of 150. All other band values should remain unchanged.
>
> How do I do this? I've got as far as the below for the :
>
>>  ( "CR0569TEI_8_modified@1" > 145 AND "CR0569TEI_8_modified@2" >
>> 145 AND "CR0569TEI_8_modified@3" > 145 )
>
>
> But am unsure what's next. The tutorials I've found online assume I only
> want 1 or 0 as my results.
>
> Help welcome. :-)
> Thanks,
> Jonathan
>
> This transmission is intended for the named addressee(s) only and may
> contain sensitive or protectively marked material up to RESTRICTED and
> should be handled accordingly. Unless you are the named addressee (or
> authorised to receive it for the addressee) you may not copy or use it, or
> disclose it to anyone else. If you have received this transmission in error
> please notify the sender immediately. All email traffic sent to or from us,
> including without limitation all GCSX traffic, may be subject to recording
> and/or monitoring in accordance with relevant legislation.
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user