##################################
###### OPB201_TD_profiles.py
######APetrenko  Jan. - Feb 2023
###### to prepare PHYBIO
##################################
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 17 08:09:28 2023
"""
import matplotlib.pyplot as plt 
import numpy as np

f=open('dPHYBIO_2022_ST_K_CTD_12.cnv','rb')

data=np.genfromtxt(f,skip_header=260)
# Attention le skip_header = 260 car c'est un fichier cnv
# sinon skip_header = 1 si cela avait été un fichier asc
# f.close()

temp=data[1:,16]
depth=data[1:,12]
salinity=data[1:,13]
sigma=data[1:,14]
PAR=data[1:,11]
fluorescence=data[1:,9]
transmission=data[1:,10]

fig1=plt.figure()
plt.subplot(1,3,1)
plt.plot(temp,-depth,'k')
plt.xlabel('Temperature(°C)')
plt.ylabel('Depth(m)')

plt.subplot(1,3,2)
plt.title("PHYBIO_2022_ST_K_CTD_12")
ax=plt.gca()
ax.get_yaxis().set_visible(False)
plt.plot(salinity,-depth,'k')
plt.xlabel('Salinity(PSU)')


plt.subplot(1,3,3)
ax=plt.gca()
ax.get_yaxis().set_visible(False)
plt.plot(sigma,-depth,'k')
plt.xlabel('       Excès de masse volumique (m³.kg⁻¹)')

plt.show()

fig2=plt.figure()

plt.subplot(1,3,1)
plt.plot(PAR,-depth,'k')
plt.xlabel('PAR')
plt.ylabel('Depth(m)')

plt.subplot(1,3,2)
plt.title("PHYBIO_2022_ST_K_CTD_12")
ax=plt.gca()
ax.get_yaxis().set_visible(False)
plt.plot(fluorescence,-depth,'k')
plt.xlabel('Fluorescence (µg.L⁻¹)')

plt.subplot(1,3,3)
ax=plt.gca()
ax.get_yaxis().set_visible(False)
plt.plot(transmission,-depth,'k')
plt.xlabel('Transmission (%)')

plt.show()
