def emergent_advertisement(self):
        """Función auxliar para pasar las ciudades del cache a una lista con su hora de salida"""

        path = str(os.getcwd(
        ))  #Obtiene la ruta relativa en la computadora de trabajo actual
        dataset2 = pd.read_csv(
            path + "/resources/dataset/dataset2.csv",
            names=["destino", "salida", "llegada", "hora", "fecha de salida"])

        #Esta es una función auxiliar, permite generar avisos audiovisuales para los vuelos próximos a salir
        api_adrees = "http://api.openweathermap.org/data/2.5/weather?appid=ffc17aa1a660f2b034fc2347ab4ade79&q="  # Llave del API para obtener info
        contador_externo = 1
        for i in range(1, 25):
            if dataset2["destino"][i] in self.cache:
                ciudad = self.cache[dataset2["destino"][i]]
                contador_externo -= 1
            else:
                if contador_externo >= 10:
                    time.sleep(30)
                url = api_adrees + dataset2["destino"][i]
                json_data = requests.get(url).json()
                if json_data == {"cod": "404", "message": "city not found"}:
                    continue
                ciudad = City(dataset2["destino"][i],
                              json_data['main']['temp'],
                              json_data['weather'][0]['description'],
                              json_data['main']['humidity'],
                              json_data['main']['temp_max'],
                              json_data['main']['temp_min'])
                ciudad.set_hora_salida(dataset2["salida"][i])
                contador_externo += 1
                self.advertisement(ciudad)
Exemple #2
0
def city_arrival_time():
    #t = Train("Express One", 50, 100)
    #c1 = City("City 1",0,3,300)
    #j = Journey(t,[c1],200)
    #print(j.city_arrival_time(c1)) # 200

    #t = Train("Express One", 50, 10)
    #c1 = City("City 1",0,3,300)
    #c2 = City("City 2",0,3003,300)
    #j = Journey(t,[c1,c2],200)
    #print(j.city_arrival_time(c2)) # 800

    #t = Train("Express One", 50, 10)
    #c1 = City("City 1",100,3,120)
    #c2 = City("City 2",78,300,300)
    #j = Journey(t,[c1,c2],1000)
    #print(j.city_arrival_time(c1)) #,1000
    ##print(j.city_arrival_time(c2)) # 1149

    t = Train("Express One", 50, 10)
    c1 = City("City 1", 100, 3, 120)
    c2 = City("City 2", 78, 300, 300)
    c3 = City("City 3", 50, 100, 240)
    j = Journey(t, [c1, c2, c3], 1000)
    print(j.city_arrival_time(c3))  # 1469
Exemple #3
0
    def containsCity(self, City):
        for city in self.tour:
            if city:
                if city.get_x() == City.get_x() and city.get_y() == City.get_y(
                ):
                    return True

        return False
Exemple #4
0
def CityInJourney():
    t = Train("Express One", 50, 100)
    c1 = City("City 1", 5, 10, 600)
    cities = [c1, City("City 2", 2, 3, 900), City("City 3", 0, 0, 300)]
    j = Journey(t, cities, 200)
    r = j.city_in_journey(c1)
    print(r)
    print(j.city_in_journey("City 1"))
Exemple #5
0
    def load_dict_countries_states_cities(countries, glb):

        dict_countries = dict()
        dict_cities = dict()

        for country_name in countries:
            country = Country(country_name)
            dict_countries[country_name] = country

        data = funs.load_pkl_file('flt_location_data.pkl')

        data = [(ci, co, st, a2, a3, p, lat, lon)
                for (ci, co, st, a2, a3, p, lat, lon) in data
                if co in countries]

        #        print dict_countries['mexico'].dict_states
        for (ci, co, st, a2, a3, p, lat, lon) in data:
            try:  # Neglect locations where the corresponding countries are not in the list
                if co:
                    co = co.lower()
                    country = dict_countries[co]
                    if ci:
                        city = City(ci, (lat, lon))
                        city.co_name = country.name
                        dict_cities[city.latlong] = city
                    if st:
                        if not country.dict_states.has_key(st):
                            country.dict_states[st] = State(st)
                        state = country.dict_states[st]
                        state.co_name = country.name
                        city.st_name = st
                        state.dict_cities[city.latlong] = city


