Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main.py #29

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 13 additions & 40 deletions notebooks/IndicateursSecheresse/data_processing/main.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,24 @@
from base_standard_index import BaseStandardIndex
from datetime import date, timedelta, datetime
from water_tracker import WaterTracker
from water_tracker import WaterTracker1

def main():
# Remplacez 'votre_cle_api' par votre clé API réelle
api_key = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiZWUxMTk3Y2JlMmZlMzY0NGQwOTUyZTZiNzBlZjJlOTU5NzQ4MDFhNWE3MDQ5OTY5OTc0NmNhZjE5MDM5OWFhODJjNWIxMWQxOWQ4NGI5YWQiLCJpYXQiOjE3MDU5OTkwMjYuMjg2NjA0LCJuYmYiOjE3MDU5OTkwMjYuMjg2NjEsImV4cCI6MTcwNzI5NTAyNi4yNzM2NTcsInN1YiI6IjE5MjMwIiwic2NvcGVzIjpbXX0.Cy97gG8bGp-hz9xcVx8GxfRnnk-lVB0bAPhICm9pIgrZUaP3xmGr4yMdmS3H89tCaa88leOMkv0EHoHyn6xYcgFPxI5ZUNvYUpPdpDKi5LwIhs8S5Js6Wc1Dot8J8mvNMcvyQsv1MwQyt0bkaiSEbQD4fsCQn1ic3YvFrsr40r7pclKyLTprbkMAMTO7N9eiyv8AXMbXuVNTEZZpZ2j5d9jCrem07bqAWmsfkXSalL9bRWlXb5uTVRLaGHmE5ReFHjA33dneZYVdiv0iRenctU17WEuhD_GsVgaKkQe80dQOmX5M7ThrVEs-UNokBKOvJzIEm-Bj2OB3ancm3CbpM--WpX47J6aeyhsAGUhWmotgpWn6SVLrriRlDNz_Xj5-8DANudHUG7Hytbzw2PUB413dKTwSTPw_pheXhJt7U65dYT__DwQ-Sk_OkDa_OxVPGOuvryw82ga1RF48dHmyDa0DijQEhhgB5WTqQPd-bfx2jKhGctaCaPvGuDqkfF7joeLEVqGzV9_QAMUROzLKffYvAoxW0A283d7pV90w4j2PxIxrXPK8OVm044Yryvvez_czrS61L_9ScjMKM190qApmqn_D3ReXn7GpkUdE9l09E5gF7gQg4ksncpGETS4LXlNQM35mYKClpDG6BhLBpZqwX-c4_U_N3l-YvoY_vQM"
# Remplacez 'votre_cle_api'. Il peut arriver que la clé ne marche pas. Dans ce cas,
#il fraudra se connecter sur https://api.emi.imageau.eu/doc pour actualiser la clé API.
api_key = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiZGNmNjgwNzEwODk3NzRiNTIxMjQ2NzQ0ZWRhOTMyMWVjYWMyM2Y1MTlkZTNhNWY3NGEzOWM2NmQwMGY1MWYwNWM3MWJlYTg0YzVmNjQzNjAiLCJpYXQiOjE3MDcyOTU2ODUuMjU3NDQ0LCJuYmYiOjE3MDcyOTU2ODUuMjU3NDQ3LCJleHAiOjE3MDg1OTE2ODUuMjUxMTM5LCJzdWIiOiIxOTIzMCIsInNjb3BlcyI6W119.WOJY9Mz1F9F0o-KwvG3xolwfvK0Rv5s-QSKET6pRA6y7PKFkoVT3_0lYXYZ74xOdRClkULTdpMytCV47qQZG1zfk8AmjLaHBApn4L4NX3en1ndXkNvfjgqcJHhn7BVnGSBbkvUe8qORs_k_zeMWEuZ6TpRYzdLi7HQWHkvErE-RZhXctK82YQSVf-bWgIMx2tFovI-n3LydnfMniDKnLkCRHEpm6x_9ilmHBU_NjagHjf8V1VLI6tvxnORjymy129_1Q1iME8sTJNLiRlZv5ZHR0d2TzK_slXyK-OfhgXKCZbv6ILbjXgyTd5RIVSv_IpuFPTsZd4zWVFYpPrVdsWPT4-5k_KcUo1X8UzqQYG__MXFxqRdUBf0z8q7xOkmkulFgTovz2PGXQwmkWGwHf6M_wsjzKuLyqzYXIRC_n1wbHoQ6Q25HCn3P_0clZIUlLkj_thsBnZLh3R09va7XbtHWrtS_xYWeoTRToea8EE9hL1Yp-wSs_Y8lLWJjnDA_bfN_qjaJUy86eCQl3v6WPGcCiB9ezlvNg1_8Ix1uSGasgBy3UY7YNM3_QcgAoKPp5xnnQNcGi3eRXhYqTpc1qNJpIka0f69rblm4_3op2iXbKBm_7ZvYoJfcE6C_UQA6GnZfmLeHRTdotmTG1li89FuyELGAmxR-VUjz7y8oX-K0"

indicateurs = ["nappes", "pluviométrie"]
indicator= ["débit"]


# Créez une instance de la classe WaterTracker
wt = WaterTracker(api_key)
wt1 = WaterTracker1(api_key)


# If you haven't built station data and downloaded all timeseries yet uncomment the following lines to do so
# téléchargez les données
wt.build_stations_data()
wt.download_all_timeseries()
wt1.build_stations_data()
wt1.download_all_timeseries()

for indicateur in indicateurs:
# Comment the following line if you don't want to recalculate standardized indicators on each run
wt.process(indicateur=indicateur)

# Load existing data
wt.load()

# Generate the plot for drought distribution in France
wt.plot_counts_france(indicateur=indicateur)

for indicateur in indicator:
# Calculez les indicateurs nappes, pluie et débit
sgi_result_all_stations = wt.sgi_to_all_stations() #le code est fait pour
spi_result_all_stations = wt.spi_to_all_stations()
result_df_all_stations = wt.apply_galton_law_to_all_stations()
# Affichez le graphique des indicateurs nappes, pluie et débit
wt.plot_level_nappes(sgi_result_all_stations)
wt.plot_level_pluie(spi_result_all_stations)
wt.plot_level_debit(result_df_all_stations)

#wt1.load_timeseries(indicateur=indicateur)


#wt1.apply_galton_law_to_single_station(station_id)


# Appliquer la loi de Galton à toutes les stations
result_df_all_stations=wt1.apply_galton_law_to_all_stations()


# Créer et afficher le graphique
wt1.plot_level_percentage(result_df_all_stations)



if __name__ == "__main__":
Expand Down
Loading