File size: 12,689 Bytes
489f628
 
 
 
 
4729e8b
4fda501
 
 
489f628
 
8265a63
 
489f628
 
0809f26
859261f
10af2f1
6f30279
489f628
 
 
 
 
 
 
6f30279
 
 
 
 
 
22e3141
 
 
 
6f30279
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489f628
 
 
 
 
aeecf3b
489f628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7c5bfa7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489f628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22e3141
 
 
 
 
489f628
22e3141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489f628
22e3141
489f628
22e3141
489f628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
---
license: apache-2.0
language:
- en
size_categories:
- 1M<n<10M
task_categories:
- token-classification
- table-question-answering
---
# Durham Urban Canopy Analysis and Enhancement Initiative (DUCAEI)
The `Class` is a custom dataset class that brings together information from two distinct domains into a unified dataset. 
This class is designed to streamline the process of working with data from different sources and enable users to seamlessly access and analyze combined datasets.
## Project Overview

![Dataset Preview](https://github.com/AuraMa111/Urban_Tree_Canopy_in_Durham/blob/main/Picture1.png?raw=true)

(I also upload a seperate analysis .py file to show some visualization)

The Durham Urban Canopy Analysis and Enhancement Initiative (DUCAEI) is committed to utilizing the Trees & Planting Sites dataset for a comprehensive geospatial analysis of Durham's urban tree canopy. Through Python within Google Colab, our aim is to identify key locations for canopy expansion, evaluate the impact of urban development on green spaces, and deliver informed recommendations for the sustainable growth of urban tree coverage.

## Background and Rationale

Durham's urban tree canopy is a crucial component that contributes to environmental quality, public health, and overall city aesthetics. This canopy is under threat due to ongoing urban development and natural wear. A systematic, data-driven approach is critical for strategic planning and conservation of the urban forest to ensure its vitality for generations to come.

## Data Sources and Methodology
These data files are from durham open. 

And for the .py file:

The provided Python script defines a dataset class named `DurhamTrees` using the `datasets` library. This class combines information from two different domains ("class1_domain1" and "class2_domain1") and includes features from both domains.

Trees & Planting Sites Dataset: Hosted on the Durham Open Data portal, this dataset includes location, species, size, and health of street trees, alongside designated future planting sites.
Data Source: Durham Trees & Planting Sites Dataset
https://live-durhamnc.opendata.arcgis.com/datasets/DurhamNC::trees-planting-sites/about

Key components of the script:

1. **Imported Libraries:**
   - `datasets`: for building the dataset.
   - `pandas`: for handling data in tabular form.
   - `geopandas`: for working with geospatial data.
   - Other standard libraries for various functionalities.

2. **URL Definitions:**
   - Specifies URLs for CSV and GeoJSON files from two different domains.

3. **DurhamTrees Class:**
   - Inherits from `datasets.GeneratorBasedBuilder`.
   - Defines configurations for two classes ("class1_domain1" and "class2_domain1").
   - Specifies features for the combined dataset, including features from both classes.

4. **Info Method:**
   - Describes the combined dataset's features, supervised keys, homepage, and citation.

5. **Split Generators Method:**
   - Downloads and extracts data from the provided URLs.
   - Defines split generators for training data.

6. **Generate Examples Methods:**
   - `_generate_examples`: Calls methods to generate examples for both classes.
   - `_generate_examples_from_class1`: Reads CSV and GeoJSON data, merges them, and yields examples.
   - `_generate_examples_from_class2`: Reads CSV data and yields examples.

7. **Column Extraction:**
   - Defines columns to extract for both classes, indicating which features to include in the final dataset.

8. **Example Yielding:**
   - Iterates over rows of the final dataframes, converting each row to a dictionary and yielding examples with unique identifiers.

The script is intended for creating a combined dataset from two different sources, and it uses the `datasets` library to facilitate data handling.

### Data Sources

We will leverage the following files from the Durham Trees & Planting Sites Dataset, as found on the Durham Open Data portal:

- `merge.csv`
- `Trees_&_Planting_Sites.csv`
- `Trees_%26_Planting_Sites.geojson`

# Dataset Card for Urban Tree Inventory

## Dataset Description

This dataset provides comprehensive information about urban trees within a specified area, including their physical characteristics, environmental benefits, and the economic value they add in terms of ecosystem services.

### Spatial Data (GeoJSON)

**Format:** GeoJSON

**Content:**

- **Type:** `FeatureCollection` - A collection of feature objects.
- **Features:** Each feature object represents a tree and contains:
  - **Type:** `Feature`
  - **Geometry:** `Point` (includes longitude and latitude of the tree location).
  - **Properties:** Detailed information about the tree (some fields may overlap with the CSV structure below).
 
**IMAGE DAYA**
dataset_info:
  features:
    - name: image
      dtype: image
    - name: label
      dtype:
        class_label:
          names:
            '0': aechmea_fasciata
            '1': agave_americana
            '2': agave_attenuata
            '3': agave_tequilana
            '4': aglaonema_commutatum
            '5': albuca_spiralis
            '6': allium_cepa
            '7': allium_sativum

### Tabular Data (CSV)

**Format:** CSV

**Columns:**

- **X, Y:** Coordinates of the tree location.
- **OBJECTID:** Unique identifier for the tree.
- **streetaddress:** Street address nearest to the tree.
- **city:** City where the tree is located.
- **zipcode:** Zip code for the location of the tree.
- **facilityid:** Identifier for the facility associated with the tree, if any.
- **present:** Indication of whether the tree is currently present.
- **genus, species, commonname:** Botanical and common names of the tree.
- **plantingdate:** Date when the tree was planted.
- **diameterin:** Diameter of the tree trunk in inches.
- **heightft:** Height of the tree in feet.
- **condition:** Health condition of the tree.
- **contractwork:** Indicates if the tree has had any contract work done.
- **neighborhood:** Neighborhood where the tree is located.
- **program:** The program under which the tree was planted.
- **plantingw:** Width of the planting site.
- **plantingcond:** Condition of the planting site.
- **underpwerlins:** Whether the tree is under power lines.
- **matureheight:** The mature height of the tree.
- **GlobalID:** A global unique identifier for the tree.
- **created_user:** The user who created the record.
- **created_date:** The date the record was created.
- **last_edited_user:** The user who last edited the record.
- **last_edited_date:** The date the record was last edited.

#### Environmental and Economic Data:

- **isoprene, monoterpene, vocs:** Emissions and absorption data for various compounds.
- **coremoved_ozperyr, o3removed_ozperyr, etc.:** Annual pollutant removal metrics.
- **o2production_lbperyr:** Annual oxygen production.
- **carbonstorage_lb, carbonstorage_dol:** Carbon storage metrics.
- **grosscarseq_lbperyr, grosscarseq_dolperyr:** Gross carbon sequestration.
- **avoidrunoff_ft2peryr, avoidrunoff_dol2peryr:** Metrics related to stormwater runoff avoidance.
- **totannbenefits_dolperyr:** Total annual dollar benefits from the tree.
- **leafarea_sqft, potevapotran_cuftperyr, etc.:** Metrics related to the water cycle.
- **heating_mbtuperyr, cooling_kwhperyr, etc.:** Energy savings related to the tree's impact on building energy use.

### Example Record

**GeoJSON Feature:**
```json
{
  "crs": {
    "type": "name",
    "properties": {
      "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
    }
  },
  "features": [
    {
      "type": "Feature",
      "properties": {
        "OBJECTID": 2840940,
        "streetaddress": "411 N GREGSON ST",
        "city": "DURHAM",
        "zipcode": 27701,
        "facilityid": 2936423,
        "present": "Planting Site",
        "genus": null,
        "species": "",
        "commonname": null,
        "plantingdate": null,
        "diameterin": 0.0,
        "heightft": null,
        "condition": null,
        "contractwork": null,
        "neighborhood": "Walltown",
        "program": null,
        "plantingw": "Greater than 5 ft",
        "plantingcond": "Fair",
        "underpwerlins": "No",
        "matureheight": "Large (over 60 feet tall)",
        "GlobalID": "{8BA6662A-8777-473A-82BB-FD77FE6813BB}",
        "created_user": "A1",
        "created_date": "2024-02-03T10:17:12Z",
        "last_edited_user": "A1",
        "last_edited_date": "2024-02-03T10:17:12Z",
        "isoprene": null,
        "monoterpene": null,
        "vocs": null,
        "coremoved_ozperyr": null,
        "coremoved_dolperyr": null,
        "o3removed_ozperyr": null,
        "o3removed_dolperyr": null,
        "no2removed_ozperyr": null,
        "no2removed_dolperyr": null,
        "so2removed_ozperyr": null,
        "so2removed_dolperyr": null,
        "pm10removed_ozperyr": null,
        "pm10removed_dolperyr": null,
        "pm25removed_ozperyr": null,
        "o2production_lbperyr": null,
        "replacevalue_dol": null,
        "carbonstorage_lb": null,
        "carbonstorage_dol": null,
        "grosscarseq_lbperyr": null,
        "grosscarseq_dolperyr": null,
        "avoidrunoff_ft2peryr": null,
        "avoidrunoff_dol2peryr": null,
        "polremoved_ozperyr": null,
        "polremoved_dolperyr": null,
        "totannbenefits_dolperyr": null,
        "leafarea_sqft": null,
        "potevapotran_cuftperyr": null,
        "evaporation_cuftperyr": null,
        "transpiration_cuftperyr": null,
        "h2ointercept_cuftperyr": null,
        "avoidrunval_cuftperyr": null,
        "avoidrunval_dol2peryr": null,
        "carbonavoid_lbperyr": null,
        "carbonavoid_dolperyr": null,
        "heating_mbtuperyr": null,
        "heating_dolperyrmbtu": null,
        "heating_kwhperyr": null,
        "heating_dolperyrmwh": null,
        "cooling_kwhperyr": null,
        "cooling_dolperyr": null,
        "totalenerg_dolperyr": null
      },
      "geometry": {
        "type": "Point",
        "coordinates": [-78.908630289999962, 36.00441249000005, 0.0]
      }
    }
  ]
}

```
The `Trees_&_Planting_Sites.csv` file encompasses a range of attributes for each record:

- **OBJECTID:** Unique identifier for each record.
- **streetaddr:** Street address where the tree or planting site is located.
- **city:** The city name, which is Durham.
- **zipcode:** Postal code for the location.
- **facilityid:** Identifier possibly linked to a facility or area associated with the tree.
- **present:** Type of feature present, such as a tree or a planting site.
- **genus:** Genus of the tree.
- **species:** Species of the tree.
- **commonname:** Common name of the tree.
- **plantingda:** Date or year range when the tree was planted or the planting site was established.
- ... 
### Objectives

1. Combine Shapefile and CSV data into a comprehensive geospatial dataset using Python.
2. Apply Python libraries to uncover relationships between tree canopy data and urban development.
3. Provide practical insights and strategies for the expansion of Durham's urban tree canopy.
4. Produce analyses and visualizations with the GeoJSON file.

### Methodology

Our analytical process within Google Colab will encompass:

- **Data Preparation and Integration:** Using tools like Geopandas, Pandas, and PyShp to organize and combine spatial and tabular data.
- **Geospatial Analysis:** Applying Shapely and Rtree for spatial analysis, and using SciPy or Statsmodels for statistical correlations.
- **Visualization and Optimization:** Generating maps and graphs with Matplotlib, Seaborn, or Plotly, and utilizing optimization algorithms to suggest optimal planting locations.

## Deliverables

1. A collection of Google Colab Python notebooks that outline our analytical processes.
2. Interactive maps and visualizations that connect tree canopy coverage with urban development metrics.
3. An exhaustive report that contains our findings and recommendations for enhancing the urban canopy.

## Limitations

- **Computational Resources:** The limited computational offerings of Google Colab may pose a challenge to the size of the datasets or the complexity of models we can employ.
- **Data Quality:** The accuracy and currency of the data ultimately affect the precision of our recommendations.
- **Sociopolitical Considerations:** Implementation of our data-driven suggestions must be reviewed within the context of local policy and community input.

## Conclusion

DUCAEI aims to create a more verdant and livable urban landscape in Durham through this Python-based analytical project. By laying a strong foundation for data-informed decision-making, we hope to cultivate a thriving, green, and sustainable urban environment.