#                    dict_city_keywords[city.latlong] = dict()
            except:
                pass

        for co_name, country in dict_countries.items():
            #            print co_name
            for st_name, state in country.dict_states.items():
                print st_name
                state.update_latlong(
                )  # calcualte the center of the cities in the state as the state location
                state.build_city_neighborhood_graph()
                state.kdtree = None
            country.update_cities(
            )  # merge cities in states into a single dictionary
            country.build_state_neighborhood_graph(
            )  # built based on k nearest neighbors
            country.kdtree = None

        dict_states = dict()
        for co_name, country in dict_countries.items():
            for st_name, state in country.dict_states.items():
                dict_states[(co_name, st_name)] = state

        return dict_countries, dict_states, dict_cities
Exemple #6
0
def AddDest():
    t = Train("Express One", 50, 100)
    c1 = City("City 1", 5, 10, 600)
    c2 = City("City 2", 2, 3, 900)
    j = Journey(t, [c1, c2], 200)
    print(j)
    ct = City("City 3", 8, 4, 440)
    j.add_destination(ct)
    print(j)
Exemple #7
0
    def distanceBetweenTwoCities(self, actualCity: City.City,
                                 neighborCity: City.City):

        numberLines = len(actualCity.getCityNeighbors())

        for i in range(numberLines):
            for j in range(1):
                if actualCity.getCityNeighbors()[i][j] == neighborCity.getName(
                ):
                    return actualCity.getCityNeighbors()[i][1]
        return -1
Exemple #8
0
def total_journey_time():
    t = Train("Express One", 50, 100)
    c1 = City("City 1", 0, 3, 300)
    j = Journey(t, [c1], 200)
    print(j.total_journey_time())  #,300)

    t = Train("Express One", 50, 10)
    c1 = City("City 1", 0, 3, 300)
    c2 = City("City 2", 0, 3003, 300)
    j = Journey(t, [c1, c2], 200)
    print(j.total_journey_time())  #,900)
Exemple #9
0
def TotalJourneyDistance():
    #t = Train("Express One", 50, 100)
    #c1 = City("City 1",0,3,300)
    #j = Journey(t,[c1],200)
    #print(j.total_journey_distance()) # 0

    t = Train("Express One", 50, 100)
    c1 = City("City 1", 0, 3, 300)
    c2 = City("City 2", 0, 8, 300)
    j = Journey(t, [c1, c2], 200)
    print(j.total_journey_distance())  # 5
Exemple #10
0
def JourneyTestSTR():
    t = Train("Express One", 50, 100)
    c1 = City("City 1", 5, 10, 600)
    c2 = City("City 2", 2, 3, 900)
    c3 = City("City 3", 0, 0, 300)
    c4 = City("City 4", 12, 4, 1000)
    j = Journey(t, [c1, c2, c3, c4], 200)

    #MyTrain = Train("Norman", 324, 65) #(name, max passengers, fps)
    #Journey1 = Journey(MyTrain, ["aaa", "bbb", "ccc", "ddd", "eee", "fff"], 4060)
    print(j)
Exemple #11
0
def CityEQ():
    MyCity1 = City("Jersey", 9, 20, 50)
    MyCity2 = City("Vegas", 9, 22, 100)
    print(MyCity1.__eq__(MyCity2))
    MyCity3 = City("Vegas", 9, 22, 100)
    print(MyCity2.__eq__(MyCity3))
    MyCity4 = City("Atco", 9, 20, 50)
    print(MyCity1.__eq__(MyCity4))
