Commit d1463075 authored by Grégoire PETIT's avatar Grégoire PETIT
Browse files

ça y est c'est corrigé

parent 3c38d204
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost"
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "enter-your-module-name-here",
"console": "integratedTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
},
{
"name": "Python: Current File (External Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
}
]
}
\ No newline at end of file
......@@ -8,9 +8,9 @@ from math import atan, pi
from matplotlib import pyplot
input_filename_altitude="../moodle/elevation1x1_new-mer-bleue_deforme.bmp"
input_filename_altitude="D:/documents/IMT/datascience/challenge3/moodle/elevation1x1_new-mer-bleue_deforme.bmp"
im_alt = Image.open(input_filename_altitude)
input_filename_poputation="../moodle/population-density-map.bmp"
input_filename_poputation="D:/documents/IMT/datascience/challenge3/moodle/population-density-map.bmp"
im_pop = Image.open(input_filename_poputation)
# This modules gives useful informations
......@@ -42,19 +42,20 @@ def getAltXY(pixel): #Permet d'avoir l'altitude réelle pour un pixel
def getPopXY(pixel):#Permet d'avoir la population réelle pour un pixel
pop_max=3000
rgbValues=im_pop.getpixel(pixel)
if max(rgbValues)>=30: #la mer n'est pas totalement noire, on filtre donc
res=pop_max/255*max(rgbValues)
rgbValues=im_pop.getpixel(pixel) #c'est des niveaux de gris, donc r=g=b
if rgbValues[0]>=24: #la mer n'est pas totalement noire ((24,24,24) ou (16,16,16)), on filtre donc
res=(rgbValues[0]-24)*pop_max/231 #231=255-24
else:
res=0
return(res)
def popCaseXY(case): #Permet d'avoir la population moyenne réelle d'une cellule (donc prend une cellule en entrée)
return(sum([sum([getPopXY((x,y)) for x in range(case[0],case[0]+15)]) for y in range(case[1],case[1]+15)]))
return(sum([sum([getPopXY((x,y)) for x in range(case[0]*15,case[0]*15+15)]) for y in range(case[1]*15,case[1]*15+15)]))
print("la mer a une poputation de ", popCaseXY([21,21]))
print("coucou", popCaseXY([4430//15,2150//15]))
def altCaseXY(case):#Permet d'avoir l'altitude moyenne réelle d'une cellule (donc prend une cellule en entrée)
return(max([max([getAltXY((x,y)) for x in range(case[0],case[0]+15)]) for y in range(case[1],case[1]+15)]))
return(max([max([getAltXY((x,y)) for x in range(case[0]*15,case[0]*15+15)]) for y in range(case[1]*15,case[1]*15+15)]))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment