<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Playing with rasterio and fiona
Variable declarations
sample_points_filepath – path to sample points shapefile <br />
DEM_filepath – path to DEM raster <br />
elevation_filepath – path to export excel file containing elevation values for each sample site
Step1:  Import statements
Step2:  Transform points
<ASSISTANT_TASK:>
Python Code:
sample_points_filepath = ""
DEM_filepath = ""
elevation_filepath = ""
Explanation: Playing with rasterio and fiona
Variable declarations
sample_points_filepath – path to sample points shapefile <br />
DEM_filepath – path to DEM raster <br />
elevation_filepath – path to export excel file containing elevation values for each sample site
End of explanation
import rasterio
import fiona
import pandas
import numpy
from pyproj import Proj, transform
from fiona.crs import from_epsg
with fiona.open(sample_points_filepath, 'r') as source_points:
    points = [f['geometry']['coordinates'] for f in source_points]
    
    original = Proj(source_points.crs)
    destination = Proj(from_epsg(4326))
    #destination = Proj(' +proj=latlong +ellps=bessel')
    
    with rasterio.drivers():
        with rasterio.open(DEM_filepath) as source_dem:
            s = source_dem.sample(points)
            elevs = numpy.array([n[0] for n in s])
            source_dem.close
    source_points.close
Explanation: Import statements
End of explanation
points_projected = []
for p in points:
    x, y = p
    lat, long = transform(original, destination, x, y)
    points_projected.append((long,lat))
points_projected_pd = pandas.DataFrame(points_projected, columns=["lat", "long"])
with fiona.open(sample_points_filepath, 'r') as source_points:
    names = numpy.array([p['properties']['NAME'] for p in source_points])
    IDs = numpy.array([p['properties']['ID'] for p in source_points])
    
    source_points.close
elevs_names = [{"ID":IDs[i],"elevation":elevs[i], "name":names[i], "latitude":points_projected[i][0], "longitude":points_projected[i][1]} for i in range(len(elevs))]
elevs_pd = pandas.DataFrame(elevs_names)
elevs_pd
elevs_pd.to_excel(elevation_filepath)
Explanation: Transform points
End of explanation
<END_TASK>