Exemple #12
0
 def __init__(self, **kwargs):
     self.city = City(kwargs["building_size"], kwargs["building_number"],
                      kwargs["c_type"])
     self.car_num = kwargs["number_of_cars"]
     self.cars: List[Car] = []
     self.car_notification_on = kwargs["car_notification_on"]
     self.CAR_NOTIFICATION_RANGE = kwargs["car_notification_range"]
     self.RANDOM_SEED = kwargs["random_seed"]
     if self.RANDOM_SEED == None:
         seed()
     else:
         seed(self.RANDOM_SEED)
Exemple #13
0
    def __init__(self):
        self.date = datetime.datetime(1920, 1, 1)

        possible_cities = [
            City(self.date, "Boston", (530, 10)),
            City(self.date, "New York", (390, 120)),
            City(self.date, "Norfolk", (280, 360)),
            City(self.date, "Jacksonville", (15, 750)),
        ]
        self.cities = random.sample(possible_cities, 3)

        self.players = [Player()]
        self.date = datetime.datetime(1920, 1, 1)
    def load_dict_countries_states_cities(countries, glb):
    
        dict_countries = dict()
        dict_cities = dict()
    
        for country_name in countries:
            country = Country(country_name)
            dict_countries[country_name] = country
    
        data = funs.load_pkl_file('flt_location_data.pkl')
        
        data = [(ci, co, st, a2, a3, p, lat, lon) for (ci, co, st, a2, a3, p, lat, lon) in data if co in countries]
    
#        print dict_countries['mexico'].dict_states
        for (ci, co, st, a2, a3, p, lat, lon) in data:
            try: # Neglect locations where the corresponding countries are not in the list
                if co:
                    co = co.lower()
                    country = dict_countries[co]
                    if ci:
                        city = City(ci, (lat,lon))
                        city.co_name = country.name
                        dict_cities[city.latlong] = city
                    if st:
                        if not country.dict_states.has_key(st):
                            country.dict_states[st] = State(st)
                        state = country.dict_states[st]
                        state.co_name = country.name
                        city.st_name = st
                        state.dict_cities[city.latlong] = city
#                    dict_city_keywords[city.latlong] = dict()
            except:
                pass

        for co_name, country in dict_countries.items():
#            print co_name
            for st_name, state in country.dict_states.items():
                print st_name
                state.update_latlong() # calcualte the center of the cities in the state as the state location
                state.build_city_neighborhood_graph()
                state.kdtree = None
            country.update_cities() # merge cities in states into a single dictionary
            country.build_state_neighborhood_graph() # built based on k nearest neighbors
            country.kdtree = None

        dict_states = dict()
        for co_name, country in dict_countries.items():
            for st_name, state in country.dict_states.items():
                dict_states[(co_name, st_name)] = state
    
        return dict_countries, dict_states, dict_cities
Exemple #15
0
 def test_ciudadString(self):
     """ Prueba unitaria para verificar que __str__ de una ciudad funciona correctamente """
     ciudad = City("CDMX", 30, "nublado", 30, 12, 25)
     self.assertEqual(
         ciudad.__str__(),
         ciudad.get_nombre() + " Temperatura: " + ciudad.get_temperatura() +
         " °C" + " Temperatura minima: " + ciudad.get_temp_min() + " °C" +
         " Temperatura máxima: " + ciudad.get_temp_max() + " °C" +
         " Cielo: " + ciudad.get_descripcion_clima() + " Humedad: " +
         ciudad.get_humedad() + " %")
Exemple #16
0
def readCities():
    path = "data/hard_0.txt"
    cities = [City(0, 0, 0)]
    with open(path, 'r') as file:
        content = file.readlines()
        for line in content:
            row = line.split('\t')
            id = int(row[0])
            x = float(row[1])
            y = float(row[2])
            cities.append(City(id, x, y))
    file.close()

    return cities
