-from lib.source.ephemeris import Ephemeris
-from lib.source.meteofrance import MeteoFrance
+from predictops.source.ephemeris import Ephemeris
+from predictops.source.meteofrance import MeteoFrance
+from predictops.target.toarea import ToArea
from datetime import datetime
from logging import getLogger
from pathlib import Path
from shutil import rmtree
+import geopandas as gpd
+
fileConfig((Path.cwd() / 'config') / 'logging.cfg')
logger = getLogger()
features = ['hour', 'dayInWeek', 'dayInMonth', 'dayInYear',
'weekInYear', 'month', 'year'])
+print(engine.X[datetime.strptime('06/30/2010 21:00:00', '%m/%d/%Y %H:%M:%S')])
+
+depts = gpd.read_file( Path.cwd() / 'data' / 'targets' / 'departments' / "departements-20180101.shp")
+Doubs = depts.loc[depts['nom'] == 'Doubs'].iloc[0]
+ToArea(area=Doubs.geometry,
+ start = start, end = end)
-print(engine.X[datetime.strptime('06/30/2010 21:00:00', '%m/%d/%Y %H:%M:%S')])
\ No newline at end of file
from geopy.distance import vincenty
from logging import getLogger
from logging.config import fileConfig
-from os import listdir, remove, system
+from os import listdir, remove
from os.path import isfile, basename
from pathlib import Path
from shutil import rmtree
self._end = end
self._features = features
- self._data_directory = (Path.cwd() / 'data') / 'meteo_france'
+ self._data_directory = (Path.cwd() / 'data') / 'features' / 'meteo_france'
self._dated_features = None
'type': row['type'] # qualitative (2) or quantitative (1)
}
for row in reader if row['name'] in self._features}
- dir_data = Path.cwd() / 'data' / 'meteo_france' / 'historical'
+ dir_data = Path.cwd() / 'data' / 'features' / 'meteo_france' / 'historical'
self._dated_features = {}
for csv_meteo in listdir(dir_data):
date = datetime.strptime(csv_meteo.split('.')[1], '%Y%m')
--- /dev/null
+from csv import DictReader
+from datetime import datetime
+from os import listdir
+from pathlib import Path
+
+class ToArea:
+
+ def __init__(self, area = None,
+ start = datetime.strptime('19960101000000', '%Y%m%d%H%M%S'),
+ end = datetime.now()):
+ self._get_located_interventions()
+
+
+
+ def _get_located_interventions(self):
+ self._data_directory = Path.cwd() / 'data' / 'targets' / 'sdis25'
+ self._dict_interv = {}
+ for year in range(2006,2018):
+ if year < 2012:
+ file_place = self._data_directory / 'interventions' / (str(year)+'.csv')
+ else:
+ file_place = self._data_directory / 'victims' / ('Liste_des_victimes_'+str(year)+'.csv')
+ with open(file_place, "r") as f:
+ reader = DictReader(f, delimiter='£')
+ for row in reader:
+ self._dict_interv.update({
+ row['N° intervention']: {
+ 'X' : row['Coord X'],
+ 'Y' : row['Coord Y']
+ } for row in reader
+ })
+ for csv_file in listdir(self._data_directory / 'interventions'):
+ with open(self._data_directory / 'interventions' / csv_file, "r") as f:
+ reader = DictReader(f, delimiter='£')
+ for row in reader:
+ if row['N° intervention'] in self._dict_interv:
+ self._dict_interv[row['N° intervention']].update(
+ {
+ 'start': row['Début'],
+ 'end' : row['Fin']
+ })
+ else:
+ print(row['N° intervention'])
+
+
+
+
+attrs==19.3.0
+Click==7.0
+click-plugins==1.1.1
+cligj==0.5.0
+Fiona==1.8.13
geographiclib==1.50
+geopandas==0.6.3
geopy==1.21.0
+munch==2.5.0
+numpy==1.18.1
+pandas==1.0.1
+pyproj==2.4.2.post1
+python-dateutil==2.8.1
+pytz==2019.3
+Shapely==1.7.0
+six==1.14.0
+xlrd==1.2.0