''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Tam.WizzAdjReserves Script ' Function: Adjusts Land_value to reflect partial cells near protected areas ' Input: - PU polygon theme ' - land cover grid theme ' - outside portion of PUs (polygon theme) when intersected ' by PAs boundary ' Output: - modified PU theme ' Author: Miroslav Honzak ' Conservation International ' Last update: February 5, 2003 - Added loop to calculate fulloutside area ' - Added test to prevent using wrong planning unit ID ' - Added test to avoid having some small outside polygons excluded/included ' when tabulating cloneFTab (outside polygons) ' February 6, 2003 - Changed back how EBIs are computed: from using fulloutsideha ' (all outside area) to using outside_ha again (outside non urban-water-cloud-other) ' February 13, 2003 - Changed treatment of "Id" field in tabulation etc. ' April 8, 2003 - Added creation of outside polygons and repaired the script to ' to read PU-ID from a list if not found. Removed hardcoding of regression coeff. ' December 12, 2003 - Excluded the Brazilian data dependency ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' theView = av.GetActiveDoc theThemeList = theView.GetThemes if (theThemeList.count = 0) then Return Nil end 'theView = av.FindDoc("Analysis View") 'theThemeList = theView.GetThemes 'if (theThemeList.count = 0) then ' Return Nil 'end 'Check if Spatial Analyst Extention is loaded anExtention = Extension.Find("Spatial Analyst") if (anExtention = nil) then MsgBox.Info("Please load Spatial Analyst Extension first", "") Return Nil end 'Extract polygon theme list and grid theme list thePUThemeList = {} theGridThemeList = {} theArgumentList = {} for each t in theThemeList if ( t.Is(FTHEME) ) then theVTab = t.GetFTab theShapeField = theVTab.findField("shape") if ( theShapeField = nil ) then continue end theTotalRecs = theVTab.GetNumRecords if( theTotalRecs < 1 ) then continue end theShape = theVtab.ReturnValue(theShapeField, 0) if ( theShape = Nil ) then continue end theClassName = theShape.GetClass.GetClassName if ( theClassName = "Polygon" ) then thePUThemeList.Add(t) end elseif ( t.Is(GTHEME) ) then theGridThemeList.Add(t) end 'if end 'Check whether the Polygon theme list or Grid theme list is empty if ( thePUThemeList.count = 0 ) then MsgBox.Info("There is no polygon theme in the active view", "Error") Return Nil end if ( theGridThemeList.count = 0 ) then MsgBox.Info("There is no grid theme in the active view", "Error") Return Nil end '************************************************************** 'Request user to select input PU and other useful themes '************************************************************** thePUTheme = Msgbox.List(thePUThemeList, "Select PLANING UNIT theme", "Input Dialog") if ( thePUTheme = Nil ) then Return Nil end theGridTheme = Msgbox.List(theGridThemeList, "Select LANDCOVER grid theme", "Input Dialog") if ( theGridTheme = Nil ) then Return Nil end thePATheme = Msgbox.List(thePUThemeList, "Select PROTECTED AREA boundaries", "Input Dialog") if ( thePATheme = Nil ) then Return Nil end thePUTheme.GetFTab.GetSelection.ClearAll thePUTheme.GetFTab.UpdateSelection thePUFTab = thePUTheme.GetFTab thePAFTab = thePATheme.GetFTab '************************************************************** ' Request user to enter Land_Value regression coefficients '************************************************************** labels = { "Primary Forest", "Secondary Forest", "Other Forested Media" } defaults = { "-1.20619", "-0.7967599", "-0.309976" } theCoefList = MsgBox.MultiInput( "Enter Regression Coefficients used for calculating Land Values", "Input Dialog", labels, defaults ) if (theCoefList.Count = 0) then Return NIL end '************************************************************** ' Clean/Union PAs '************************************************************** ' Calculate PAField = 1 thePAFTab.seteditable(TRUE) PAField = Field.Make( "PAField", #FIELD_DECIMAL, 2, 0 ) thePAFTab.AddFields( {PAField} ) thePAFTab.Calculate ( "1", thePAFTab.FindField("PAField") ) cleanName = ( FileName.GetTmpDir.AsString+"\"+"cleanFTab" ).AsFilename theField = thePAFTab.FindField( "PAField" ) shpField = thePAFTab.FindField( "Shape" ) cleanFTab = thePAFTab.Summarize( cleanName, Shape, theField, {shpField}, {#VTAB_SUMMARY_AVG} ) cleanFTab.CreateIndex( cleanFTab.FindField( "Shape" )) thePAFTab.RemoveFields ( {PAField} ) thePAFTab.seteditable(FALSE) thePATheme = FTheme.Make( cleanFTab ) '************************************************************** ' USE PAs TO INTERSECT, UNION AND CLIP WITH PUs TO OBTAIN OUTSIDE SLIVERS OF PUs AT PAs FRINGES '************************************************************** 'A) Select only Planning Units intersecting with Protected Area boundaries thePUTheme.SelectByTheme( thePATheme, #FTAB_RELTYPE_INTERSECTS, 0, #VTAB_SELTYPE_NEW ) thePUTheme.SelectByTheme( thePATheme, #FTAB_RELTYPE_ISCOMPLETELYWITHIN, 0, #VTAB_SELTYPE_XOR ) 'B) Intersect selcted Planning Units with Protected Areas and delete unnecessary fields InsideFTab = av.Run( "Tam.IntersectThemes", {thePUTheme, thePATheme, True, False} ) theDeleteFieldList = {} for each f in InsideFTab.GetFields if (Not(f.AsString = "Shape") AND Not(f.AsString = "PAField")) then theDeleteFieldList.Add(f) end end InsideFTab.SetEditable(TRUE) InsideFTab.RemoveFields( theDeleteFieldList ) InsideFTab.SetEditable(FALSE) InsideFTheme = FTheme.Make( InsideFTab ) 'theView.AddTheme( InsideFTheme ) 'C) Union the slivers inside Protected Areas with selected Planning Units OutsideFTab = av.Run( "Tam.UnionThemes", {thePUTheme, InsideFTheme, True, False} ) OutsideFTabFieldList = OutsideFTab.GetFields if ( OutsideFTabFieldList.FindByValue("ID") < 0) then thePUID = "ID" else thePUIDField = MsgBox.ListAsString(OutsideFTabFieldList,"Pick PLANNING UNIT-ID field:","Input Dialog") thePUID = thePUIDField.AsString end theDeleteFieldList = {} for each f in OutsideFTab.GetFields if (Not(f.AsString = "Shape") AND Not(f.AsString = "PAField") AND Not(f.AsString = thePUID)) then theDeleteFieldList.Add(f) end end OutsideFTab.SetEditable(TRUE) OutsideFTab.RemoveFields( theDeleteFieldList ) OutsideFTab.SetEditable(FALSE) 'D) Select and delete the slivers inside Protected Areas theBitMap = OutsideFTab.GetSelection theBitMap.ClearAll for each theRec in OutsideFTab theValue = OutsideFTab.ReturnValueNumber( OutsideFTab.FindField("PAField"), theRec ) if ( theValue <> 0 ) then theBitMap.Set( theRec ) end end OutsideFTab.UpdateSelection OutsideFTab.SetEditable(TRUE) OutsideFTab.RemoveRecords( theBitMap ) theDeleteFieldList = {} for each f in OutsideFTab.GetFields if (Not(f.AsString = "Shape") AND Not(f.AsString = thePUID)) then theDeleteFieldList.Add(f) end end OutsideFTab.RemoveFields( theDeleteFieldList ) OutsideFTab.SetEditable(FALSE) OutsideFTheme = FTheme.Make( OutsideFTab ) 'theView.AddTheme( OutsideFTheme ) thePUTheme.GetFTab.GetSelection.ClearAll thePUTheme.GetFTab.UpdateSelection '**************************************************************** ' Select list of records (polygons) to be excluded from calculation for being too ' small for tabulation (typically smaller then a pixel in size which is 0.09 ha for ' Landsat ETM 30 x 30m pixel) However, lets make it slightly larger to be safe (0.11). ' Set Land Values, Easement Values and EBI's to 0.0 (as being inside PAS). Modify ' outsideFTab by exporting it and importing it as cloneFTab with the small polygons ' excluded, continue with calculation using this cloneFTab. '**************************************************************** cloneName = ( FileName.GetTmpDir.AsString+"\cloneFTab" ).AsFilename outsideFTheme.GetFTab.Export ( cloneName, Shape, FALSE ) sourceName = SrcName.Make( FileName.GetTmpDir.AsString+"\cloneFTab.shp" ) cloneFTab = FTab.Make( sourceName ) theNumRecords = cloneFTab.GetNumRecords aBitMap = BitMap.Make( theNumRecords ) for each theRec in cloneFTab clonePoly = cloneFTab.ReturnValue(cloneFTab.FindField("Shape"), theRec) theSize_ha = clonePoly.ReturnArea/10000 ' Convert to hectares if (theSize_ha <= 0.11) then aBitMap.SetRange( theRec, 1 ) end end cloneFTab.SetEditable(TRUE) cloneFTab.RemoveRecords ( aBitmap ) cloneFTab.SetEditable(FALSE) ' Open table only during code development 'cloneTable = Table.Make(cloneFTab) 'cloneTable.SetName("cloneFTab") 'av.GetProject.AddDoc(cloneTable) 'cloneTable.GetWin.Open 'Return Nil '**************************************************************** ' MAKE A BACKGROUND GRID '************************************************************** theGrid = theGridTheme.GetGrid theAE = theView.GetExtension(AnalysisEnvironment) theAE.SetCellSize (#ANALYSISENV_VALUE, theGrid.GetCellSize) theAE.SetExtent (#ANALYSISENV_MAXOF, NIL) theAE.Activate ' Create a new Grid aGridList = {Grid.MakeFromNumb(0)} theGrid = theGrid.Merge(aGridList) theGridTheme = GTheme.Make(theGrid) ' Add new theme to the View 'aDataname = av.GetProject.GetWorkDir.MakeTmp("Background", "") 'theGrid.Rename(aDataname) 'theResultingTheme = GTheme.Make(theGrid) 'theResultingTheme.SetName("Background") 'theView.AddTheme(theResultingTheme) 'theResultingTheme.SetVisible(true) 'theView.Invalidate 'Return NIL '************************************************************** ' SELECT PUs CONTAINED WITHIN PAs INCLUDING SMALL PUs '************************************************************** anFTab = thePUTheme.GetFTab anFTab.SelectByFTab( cloneFTab, #FTAB_RELTYPE_CONTAINSTHECENTEROF, 0, #VTAB_SELTYPE_NEW ) thePUTheme.SelectByTheme( thePATheme, #FTAB_RELTYPE_INTERSECTS, 0, #VTAB_SELTYPE_XOR ) 'thePUTheme.SelectByTheme( thePATheme, #FTAB_RELTYPE_ISCOMPLETELYWITHIN, 0, #VTAB_SELTYPE_NEW ) ' FOR ALL SELECTED RECORDS SET Land_Values, Easement_Values, EBIs TO ZERO anFTab.Calculate ("0.0", anFTab.FindField("Land_Value")) anFTab.Calculate ("0.0", anFTab.FindField("EaseVal1")) anFTab.Calculate ("0.0", anFTab.FindField("EaseVal2")) anFTab.Calculate ("0.0", anFTab.FindField("EaseVal3")) anFTab.Calculate ("0.0", anFTab.FindField("EaseVal4")) anFTab.Calculate ("0.0", anFTab.FindField("EBI_Orig")) anFTab.Calculate ("0.0", anFTab.FindField("EBI_Cab")) anFTab.Calculate ("0.0", anFTab.FindField("EBI_Pref")) anFTab.Calculate ("0.0", anFTab.FindField("EBI_PperLV")) anFTab.Calculate ("0.0", anFTab.FindField("EBI_Core")) anFTab.Calculate ("0.0", anFTab.FindField("EBI_CperLV")) anFTab.Calculate ("0.0", anFTab.FindField("User_EBI")) anFTab.Calculate ("0.0", anFTab.FindField("Outside_ha")) thePUTheme.GetFTab.GetSelection.ClearAll thePUTheme.GetFTab.UpdateSelection '************************************************************** ' Tabulate areas (based on Spatial.TabulateAreas) '************************************************************** ' obtain projection aPrj = theView.GetProjection colTheme = theGridTheme rowTheme = FTheme.Make(cloneFTab) ' Make a list of fields from GTheme aGThmVTab = colTheme.GetVTab aGThmFieldList = {} theGThmField = NIL for each f in aGThmVTab.GetFields if (f.IsVisible and (f.IsTypeNumber or f.IsTypeString)) then aGThmFieldList.Add(f) end end ' check if valid field exists if (aGThmFieldList.Count = 0) then return NIL end ' obtain field to be tabulated for each f in aGThmFieldList if (f.AsString = "Value") then theGThmField = f end end if (theGThmField = NIL) then theGThmField = MsgBox.List(aGThmFieldList,"Pick a COLUMN field:","Field for tabulation:") end ' Make a list of fields from FTheme anFThmFTab = rowTheme.GetFTab anFThmFieldList = {} theFThmField = NIL for each f in anFThmFTab.GetFields if (f.IsVisible and (f.IsTypeNumber or f.IsTypeString)) then anFThmFieldList.Add(f) end end ' check if valid field exists if (anFThmFieldList.Count = 0) then return NIL end ' obtain field to be tabulated theFThmField = anFThmFTab.FindField(anFThmFieldList.Get(0).AsString) if (theFThmField.AsString <> "ID") then theFThmField = MsgBox.List(anFThmFieldList,"Pick PLANNING UNIT-ID field:","Field for tabulation:") end ' Populate the params list: '0: colTheme (Theme) '1: colField (Field) '2: rowTheme (Theme) '3: rowField (Field) params = {colTheme, theGThmField, rowTheme, theFThmField} ' Set Extent etc. theAE = theView.GetExtension(AnalysisEnvironment) theGrid = theGridTheme.GetGrid theCellSize = theGrid.GetCellSize theExtentRect = theGrid.GetExtent theAE.SetCellSize (#ANALYSISENV_VALUE, theCellSize) theAE.SetExtent (#ANALYSISENV_VALUE, theExtentRect) theAE.Activate ' make sure themes overlay colExtent = colTheme.ReturnExtent rowExtent = rowTheme.ReturnExtent if (colExtent.Intersects(rowExtent).Not) then MsgBox.Error("Input themes do not overlay","Tabulate Areas") return NIL end if (colTheme.Is(GTheme)) then aVTab = colTheme.GetGrid.GetVTab if (aVTab = NIL) then colGrid = colTheme.GetGrid else if (aVTab.GetNumSelRecords > 0) then colGrid = colTheme.GetGrid.ExtractSelection else colGrid = colTheme.GetGrid end end colField = params.Get(1) if (rowTheme.Is(GTheme)) then aVTab = rowTheme.GetGrid.GetVTab if (aVTab = NIL) then rowObj = rowTheme.GetGrid else if (aVTab.GetNumSelRecords > 0) then rowObj = rowTheme.GetGrid.ExtractSelection else rowObj = rowTheme.GetGrid end end else rowObj = rowTheme.GetFTab end rowField = params.Get(3) switch = FALSE elseif (rowTheme.Is(GTheme)) then aVTab = rowTheme.GetGrid.GetVTab if (aVTab = NIL) then colGrid = rowTheme.GetGrid else if (aVTab.GetNumSelRecords > 0) then colGrid = rowTheme.GetGrid.ExtractSelection else colGrid = rowTheme.GetGrid end end rowObj = colTheme.GetFTab colField = params.Get(3) rowField = params.Get(1) switch = TRUE else 'set extent and cell size for conversion if not already set ae = theView.GetExtension(AnalysisEnvironment) box = Rect.Make(0@0,1@1) cellSize = 1 if ((ae.GetExtent(box) <> #ANALYSISENV_VALUE) or (ae.GetCellSize(cellSize) <> #ANALYSISENV_VALUE)) then ce = AnalysisPropertiesDialog.Show(theView, TRUE, "Temporary Grid Specification") if (ce = NIL) then return NIL end ce.GetCellSize(cellSize) ce.GetExtent(box) end colField = params.Get(1) colGrid = Grid.MakeFromFTab(colTheme.GetFTab,aPrj,colField,{cellSize,box}) if (colGrid.HasError) then return NIL end if (colGrid.GetVTab = NIL) then return NIL end if(colField.IsTypeString) then colField = colGrid.GetVTab.FindField("S_VALUE") else colField = colGrid.GetVTab.FindField("VALUE") end rowObj = rowTheme.GetFTab rowField = params.Get(3) switch = FALSE end ' apply mask if set theMaskGTheme = theView.GetExtension(AnalysisEnvironment).GetMask if (theMaskGTheme = NIL) then columnGrid = colGrid else columnGrid = colGrid.ExtractByMask(theMaskGTheme.GetGrid) end areaVTab = columnGrid.TabulateArea(colField,rowObj,aPrj,rowField,switch) if(areaVTab.HasError) then return NIL end ' Add and open the resultant table 'areaTable = Table.Make(areaVTab) 'areaTable.SetName("Areas of" ++ colTheme.GetName ++ "Tabulated For Each Zone in" ++ rowTheme.GetName) 'av.GetProject.AddDoc(areaTable) 'areaTable.GetWin.Open 'Return NIL '************************************************************** ' IMPORTANT !! Check if no. of records is equal in cloneFtab and areaVTab '************************************************************** theNumCloneLines = cloneFTab.GetNumRecords theNumLines = areaVTab.GetNumRecords if (theNumLines <> theNumCloneLines) then MsgBox.Error("Increase or decrease threshold for filtering small polygons and run again","") exit end '************************************************************** ' Prepare for value adjustment... '************************************************************** areaFieldList = {} theNonurbwatList = {} theNoncabList = {} theHectaresList = {} FTabFieldList = {} FTabFieldList = anFtab.GetFields areaFieldList = areaVTab.GetFields thePUidField = NIL theTABidField = NIL ' Get PU Id field from Planning Unit theme thePUIDField = anFTab.FindField(FTabFieldList.Get(1).AsString) if (thePUIDField.AsString <> "ID") then thePUIDField = MsgBox.List(FTabFieldList,"Pick PLANNING UNIT-ID field:","Input Dialog") end ' Get PU Id field from tabulation result (areaVTab) theTABidField = areaVTab.FindField(areaFieldList.Get(0).AsString) if (theTABidField = NIL) then theTABidField = MsgBox.List(areaFieldList,"Pick PLANNING UNIT-ID field:","Input Dialog") end ' Do HectaresList to get full area for each f in areaFieldList if ( Not(f.AsString = theTABidField.AsString) ) then theHectaresList.Add(f) end end ' Do NourbwatList to get nourbwat area for each f in areaFieldList if ( Not(f.AsString = theTABidField.AsString) AND Not(f.AsString = "Value_1") AND Not(f.AsString = "Value_14") AND Not(f.AsString = "Value_20") ) then theNonurbwatList.Add(f) end end ' Do NocaburbwatList to get nocabrucaurbwat area for each f in areaFieldList if ( Not(f.AsString = theTABidField.AsString) AND Not(f.AsString = "Value_1") AND Not(f.AsString = "Value_5") AND Not(f.AsString = "Value_14") AND Not(f.AsString = "Value_20") ) then theNoncabList.Add(f) end end '************************************************************** ' Start adjusting... '************************************************************** anFTab.SetEditable(TRUE) for each theLine in areaVTab av.ShowMsg( "Adjusting values...") av.ShowStopButton progress = ( (theLine+1) / theNumLines ) * 100 doMore = av.SetStatus(progress) if (not doMore) then break end TABid = areaVTab.ReturnValue(areaVTab.FindField(theTABidField.AsString), theLine) for each theRec in anFTab PUid = anFTab.ReturnValue(anFTab.FindField(thePUidField.AsString), theRec) if (PUid = TABid) then landval = anFTab.ReturnValue(anFTab.FindField("Land_Value"), theRec) if (theNonurbwatList <> {}) then areaVTabValue = 0.0 for each f in theNonurbwatList areaVTabValue = areaVTabValue + areaVTab.ReturnValue(areaVTab.FindField(f.AsString), theLine) end outside_ha = areaVTabValue/10000 onePercent = areaVTabValue/100 else outside_ha = 0 onePercent = 0 end if ( ((landval <> Nil) and (landval <> 0)) and (outside_ha <> 0) ) then '''''''''''''''''''''''''' ADJUSTMENTS OF LAND VALUES IN PROPORTIONS primfoha = anFTab.ReturnValue(anFTab.FindField("Pfor_ha"), theRec) secforha = anFTab.ReturnValue(anFTab.FindField("Sfor_ha"), theRec) cabrucha = anFTab.ReturnValue(anFTab.FindField("Cab_ha"), theRec) nourbwat = anFTab.ReturnValue(anFTab.FindField("Nourbwa_ha"), theRec) ' Sum Full Area in hectares - currently not used for anything if (theHectaresList <> {}) then areaVTabValue = 0.0 for each f in theHectaresList areaVTabValue = areaVTabValue + areaVTab.ReturnValue(areaVTab.FindField(f.AsString), theLine) end fulloutsideha = areaVTabValue/10000 else fulloutsideha = 0 end ' Sum Noncabrucawaturb Area if (theNoncabList <> {}) then areaVTabValue = 0.0 for each f in theNoncabList areaVTabValue = areaVTabValue + areaVTab.ReturnValue(areaVTab.FindField(f.AsString), theLine) end outsidenoncabha = areaVTabValue/10000 else outsidenoncabha = 0 end if (areaVTab.FindField("Value_3") <> NIL) then Primary = areaVTab.ReturnValue(areaVTab.FindField("Value_3"), theLine) outsideprimha = Primary/10000 ' Convert to hectares P_primary = Primary/onePercent else P_primary = 0 outsideprimha = 0 end if (areaVTab.FindField("Value_4") <> NIL) then Secondary = areaVTab.ReturnValue(areaVTab.FindField("Value_4"), theLine) outsidesecha = Secondary/10000 ' Convert to hectares P_secondary = Secondary/onePercent else P_secondary = 0 outsidesecha = 0 end if (areaVTab.FindField("Value_5") <> NIL) then Cabruca = areaVTab.ReturnValue(areaVTab.FindField("Value_5"), theLine) outsidecabha = Cabruca/10000 ' Convert to hectares P_cabruca = Cabruca/onePercent else P_cabruca = 0 outsidecabha = 0 end lnpricha = (landval/nourbwat).ln lnprichanew = lnpricha + (theCoefList.Get(0).AsNumber * ((outsideprimha/outside_ha) - (primfoha/nourbwat))) + (theCoefList.Get(1).AsNumber * ((outsidesecha/outside_ha) - (secforha/nourbwat))) + (theCoefList.Get(2).AsNumber * ((outsidecabha/outside_ha) - (cabrucha/nourbwat))) theEuler = Number.GetEuler landvaluenew = (theEuler^(lnprichanew)) * outside_ha '''''''''''''''''''''''''' ADJUSTMENT OF EASEMENT VALUES IN PROPORTIONS 'EV1 lnpricprimfo = lnprichanew - (theCoefList.Get(0).AsNumber * ((outsideprimha/outside_ha) - 1.0)) - (theCoefList.Get(1).AsNumber * ((outsidesecha/outside_ha) - 0.0)) - (theCoefList.Get(2).AsNumber * ((outsidecabha/outside_ha) - 0.0)) predp_hf = (theEuler^(lnpricprimfo)) * outside_ha easement1new = landvaluenew - ( predp_hf/2 ) 'EV2 easement2new = landvaluenew - predp_hf 'EV3 lnpricprimfoexcab = lnprichanew - (theCoefList.Get(0).AsNumber * ((outsideprimha/outside_ha) - (outsidenoncabha/outside_ha))) - (theCoefList.Get(1).AsNumber * (outsidesecha/outside_ha)) predp_hc = (theEuler^(lnpricprimfoexcab)) * outside_ha easement3new = landvaluenew - predp_hc 'EV4 easement4new = 0.5 * ( easement2new + easement3new ) '''''''''''''''''''''''''' RECALCULATION OF EBIs IN PROPORTIONS P_cabprim = P_primary + P_cabruca P_anyfor = P_primary + P_secondary if (P_primary > 0) then D_primary = 1 else D_primary = 0 end if (P_cabprim > 0) then D_cabprim = 1 else D_cabprim = 0 end if (P_anyfor > 0) then D_anyfor = 1 else D_anyfor = 0 end EBI_Orig = ( (5* P_primary) + (3* P_cabruca * D_primary) + (2* P_secondary * D_cabprim) ) / 100 EBI_Cab = ( (5* P_primary) + (3* P_cabruca) + (2* P_secondary * D_cabprim) ) / 100 EBI_Pref = ( (5* P_primary) + (3* P_cabruca * D_anyfor) + (3* P_secondary * D_cabprim) + (1* P_cabruca * (1 - D_anyfor)) + (1* P_secondary * (1 - D_cabprim)) ) / 100 EBI_Pref_per_LV = 1000 * outside_ha * EBI_Pref / landvaluenew EBI_Core = anFTab.ReturnValue(anFTab.FindField("EBI_Core"), theRec) EBI_Core_per_LV = 1000 * outside_ha * EBI_Core / landvaluenew else landvaluenew = NIL easement1new = NIL easement2new = NIL easement3new = NIL easement4new = NIL EBI_Orig = 0.0 EBI_Cab = 0.0 EBI_Pref = 0.0 EBI_Pref_per_LV = 0.0 EBI_Core_per_LV = 0.0 end ' Write all adjusted values out... anFTab.SetValue(anFTab.FindField("Land_Value"), theRec, landvaluenew) anFTab.SetValue(anFTab.FindField("EaseVal1"), theRec, easement1new) anFTab.SetValue(anFTab.FindField("EaseVal2"), theRec, easement2new) anFTab.SetValue(anFTab.FindField("EaseVal3"), theRec, easement3new) anFTab.SetValue(anFTab.FindField("EaseVal4"), theRec, easement4new) anFTab.SetValue(anFTab.FindField("EBI_Orig"), theRec, EBI_Orig) anFTab.SetValue(anFTab.FindField("EBI_Cab"), theRec, EBI_Cab) anFTab.SetValue(anFTab.FindField("EBI_Pref"), theRec, EBI_Pref) anFTab.SetValue(anFTab.FindField("EBI_PperLV"), theRec, EBI_Pref_per_LV) anFTab.SetValue(anFTab.FindField("EBI_CperLV"), theRec, EBI_Core_per_LV) anFTab.SetValue(anFTab.FindField("Outside_ha"), theRec, outside_ha) end end end '************************************************************** ' GLOBAL ADJUSTMENTS OF Easement_Values and EBIs -- BRAZIL ONLY '************************************************************** 'anFTab.Calculate ("[Land_Value] * 1.137", anFTab.FindField("Land_Value")) 'anFTab.Calculate ("[EaseVal1] * 1.137", anFTab.FindField("EaseVal1")) 'anFTab.Calculate ("[EaseVal2] * 1.137", anFTab.FindField("EaseVal2")) 'anFTab.Calculate ("[EaseVal3] * 1.137", anFTab.FindField("EaseVal3")) 'anFTab.Calculate ("[EaseVal4] * 1.137", anFTab.FindField("EaseVal4")) 'anFTab.Calculate ("[EBI_PperLV] / 1.137", anFTab.FindField("EBI_PperLV")) 'anFTab.Calculate ("[EBI_CperLV] / 1.137", anFTab.FindField("EBI_CperLV")) '************************************************************** anFTab.Calculate ("[Outside_ha]", anFTab.FindField("Hectares")) anFTab.SetEditable(FALSE) thePUTheme.GetFTab.GetSelection.ClearAll thePUTheme.GetFTab.UpdateSelection av.ClearMsg av.ClearStatus av.PurgeObjects