Exemple #17
0
    def consume(self, fraction, x, y,
                population):  #spożycie jedzenie przez ludzi w miastach frakcji
        """Spożywanie jedzenia przez ludzi w miastach."""

        self.city = City(x, y, population)
        if self.city.build_job(
                fraction
        ) != True:  # jeśli jest jedzenie, punkty frakcji zwiększają się
            self.city.build_job(fraction)
            fraction.points += self.city.population
        else:
            self.city.build_job(fraction)
            fraction.points -= self.city.population * 2  # jeśli nie ma jedzenia zmniejszają
        return self.city.population
Exemple #18
0
    def setUp(self):
        """Prepare environment for testing."""

        self.city = City(position=Pos(0, 0), wind=(1, 2), metric='simple')

        self.drone0 = Drone(0, max_capacity=50, max_speed=10)  # Empty drone
        self.drone1 = Drone(1, max_capacity=140,
                            max_speed=8)  # Drone with parcels

        self.parcel1 = Parcel(1, Pos(1, 1), 10)
        self.parcel2 = Parcel(2, Pos(-20, -1), 5)

        self.drone1 += self.parcel1
        self.drone1 += self.parcel2
Exemple #19
0
 def load_scene(self, name, key, mode, tempo, defaults={}):
     self.music_player.freeze()
     self.music_player.cs.perf.Stop()
     self.music_player.cs.perf.Join()
     self.music_player.cs.csound.cleanup()
     sc = City.ScenePlayer(name, key, mode, tempo, defaults)
     mp = City.makePlayer(sc)
     global schedEvent, now
     schedEvent = sc.TimeQueue.schedEvent
     now = sc.cs.perfTime
     self.scene = sc
     self.music_player = mp
     self.music_player.playLoop(now())
     self.selectedInstrument.Touch = True
     self.music_player.picture_cycle = [self, True]
Exemple #20
0
    def initialize(self):
        self.status = 'INIT'
        ## all cities
        self.cities = City.load()

        ## opend cities
        self.accessible_cities = self.cities
        for city in self.cities:
            city.add_cargos(Cargo.generate(city, self.cities, 5))

        ## owned trucks
        self.trucks = Truck.load()

        self.cur_city = self.cities[0]
        self.cur_truck = None
        self._map = Map(self.cities)

        fm_map = MapForm(self)
        fm_trucks = TruckList(self, [])
        fm_menu = Menu(self)
        fm_city = CityForm(self)
        fm_cargo = CargoList(self, [])
        fm_wild = WildForm(self)

        self.forms.append(fm_map)
        self.forms.append(fm_trucks)
        self.forms.append(fm_menu)
        self.forms.append(fm_city)
        self.forms.append(fm_cargo)
        self.forms.append(fm_wild)

        self.cur_form = 3
        self.focus = self.forms[self.cur_form].focus()

        self.refresh_truck()
Exemple #21
0
def main(argv):

    number_exec = int(argv[1])
    filename = ""

    cities = []

    while True:
        try:
            line = input().strip()

            if "NAME" in line:
                filename = line

            elif line == "NODE_COORD_SECTION":

                while True:
                    try:

                        line = input().split()
                        city = City(line[0], line[1], line[2])
                        cities.append(city)
                    except Exception as e:
                        #print ("1 " + str(e) + " city :" + str(city.id))
                        break

        except Exception as e:
            #print ("2 " + str(e) + " city :" + str(city.id))
            break

    tsp = TSP()
    M = tsp.get_distance_matrix(cities)

    #tsp.pretty_print(M)
    #exit()

    #print ("\nCusto NN : " + str(custo_nn))
    #tsp.print_tour_simple(nn_tour)

    print("Executing " + str(number_exec) + " times on : " + str(filename))

    start_time = timeit.default_timer()

    minimo = float("inf")
    for i in range(number_exec):
        #alpha = random.uniform(0, 1)
        alpha = 0.5
        grasp_tour = tsp.GRASP_TSP(cities, M, alpha)
        custo_final = tsp.get_cost(grasp_tour, M)

        if custo_final < minimo:
            print("\nAlpha : " + str(alpha) + " Custo GRASP: " +
                  str(custo_final))
            tsp.plot_cities(grasp_tour)
            minimo = custo_final

    elapsed = timeit.default_timer() - start_time

    print("Elapsed time : " + str(elapsed) + " s")
    print("---------------------------------------------\n\n")
