Commit f0b3a85b authored by Beatriz Recinos's avatar Beatriz Recinos
Browse files

update config.ini

parent 5240855c
......@@ -15,4 +15,7 @@ satellite_sst_buoy_1x1 = '/gws/nopw/j04/orchestra_vol2/ESAcci_sst_v2.1_coarse/v2
satellite_sst_buoy_2x2 = '/gws/nopw/j04/orchestra_vol2/ESAcci_sst_v2.1_coarse/v2.1_atbuoy_2x2/'
time_series = '/gws/nopw/j04/orchestra_vol2/ESAcci_sst_v2.1_coarse/time_series_ESAcci_sst/'
\ No newline at end of file
# Local paths for local scripts
time_series = '/Users/brivas/ORCHESTRA_sst/input_data/time_series_ESAcci_sst/'
combined_data = '/Users/brivas/ORCHESTRA_sst/input_data/netcdf_ESAcci_sst_resampled'
\ No newline at end of file
......@@ -4,6 +4,7 @@ import numpy as np
np.seterr(divide='ignore', invalid='ignore')
import xarray as xr
from scipy.stats import binned_statistic_2d
from scipy.signal import find_peaks
from datetime import datetime
from collections import defaultdict
......@@ -466,8 +467,29 @@ def calculate_time_moving_weighted_average(var_to_avg, weights, time_stamp, var_
return weighted_avg
def find_local_minima_maxima(signal, height, time):
"""
Calculates local minima and maxima based in scipy.signal.find.peaks()
For more information
see: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html
Parameters
----------
signal: time series values
prominence: required prominence of peaks.
height: height of the peak. 0 from baseline
time: dates array to identify the time for a minima
Returns
-------
dates_with_maxima, dates_with_minima
"""
maxima = find_peaks(signal, height=height)
minima = find_peaks(-signal, height=height)
dates_p = time.iloc[maxima[0]].values
dates_n = time.iloc[minima[0]].values
return dates_p, dates_n
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment