Newer
Older
Christoph Fischer
committed
#!/usr/bin/env python
from os.path import expanduser, join
from datetime import timedelta
Christoph Fischer
committed
# data area
# latN = 35
# latS = -35
# lonW = -100
# lonE = 45
Christoph Fischer
committed
data_lat = (-35, 35)
data_lon = (-100, 45)
aew_clim_dir = join(expanduser("~") + '/phd/data/aew/clim/')
cv_data_dir = join(expanduser("~") + '/phd/data/aew/cv/') # reference where ALL cv data is (for clim calc.)
# construct clim file, regenerate for each window?
Christoph Fischer
committed
def get_clim_file():
fn = (aew_clim_dir + "cv_clim_" + str(abs(data_lat[1])) + ('N' if data_lat[1] > 0 else 'S') + "_"
+ str(abs(data_lat[0])) + ('N' if data_lat[0] > 0 else 'S') + "_"
+ str(abs(data_lon[0])) + ('E' if data_lon[0] > 0 else 'W') + "_"
+ str(abs(data_lon[1])) + ('E' if data_lon[1] > 0 else 'W')) + ".nc"
return fn
# wave area to be extracted: at least one point of trough needs to be in this range
wave_filter_lat = (0, 30)
Christoph Fischer
committed
wave_filter_lon = (-110, 55)
Christoph Fischer
committed
# time of interest, if None all
start_date = None # '2008-08-01T00:00' # # '2008-08-01T00:00'
end_date = None # '2008-08-02T00:00' # None # '2008-08-03T00:00'
Christoph Fischer
committed
# Algorithm parameters
# max u wind (m/s) (0 = only keep west-propagating). Belanger: 2.5; Berry: 0.0
max_u_thresh = 0.0 # m/s
# CV anomaly percentile
# NOTE: this is precomputed from the climatology, so delete climatology file and change this after to be re-executed.
cv_percentile = 66 # 66% percentile of PV anomalies as reference on what areas to consider
# need positive 2nd time derivative
second_advection_min_thr = 0.0
### FILTERING
# spatial filtering: if wave to small, discard
# threshold in degrees of wave length (sum of wave segments)
degree_len_thr = 5
Christoph Fischer
committed
### TRACKING
duration_threshold = timedelta(days=2)
Christoph Fischer
committed
# speed range of AEWs
# at 10°N we have in longitude direction 0.00914 degrees/km (360/(40,000*cos(10deg)))
speed_range_m_per_s = [0.0, 15.0] # [5,10], but be more gentle with polygons.
Christoph Fischer
committed
speed_deg_per_h = [-m_per_s * 3.6 * 0.00914 for m_per_s in speed_range_m_per_s] # negative -> westward [-5, -10]