Exemple #22
0
def main():
    parser = argparse.ArgumentParser()

    parser.add_argument("cityName", type=str, help="Name of the city.")
    parser.add_argument("latitude", type=str, help="Latitude")
    parser.add_argument("longitude", type=str, help="Longitude")
    parser.add_argument("inputDate", type=str, help="Input Date {Y-M-d H-m-s}")

    args = parser.parse_args()
    cityName = args.cityName
    latitude = args.latitude
    longitude = args.longitude
    inputDateStr = args.inputDate

    if inputDateStr is not None:
        inputDate = datetime.strptime(inputDateStr, '%Y-%m-%d %H:%M:%S')
    else:
        inputDate = now().strftime('%Y-%m-%d %H:00:00')

    city = City(cityName, latitude, longitude)
    gen = GenerateWeather()
    results = gen.getFakeData(city, inputDate)

    print(results)

    return
Exemple #23
0
def NewCity():
    MyCity1 = City("Philly", 9, 20, 50)
    print(MyCity1.loc_x)
    print(MyCity1.loc_y)
    print(MyCity1.name)
    print(MyCity1.stop_time)
    print(MyCity1)
Exemple #24
0
def main():
    # get data from dataset directory
    base = os.path.dirname(os.path.abspath(__file__))
    dataset = os.path.normpath(
        os.path.join(
            base, '../../dataset/world_city_data/s55h29megacities_utf8.csv'))

    # 巡回する都市を設定
    df = pd.read_table(
        dataset, sep='\t',
        usecols=lambda x: x is not 'note_jp')  # column "note_jp"は欠損しているからスキップ
    df.query('country_code == "JP"', inplace=True)
    cities = []
    for name, lat, lon in zip(df['city_en'], df['lat'], df['lon']):
        cities.append(City(name, lat, lon))

    # 最短距離を求める
    fitness = []
    for j in range(3):
        pop = Population(cities)
        tmp = []
        for i in range(1, Individual.GEN_MAX + 1):
            pop.alternate(j)
            tmp.append(pop.ind[0].fitness)
            # print("第{}世代: 最短距離{}(km)".format(i, pop.ind[0].fitness)) # 各世代の最短距離を表示
        pop.printResult()
        fitness.append(tmp)
    visualize_evolution(fitness)  # matplotlibで可視化する
