Generate a plot with a point for every charging station

Assignment Help Python Programming
Reference no: EM131034413

Introduction to Engineering Computations and Applications

Project-

Source: www.teslamotors.com

Tesla Motors recently announced their new model 3, which is a less expensive version of their model S. The company received over a quarter of a million pre-orders. Since the launch, potential buyers have     been evaluating the locations of charging stations before they purchase the  model  3. You have been hired by Tesla Motors to create a Python script that would provide information about charging station location and distance for potential buyers.

Data provided by NREL (https://developer.nrel.gov/docs/transportation/alt-fuel-stations-v1/all/) on charging station location can be found on D2L in three different formats:

(1) tesla_locations.csv: contains the longitude and latitude of every Tesla charging stations in the US and this file is the simplest and easiest to work with because the data can be directly loaded into a numpy array using numpy.genfromtxt() with the delimiter set to "," and skip_header set to 1,

(2) testa_cities.csv contains the name of the city where the charging station is located - the cities are listed in the same order as the longitude and latitude data. This data file is optional, and can be imported using numpy.genfromtxt, but you need to set dtype='a50' where 'a' tel s numpy the data is a string and 50 is the character import limit.

(3) tesla_data.csv contains one column with the city name and the next two columns contain the latitude and longitude (i.e., this file combines the previous two). This data file is also optional, and can be imported  using numpy.genfromtxt()  but you need  to  set dtype=('a50','f8','f8').

After you have imported your data, you should use matplotlib to generate a plot with a point for every charging station. Note that the first column of data is longitude, i.e., the y-values, and the second column is latitude, i.e., the x-values, so you need to plot: (second column, first column). The plot should 'resemble' the US (especial y the coasts) if plotted correctly. Finally, you need to write two functions:

(1) The first function should be passed a current location (longitude, latitude) and the array with all the locations. Then is should loop through all the locations and find the nearest charging station to the current location. It should return the row number for the nearest charging station and the distance in terms of miles (note: you may assume 60 miles per degree of latitude and longitude). There are multiple ways to write this function, but you might find the numpy.argmin() function helpful - returns the index (i.e., row number) of the smal est entry in a vector (e.g., a vector of  distances).

(2) The second function should be passed a current location (longitude, latitude) and return either a list of row numbers or a list of cities that are within 60 miles of the current location (i.e., within a radius of 1.0 in terms of degrees of longitude and latitude). Hint: start by creating an empty list (myList = []) and then append() the row number or city name for every charging station within a radius of 1.0. It is easier to just append a row number, but 5 points of extra credit are available if you can return the list of city names.

All distances should be calculated using a Euclidian distance (dd = Δxx2 + Δyy2), and not that this is not exactly correct as the earth is a sphere and not a flat plane.

Test both functions by using one of the following 'current locations':

Bozeman [45.6770,-111.0429]

San Francisco [37.7749, -122.4194]

Hence, the first function would return the closest charging station to Bozeman (or SF) and the second function would return the charging stations within 60 miles of Bozeman (or SF).

Attachment:- Data.rar

Reference no: EM131034413

Questions Cloud

Tax assignment : The taxpayer, a resident of California, appeared on a television quiz show and won a new sailboat. The producer of the program had paid $15,000 for the boat. However, the taxpayer had no interest in sailing and needed cash. The taxpayer visited sever..
Determine how the barriers prevent innovation : Select one individual and one organizational barrier to innovation. What criteria would you use to determine how these barriers prevent innovation?
Discuss the bible verses from a biblical perspective : Discuss the Bible verse(s) from a biblical perspective. Provide context for the next two paragraphs. Discuss the theory of how marketing research efforts help firms with their marketing efforts.
How can zara maintain its competitive advantage : How can Zara maintain its competitive advantage, here the concept of sustainability may be introduced - Are there similarities between Zara Dells and Myers formula for success and could this be suitable for other companies and if so explain why, if ..
Generate a plot with a point for every charging station : After you have imported your data, you should use matplotlib to generate a plot with a point for every charging station. Note that the first column of data is longitude, i.e., the y-values, and the second column is latitude, i.e., the x-values
What are some of tools that an aspiring leader might be use : What are some of the tools and techniques that an aspiring global leader might be able to use to develop his or her global leadership skills?
How you will coordinate and gain some economies of scale : How you will coordinate, and gain some economies of scale, across all the sites. A flowchart of when you will do each of the strategic initiatives. Estimate of cost (assume staff time costs $35/hour)
The temperature profile after adding the plutonium cores : The MATLAB code used to arrive at the solution with sufficient comments explaining the code and formulatio
Examine in more depth the different modes of transportation : The purpose of this assignment is to examine in more depth the different modes of transportation, characteristics each mode offers, and a comparison to determine the best way to move a product.

Reviews

Write a Review

Python Programming Questions & Answers

  Console program where you will implement

Create a console program where you will implement coding constructs and variables that are needed for this program and will implement the code within Main and any required static methods.

  Interaction between the customer and the machine

In Python:Simulate a cash register or ATM including the interaction between the customer and the machine (i.e. assume that you are automating the responses)

  Design a prgram using python

Design a prgram USING PYTHON that students can use to calculate what score they need on final exam to get a certan final grade for a course.

  Improve the structural design - haunted house game

List the things you changed and the purpose of changing it. Good reasons include making code easier to read and easier to navigate when modifying it.

  Arithmetic progression is a sequence of numbers

An arithmetic progression is a sequence of numbers in which the distance (or difference) between any two successive numbers if the same.

  Write a program that asks for the user age

Write a program that asks for the user's age. Based on their response print "You can vote" (18 years old or older) or "You can't vote" and also whether or not he/she is a senior citizen (over 64)

  When we sort a list of items, we need a basis

When we sort a list of items, we need a basis on which to compare the items to see whether one is bigger than another. If it's a list of numbers, Python just compares the numeric values; if it's a list of strings, Python compares the strings alpha..

  Segment that prompts the user for an arithmetic operator

The variables x and y refer to numbers. Write a code segment that prompts the user for an arithmetic operator and prints the value abtained by appying that operator to x and y.

  Assume an n × n matrix a is given

Assume an n × n matrix A is given, containing only 1's and 0's, such that, in each row, all 1's come before all 0's. Give an O(n log n) algorithm to count all 1's in A.

  Function should return a dictionary

Write a function numOccur(s), where s is a string; the function should return a dictionary whose keys are the 26 ascii letters abcdefghijklmnopqrstuvwxyz

  You are tasked with improving the code for the haunted

you are tasked with improving the code for the haunted house game. please read the associated hand-out and the code

  Takes a directory containing files that record

Create a program called grading.py that takes a directory containing files that record how student's performed on their assignments and from these files determines each students grades in addition to the course statistics.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd