Skip to main content
Sign in
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
  • logements_modif
  • meteo_mensuelle
3 results

Target

Select target project
  • leximpact / DataCirco / datacirco-prepare-data
1 result
Select Git revision
  • master
  • logements_modif
  • meteo_mensuelle
3 results
Show changes

Commits on Source 5

5 files
+ 29
3
Compare changes
  • Side-by-side
  • Inline

Files

+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ class Carto:
        if self.data.population.carreaux_densite_population_2021:
            carreaux = self.data.population.carreaux_densite_population_2021
        else:
            raise ValueError("Pas de données de densité de population pour 2020 !")
            raise ValueError("Pas de données de densité de population pour 2021 !")
        # elif self.data.population.carreaux_densite_population_2018:
        #     carreaux = self.data.population.carreaux_densite_population_2018
        # else:
+12 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ import cdsapi
import humanize
import requests
from datacirco import utilitaires
import datetime

# Disable warning
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
@@ -41,7 +42,7 @@ FORMAT = "netcdf"
# PRODUCT = 'reanalysis-era5-single-levels'
# TYPE = 'reanalysis'
# TYPE = 'ensemble_members'
TIME = [f"{i}:00".zfill(5) for i in range(24)]
# TIME = [f"{i}:00".zfill(5) for i in range(24)]

# Monthly
PRODUCT = "reanalysis-era5-single-levels-monthly-means"
@@ -157,7 +158,16 @@ if __name__ == "__main__":
        print(f"{DATA_DIR} don't exist !")
        exit(1)
    years = range(START_YEAR, END_YEAR + 1)
    year_month = [(y, m) for y in years for m in MONTH]
    current_year_now = datetime.datetime.now().year
    last_month_now = datetime.datetime.now().month - 1
    year_month = []
    for y in years:
        for m in MONTH:
            # Stop at last month
            if y < current_year_now or (
                y == current_year_now and int(m) < last_month_now
            ):
                year_month.append((y, m))
    module = "meteo"
    utilitaires.clear_dataset_source(module)
    utilitaires.add_dataset_source(
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ for data in tqdm(datasets_education):
    utilitaires.replace_in_file(local_filename, ",", ".")
    utilitaires.replace_in_file(local_filename, "(1);", ";")
    utilitaires.replace_in_file(local_filename, ";ND", ";")
    utilitaires.replace_in_file(local_filename, ";NA", ";")
    utilitaires.replace_in_file(local_filename, ";nd", ";")
    utilitaires.replace_in_file(local_filename, ";NS", ";")
    # Oui, il faut le faire deux fois pour que ça marche ! Mystère...
+7 −0
Original line number Diff line number Diff line
@@ -56,7 +56,14 @@ utilitaires.execute_command(

run("TRUNCATE iris_ge")

# Check if the directory exists and have files
if not glob.glob("IRIS-GE*/*/*/*/*.SHP"):
    print("Aucun fichier IRIS-GE trouvé dans le répertoire.")
    print("Vérifiez que le fichier est bien présent et relancez le script.")
    exit(1)

for shp in glob.glob("IRIS-GE*/*/*/*/*.SHP"):
    print(f"Import de {shp}")
    utilitaires.execute_command(
        f"PG_USE_COPY=yes ogr2ogr -f pgdump /vsistdout/ {shp} -nln iris_ge -nlt geometry -t_srs EPSG:4326 -LCO CREATE_TABLE=OFF | {database_command_line}"
    )
+8 −0
Original line number Diff line number Diff line
@@ -227,4 +227,12 @@ with open("population_france.csv", "r") as f:
    )
pg.commit()

run(
    """
    UPDATE population_france
    SET france = france * 1000,
        france_metropolitaine = france_metropolitaine * 1000;
    """
)

utilitaires.end("sante.py")