Exemple #25
0
 def _possibleGenes(self):
     cities = []
     for i in range(self.nCities):
         l = r.randint(0,360)
         x = City(index=i, location=l)
         cities.append(x)
     return cities
    def testNewCity(self):
        latitude = 41.7408652
        longitude = -87.8603343
        city = City("Willow Springs", latitude, longitude)

        date1 = datetime.today()
        date1 = date1.replace(year=2017)
        date1 = date1.replace(month=11)
        date1 = date1.replace(day=23)
        date1 = date1.replace(hour=11)
        res = self.gen.getFakeData(city, date1, 1)
        print()
        print(res)

        testData = self.gen.test[(
            self.gen.test.datetime.str.startswith('2017-11-23'))]
        tMin = testData['temperature'].min() - testData['temperature'].std()
        tMax = testData['temperature'].max() + testData['temperature'].std()

        pMin = testData['pressure'].min() - testData['pressure'].std()
        pMax = testData['pressure'].max() + testData['pressure'].std()

        hMin = testData['humidity'].min() - testData['humidity'].std()
        hMax = testData['humidity'].max() + testData['humidity'].std()

        print("Temperature({}, {})".format(tMin, tMax))
        print("Pressure({}, {})".format(pMin, pMax))
        print("Humidity({}, {})".format(hMin, hMax))

        [rTemp, rPressure, rHum] = self.getNumericalWeatherData(res)

        self.assertTrue(rTemp <= tMax and rTemp >= tMin)
        self.assertTrue(rPressure <= pMax and rPressure >= pMin)
        self.assertTrue(rHum <= hMax and rHum >= hMin)
 def do_request(self, api_adrees, s):
     """ Procesa e imprime la información de una ciudad del dataset2 
      Parametros
      ----------
      api_adrees : str
       el api_adrees
      s : str
       la ciudad a procesar
     """
     if s in self.cache:
         ciudad = self.cache[s]
     else:
         if self.counter >= 31:  #Solo tomamos 30 peticiones para poder tomar 29 de nuestro dataset1
             self.counter = 1
             time.sleep(30)
         self.counter += 1
         url = api_adrees + s
         json_data = requests.get(url).json()
         if json_data != {"cod": "404", "message": "city not found"}:
             ciudad = City(s, json_data['main']['temp'],
                           json_data['weather'][0]['description'],
                           json_data['main']['humidity'],
                           json_data['main']['temp_max'],
                           json_data['main']['temp_min'])
             self.cache[s] = ciudad
             return ciudad
Exemple #28
0
 def get(self, path):
     try:
         print('CityHandler')
         print(self.request.uri)
         print(self.get_argument('key'))
         #val = urllib.parse.unquote(self.get_argument('key'))
         val = tornado.escape.url_unescape(self.get_argument('key'))
         print('val is ' + val)
         referer = self.request.headers.get('Referer')
         try:
             lang = re.search(r'-(.*)\..*', referer).group(1)
         except:
             lang = 'cn'
         if City.isCity(val):
             print('content city is ' + val)
             self.write(
                 getPointsFromCity(val, lang,
                                   self.request.host.split(".")[0]))
         else:
             print('404 not found ' + val)
             self.write('{"link":"http://' + self.request.host +
                        '/html/404.html"}')
         print(
             '===========================================================')
     except Exception as e:
         print('EXCEPTION FROM CityHandler get:')
         print(e)
Exemple #29
0
 def addCity(self, city_name, path_to_metro_data,\
  path_to_bus_data, path_to_metro_map, path_to_bus_map):
     # Append city to list of cities
     self.cities.append(City(city_name,\
      os.path.normpath(path_to_metro_data),\
      os.path.normpath(path_to_bus_data),\
      os.path.normpath(path_to_metro_map),\
      os.path.normpath(path_to_bus_map)))
def load_cities(city_file_name):
    """
    Creates a city object <cityName,cityObject> from a specified file
    :param city_file_name: the name of the file which holds the data
    :return: dict<cityName,cityObject>
    """
    with open(city_file_name) as city_file_handler:
        return {l.split()[0]: City(*l.split()) for l in city_file_handler}
Exemple #31
0
def load_cities(city_data):
    city_array = []

    for i in range(len(city_data)):
        index, x_pos, y_pos = re.findall(r"[-+]?\d*\.\d+|\d+", city_data[i])
        city_array.append(City(int(index), float(x_pos), float(y_pos)))

    return city_array
