Main

 avatar
unknown
plain_text
2 years ago
2.7 kB
4
Indexable
from fonctions_flou import *
from fonctions_autres import *
import numpy as np

import matplotlib.pyplot as plt

# FAIRE GAFFE, LES DONNES NETCDF SONT : [ORDONNEE;ABSCISSE]

# mettre les notations de Kauffman sur le rapport / dire que la T norm c'est min / Bibliographie,... TOUT METTRE
# dire ce qu'on aurait pu faire si on avait plus de temps

# longitude / latitude / time / d = divergence / r = humidity / t = temperature / u=uwind / v=vwind / vo=vortcity

# ________________________


# Les calculs se font en unités SI (mètres, secondes,...). Pour l'affichage, nous convertissons cependant l'abscisse
# et l'ordonnée en mètre
# plt.streamplot(met_to_deg(lon), met_to_deg(np.flip(lat)), np.flip(uwind[t,:,:], 0), np.flip(vwind[t,:,:], 0),
#               density=5,linewidth=0.3,color=np.flip(psi, axis=0))


t0 = t_TC0 + 100  # Début de l'étude
t1 = t0 + 50
dt = 16

for t in range(t0 + dt, t1, dt):
    # Espace de travail pour le cyclone
    rayon_espace = 1000000  # En mètre
    range_lon = np.isclose(lon, x_TC[t0], atol=rayon_espace)
    range_lat = np.isclose(lat, y_TC[t0], atol=rayon_espace)
    range_grid = np.meshgrid(range_lon, range_lat)
    # Nous souhaitons les emplacements où les valeurs en lon ET en lat sont True
    study_grid = range_grid[0] * range_grid[1]

    print("______________________SF1________________________")
    SF1_temperature = np.where(study_grid, temperature[t0, :, :], float('nan'))

    SF1_temperature = np.nanmean(SF1_temperature)
    SF1_dwind = variation_vitesse_TC(t0, study_grid)
    SF1_lifetime = (t0 - t_TC0) / 24
    duree_de_vie = SF1_compute(SF1_temperature, SF1_dwind, SF1_lifetime, want_to_plot=False)

    print("Température :", np.rint(SF1_temperature), "Variation de la vitesse :", np.rint(SF1_dwind),
          "Age du cyclone :", np.rint(SF1_lifetime))
    print("__________________SORTIE SF1 - Durée de Vie espérée_____________________")
    print("Sortie :", duree_de_vie)
    print('La durée de vie réelle restante est :', (tmax - t_TC0) / 24, 'jours')

    #plt.subplot(1, 2, 1)
    estimation2(t0, t, dt, uwind, vwind, study_grid)

    print('___________________SF4 - Trajectoire Tendance____________________')
    #plt.subplot(1, 2, 2)
    SF4_tendance = regression_trajectoire_TC(t0, want_to_plot=False)
    SF4_angle_TC = SF4_angle(t0, -12)  # Calcul l'angle entre un point à t0 et à t=t0-12
    print('Angle_TC : ', np.rint(SF4_angle_TC), "Angle_Tendance :", np.rint(SF4_tendance))
    print('_______________________SORTIE SF4 - Prediction _________________________')
    SF4_angle = SF4_conclusion(SF4_angle_TC, SF4_tendance, t0)[1]
    print('Sortie : SF4', SF4_angle)

plt.show()
Editor is loading...