Make time of emergence PDF bar plots from historical vs. historicalNat
Choose which variable and domain to work on
Method1: read lat/rho ToE and average in the chosen domain
Method2: read ToE computed from the already averaged signal and noise in the chosen domain
"""

import numpy as np
import matplotlib.pyplot as plt
from netCDF4 import Dataset as open_ncfile
from maps_matplot_lib import defVarmme, averageDom
from modelsDef import defModels
from libToE import findToE, ToEdomainhistvshistNat

# ----- Work ------

models = defModels()

varname = defVarmme('salinity'); v = 'S'
#varname = defVarmme('temp'); v = 'T'
#varname = defVarmme('depth'); v = 'Z'

# -- Choose method for computing ToE
#method = 'average_ToE' # Determine 2D lat/rho ToE then average in the box
method = 'average_signal' # Average signal and noise in the box, then compute ToE
# Method 2 only has ToE for salinity for now

# -- Choose which 'noise' to use for the ToE calculation (only with method 2 : average_signal)
# method_noise = 'average_std' # Average the standard deviation of PiC in the specified domains
method_noise = 'average_histNat' # Average histNat in the specified domains then determine the std of this averaged value

Example #2
0
import matplotlib.pyplot as plt
from maps_matplot_lib import defVarmme, averageDom
from modelsDef import defModels
from libToE import ToEdomainhistvshistNat
from matplotlib.ticker import AutoMinorLocator, MultipleLocator
import glob


# ----- Workspace ------

indir_histrcp85 = '/home/ysilvy/Density_bining/Yona_analysis/data/hist_rcp85/'
indir_histNat = '/data/ericglod/Density_binning/Prod_density_april15/mme_histNat/'
indir_piC = '/data/ericglod/Density_binning/Prod_density_april15/mme_piControl/'
indir_noise = '/home/ysilvy/Density_bining/Yona_analysis/data/noise_estimate/'

models = defModels()

# ----- Work ------

varname = defVarmme('salinity'); v = 'S'

method = 'average_signal' # Average signal and noise in the box, then compute ToE

# -- Choose which 'noise' to use
# method_noise = 'average_std' # Average the standard deviation of histNat or PiC in the specified domains
method_noise = 'average_histNat' # Average histNat or PiC in the specified domains then determine the std
# of this averaged value

domains = ['Southern ST', 'SO', 'Northern ST', 'North Atlantic', 'North Pacific']
domain_name = 'Southern ST'
idomain = 0