Exemple #32
0
def main():
    address_old = 'localhost'
    port_old = 27017

    address_new = '192.168.6.254'
    port_new = 37017

    print("convert label type data")
    LabelType.insert_label_type(address_new, port_new)
    
    print("convert area data")
    Area.insert_area(address_old, port_old, address_new, port_new)

    print("convert label data")
    Label.convert_label(address_old, port_old, address_new, port_new)

    # 城市表 依赖新导入的Label表,需保证City前导入Label
    print("convert city data")
    City.convert_city(address_old, port_old, address_new, port_new)

    print("convert weather data")
    Weather.convert_weather(address_old, port_old, address_new, port_new,
                            Weather.collection_old, Weather.collection_new, Weather.params_map)
    
    # 特别注意  weather_history 表依赖于当前的 weather 表
    print("create weather_history data")
    WeatherHistory.create_weather_history(address_new, port_new, address_new, port_new,
                            WeatherHistory.collection_old, WeatherHistory.collection_new, WeatherHistory.params_map)

    print("convert pgc data")
    Pgc.convert_pgc(address_old, port_old, address_new, port_new)

    print("convert label data")
    Label.convert_label(address_old, port_old, address_new, port_new)

    print("convert attraction data")
    Attraction.convert_attraction(address_old, port_old, address_new, port_new,
                                  Attraction.collection_old, Attraction.collection_new, Attraction.params_map)

    print("convert restaurant data")
    Restaurant.convert_restaurant(address_old, port_old, address_new, port_new,
                                  Restaurant.collection_old, Restaurant.collection_new, Restaurant.params_map)

    print("convert shopping data")
    Shopping.convert_shopping(address_old, port_old, address_new, port_new,
                              Shopping.collection_old, Shopping.collection_new, Shopping.params_map)

    print("convert activity data")
    Activity.convert_activity(address_old, port_old, address_new, port_new,
                              Activity.collection_old, Activity.collection_new, Activity.params_map)

    print("convert recommendBynamic data")
#    RecommendDynamic.convert_recommendDynamic(address_old, port_old, address_new, port_new,RecommendDynamic.collection_old, 
#                               RecommendDynamic.collection_new, RecommendDynamic.params_map)

    print("convert plan data")
    Plan.convert_plan(address_old, port_old, address_new, port_new,
                      Plan.collection_old, Plan.collection_new, Plan.params_map)
    
    
    print("convert brand data")
    Brand.convert_brand(address_old, port_old, address_new, port_new,
                              Brand.collection_old, Brand.collection_new, Brand.params_map)
    print("OK")
Exemple #33
0
from City import City
from Coordinates import Coordinates
from District import District
from Field import Field
from FunctionBuilding import FunctionBuilding
from HabitationBuilding import HabitationBuilding
from Road import Road

from imp import reload
import TraductorModule
reload(TraductorModule)
from TraductorModule import Traductor 

boundaries = [Coordinates(0, 0, 0), Coordinates(100, 0, 0), Coordinates(100, 100, 0), Coordinates(0, 100, 0)]
field = Field(boundaries)
city = City("Paris", field)
road = Road([Coordinates(50, 0, 5), Coordinates(50, 50, 5)])
field.addNetwork(road)

districtBoundaries = [Coordinates(10, 10, 0), Coordinates(40, 10, 0), Coordinates(40, 90, 0), Coordinates(10, 90, 0)]
district = District()
district.setBoundaries(districtBoundaries)
field.setDistricts([district])

habitation = HabitationBuilding(districtBoundaries, 50)
function = FunctionBuilding(districtBoundaries, 20)
area = Area(districtBoundaries)

blocks=[]
for i in range(10):
    block = Block()
Exemple #34
0
from City import City

filename = 'climates.csv'

with open(filename, 'w') as file:
      file.write('City, Low min, Low max, High min, High max, Sunshine\n')
      
cities = ['Bratislava', 'Prague', 'Budapest', 'Vienna', 'Leipzig', 'Berlin', 'Hamburg', 'Zurich', 'Amsterdam', 'Paris', 'London', 'Edinburgh', 'St_Andrews', 'Milan', 'Barcelona', 'Madrid', 'Lisbon', 'Tenerife']
cities += ['Boston', 'Raleigh', 'Phoenix,_Arizona', 'Los_Angeles', 'San_Francisco', 'Seattle', 'Vancouver', 'Toronto']
cities += ['Singapore', 'Brisbane', 'Melbourne', 'Sydney', 'Perth', 'Auckland', 'Dunedin', 'Wellington']

for city in cities:
  C = City(city)
  C.parse_page()
  C.save(filename)