<p dir="ltr">Hi,<br>
If the no data value is a problem, you can change it.  Look at this post.  If you are more comfortable with the GRASS and SAGA raster calculators, you can access them using the "processing plugin".</p>
<p dir="ltr">http://gis.stackexchange.com/questions/81640/how-to-set-all-pixels-with-value-0-to-nodata-in-dem-raster<br></p>
<p dir="ltr">Nicolas Cadieux M.Sc.<br>
Les Entreprises Archéotec inc. <br>
8548, rue Saint-Denis Montréal H2P 2H2<br>
Téléphone: 514.381.5112  Fax: 514.381.4995<br>
www.archeotec.ca</p>
<div class="gmail_quote">On Jun 1, 2015 6:09 PM, "robertlozar [via OSGeo.org]" <<a href="/user/SendEmail.jtp?type=node&node=5208898&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:<br type='attribution'><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        <br />I cannot figure out how to overcome the QGIS raster calculators rules.  
<br /><br />I need to calculate the Leaf Area Index -LAI- from satellite image bands. The LAI is dependent on the Land Cover -LC - 
<br /><br />Type.  For each LC, I need to result in 3 mutually exclusive conditions: 
<br />LAI > 0, then calculate the value
<br />LAI < 0, set the value to zero (or a vanishingly small positive number)
<br />Not current LandCover, set the value to nodata.
<br />Then each different LC will be exclusive of all others.  So I will have to add many mutually exclusive areas together.
<br /><br />I have written the equations as above for each of the landcover types separately.  All I have to do is add one to the 
<br /><br />next to get a map of LAI for the three conditions and then for all the landcovers. 
<br /><br />The problem is the QGIS Raster Calculator will not let me do the simple addition.  It seems the reason is the nodata 
<br /><br />from the landcover type is what QGIS Raster Calculator is what takes priority over the data in the addition and all I 
<br /><br />get is a final map full of nodata.  I cannot find a way of overcoming this "feature".  I cannot believe such a simple 
<br /><br />action is not possible in any GIS.  Can someone point out where I am going wrong?  
<br /><br />Thanks, Bob
<br /><br />Note-I have done this in GRASS and ArcGis and Iknow it can be done in SAGA and the the QGIS plugings. Since the .tif 
<br /><br />format is the standard for QGIS, one should not have to put the images into ascii format as some have suggested or use 
<br /><br />gdal_translate to get zeros and nodata separated (which does not work anyhow). I am asking specifically about the QGIS 
<br /><br />Raster Calculator because I cannot believe it is not possible.
<br /><br />The actual equations I have been using look like this:
<br />case 1 - calculates LAI for LC code 41 above zero correctly:  
<br />(("nlcd_2011_benning_areawgs84z16.tif@1"  = 41 ) AND (("nlcd_2011_benning_areawgs84z16.tif@1"  = 41 ) * ( 2.8 -102 * 
<br /><br />"clip_RT_LC80190382014318LGN00_B04@1"  + 28 
<br />* "clip_RT_LC80190382014318LGN00_B05@1" - 41 * 
<br />"clip_RT_LC80190382014318LGN00_B06@1" )     >=    0)) * ( 2.8 -102 * "clip_RT_LC80190382014318LGN00_B04@1"  + 28 * 
<br /><br />"clip_RT_LC80190382014318LGN00_B05@1" - 41 * 
<br />"clip_RT_LC80190382014318LGN00_B06@1" )
<br /><br />case 2 - calculates LAI for code 41 below zero to a small value correctly:  
<br />(("nlcd_2011_benning_areawgs84z16.tif@1"  = 41 ) AND (("nlcd_2011_benning_areawgs84z16.tif@1"  = 41 ) * ( 2.8 -102 * 
<br /><br />"clip_RT_LC80190382014318LGN00_B04@1"  + 28 
<br />* "clip_RT_LC80190382014318LGN00_B05@1" - 41 * 
<br />"clip_RT_LC80190382014318LGN00_B06@1" )     <=    0)) * .0000001
<br /><br />case 3 - set value for all codes NOT 41 to a vanishingly small number:
<br />(("nlcd_2011_benning_areawgs84z16.tif@1"  != 41 ) * .0000002)
<br /><br />So the final equation for Code 41 should be (but is NOT) as follows because 
<br />    1. qgis does not allow you to add one layer to a second that is in the seconds nodata area [same for + AND and OR 
<br /><br />between each] and 
<br />    2. ("your_raster" != -32768) * "your_raster" does not work because image data is UInt16 in which nodata value 
<br /><br />cannot be addressed (this statement may work for other formats)
<br /><br />The equation for Code 41
<br />(( (("nlcd_2011_benning_areawgs84z16.tif@1"  = 41 ) AND (("nlcd_2011_benning_areawgs84z16.tif@1"  = 41 ) * ( 2.8 -102 * 
<br /><br />"clip_RT_LC80190382014318LGN00_B04@1"  
<br />+ 28 * "clip_RT_LC80190382014318LGN00_B05@1" - 41 * 
<br />"clip_RT_LC80190382014318LGN00_B06@1" )     >=    0)) * ( 2.8 -102 * "clip_RT_LC80190382014318LGN00_B04@1"  + 28 * 
<br /><br />"clip_RT_LC80190382014318LGN00_B05@1" - 
<br />41 * 
<br />"clip_RT_LC80190382014318LGN00_B06@1" ) )  OR ((("nlcd_2011_benning_areawgs84z16.tif@1"  = 41 ) AND 
<br /><br />(("nlcd_2011_benning_areawgs84z16.tif@1"  = 41 ) * ( 2.8 -102 * "clip_RT_LC80190382014318LGN00_B04@1"  
<br />+ 28 
<br />* "clip_RT_LC80190382014318LGN00_B05@1" - 41 * 
<br />"clip_RT_LC80190382014318LGN00_B06@1" )     <=    0)) * .0000001  ) OR   (("nlcd_2011_benning_areawgs84z16.tif@1"  != 
<br /><br />41 ) *  (.0000002 )  ) )

        
        
        
        <br />
        <br />
        <hr noshade="noshade" size="1" />
        <div style="color:#444;font:12px 'tahoma' , 'geneva' , 'helvetica' , 'arial' , sans-serif">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://osgeo-org.1560.x6.nabble.com/QGIS-Raster-Calculator-cannot-add-two-mutually-exclusive-areas-with-logical-statement-because-nodataa-tp5208547.html" target="_top" rel="nofollow" link="external">http://osgeo-org.1560.x6.nabble.com/QGIS-Raster-Calculator-cannot-add-two-mutually-exclusive-areas-with-logical-statement-because-nodataa-tp5208547.html</a>
        </div>
        <div style="color:#666;font:11px 'tahoma' , 'geneva' , 'helvetica' , 'arial' , sans-serif;margin-top:0.4em;line-height:1.5em">
                To start a new topic under Quantum GIS - User, email ml-node+s1560n4125267h38@n6.nabble.com <br />
                To unsubscribe from Quantum GIS - User, <a href="http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro&#61;unsubscribe_by_code&amp;node&#61;4125267&amp;code&#61;bmljb2xhcy5jYWRpZXV4QGFyY2hlb3RlYy5jYXw0MTI1MjY3fDYzNDQ4MjQxNg&#61;&#61;">click here</a>.<br />
                <a href="http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro&#61;macro_viewer&amp;id&#61;instant_html%21nabble%3Aemail.naml&amp;base&#61;nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs&#61;notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" style="font:9px serif">NAML</a>
        </div></blockquote></div>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/QGIS-Raster-Calculator-cannot-add-two-mutually-exclusive-areas-with-logical-statement-because-nodataa-tp5208547p5208898.html">Re: QGIS Raster Calculator - cannot add two mutually exclusive areas with logical statement because nodata excludes the other's data</a><br/>
Sent from the <a href="http://osgeo-org.1560.x6.nabble.com/Quantum-GIS-User-f4125267.html">Quantum GIS - User mailing list archive</a> at Nabble.com.<br/>