private void lPatchRichnessDensity(string filename, string epsg, int fieldIndex) { try { //Obtenemos un arraylist con toda la colección de registros del campo ArrayList fieldRows = new ArrayList(); SchemaDB_Reader collect = new SchemaDB_Reader(filename, fieldIndex); fieldRows = collect.FieldValues; //obtenemos un arraylist con las categorias encontradas en el campo ArrayList categories = new ArrayList(); SchemaDB_Reader categ = new SchemaDB_Reader(); categories = categ.categories((ArrayList)fieldRows.Clone()); _numLandscapeCategories = categories.Count; L_Area_V totalArea = new L_Area_V(filename, epsg); //landscape area is already in hectares _patchRichnessDensity = ((_numLandscapeCategories / totalArea.LandscapeArea)) * 100; } catch (Exception ex) { throw ex; } }
private void landscapeMetrics(string filename, string epsg, double depthOfEdge) { try { L_Area_V totalArea = new L_Area_V(filename, epsg); GeometryCoreReader metrics = new GeometryCoreReader(filename, epsg, depthOfEdge); for (int i = 0; i < metrics.CoreAreas.Count; i++) { totalCoreArea += (double)metrics.CoreAreas[i]; numberOfDisjunctCoreAreas += (int)metrics.NumCoreAreas[i]; } //total core area to hectares totalCoreArea = totalCoreArea / 10000; //total landscape area is already in hectares disjunctCoreAreaDensity = ((numberOfDisjunctCoreAreas / (double)totalArea.LandscapeArea)) * 100; } catch (Exception ex) { throw ex; } }
private void landscapeMetrics(string filename, string epsg, int fieldIndex) { try { //Obtenemos un arraylist con toda la colección de registros del campo ArrayList fieldRows = new ArrayList(); SchemaDB_Reader collect = new SchemaDB_Reader(filename, fieldIndex); fieldRows = collect.FieldValues; //obtenemos un arraylist con las categorias encontradas en el campo ArrayList categories = new ArrayList(); SchemaDB_Reader categ = new SchemaDB_Reader(); categories = categ.categories((ArrayList)fieldRows.Clone()); _numLandscapeCategories = categories.Count; L_Area_V totalArea = new L_Area_V(filename, epsg); _patchRichnessDensity = ((_numLandscapeCategories / totalArea.LandscapeArea)) * 100; C_LandscapePercent_V diversity = new C_LandscapePercent_V(filename, epsg, fieldIndex); double _simpsonsDiversityIndexTemp = 0; double _shannonsDiversityIndexTemp = 0; for (int i = 0; i < diversity.CategoryNames.Count; i++) { _shannonsDiversityIndexTemp += ((double)diversity.LandscapePercent[i] / 100) * Math.Log(((double)diversity.LandscapePercent[i] / 100)); _simpsonsDiversityIndexTemp += Math.Pow(((double)diversity.LandscapePercent[i] / 100), 2); } _shannonsDiversityIndex = _shannonsDiversityIndexTemp * -1; _simpsonsDiversityIndex = 1 - _simpsonsDiversityIndexTemp; _modifiedSimpsonsDiversityIndex = -Math.Log(_simpsonsDiversityIndexTemp); _shannonsEvennessIndex = _shannonsDiversityIndex / Math.Log(_numLandscapeCategories); _simpsonsEvennessIndex = _simpsonsDiversityIndex / (1 - (1 / (double)_numLandscapeCategories)); _modifiedSimpsonsEvennessIndex = _modifiedSimpsonsDiversityIndex / Math.Log(_numLandscapeCategories); } catch (Exception ex) { throw ex; } }
private void lPatchesDensity(string filename, string epsg) { try { L_Area_V LArea = new L_Area_V(filename, epsg); _landscapeArea = LArea.LandscapeArea; L_NumLandscapePatches_V NLP = new L_NumLandscapePatches_V(filename, epsg); _numLandscapePatches = NLP.NumLandscapePatches; _landscapePatchesDensity = ((_numLandscapePatches / _landscapeArea) * 10000) * 100; } catch (Exception ex) { throw ex; } }