def TPI_masks(domain, region_nr): file = example_file(domain) TLAT = xr.open_dataset(file, decode_times=False).TLAT TLONG = xr.open_dataset(file, decode_times=False).TLONG MASK = boolean_mask(domain, mask_nr=0) if region_nr == 1: # (25N-45N, 140E-145W) MASK = np.where(TLAT > 25, MASK, 0) MASK = np.where(TLAT < 45, MASK, 0) MASK = np.where(TLONG > 140, MASK, 0) MASK = np.where(TLONG > 215, MASK, 0) elif region_nr == 2: # (10S-10N, 170E-90W) MASK = np.where(TLAT > -10, MASK, 0) MASK = np.where(TLAT < 10, MASK, 0) MASK = np.where(TLONG > 170, MASK, 0) MASK = np.where(TLONG > 270, MASK, 0) elif region_nr == 3: # (50S-15S, 150E-160W) MASK = np.where(TLAT > -50, MASK, 0) MASK = np.where(TLAT < -15, MASK, 0) MASK = np.where(TLONG > 150, MASK, 0) MASK = np.where(TLONG > 200, MASK, 0) return MASK
def TexT_mask(domain): file = example_file(domain) TLAT = xr.open_dataset(file, decode_times=False).TLAT MASK = boolean_mask(domain, mask_nr=0) MASK = np.where(TLAT > -60, MASK, 0) MASK = np.where(TLAT < 60, MASK, 0) return MASK
def Atlantic_mask(domain): assert domain in ['ocn', 'ocn_low'] ds = xr.open_dataset(example_file(domain), decode_times=False) ATLANTIC_MASK = combine_mask(ds.REGION_MASK, [6, 8, 9]) return ATLANTIC_MASK
def AMO_mask(domain): file = example_file(domain) TLAT = xr.open_dataset(file, decode_times=False).TLAT if domain == 'ocn_low': MASK = boolean_mask(domain, mask_nr=6) elif domain == 'ocn': MASK = Atlantic_mask(domain) MASK = np.where(TLAT > 0, MASK, 0) MASK = np.where(TLAT < 60, MASK, 0) return MASK
# high res ocean regions import numpy as np import xarray as xr from xr_DataArrays import example_file, depth_lat_lon_names from paths import path_samoc from paths import file_ex_ocn_rect, file_RMASK_ocn, file_RMASK_ocn_rect, file_RMASK_ocn_low ocn_file = example_file('ocn') bll_AMO = ((0, 60), (-80, 0)) # (0-60N, 0-80W) bll_N34 = ((-5, 5), (-170, -120)) # (5N-5S, 170W-120W) bll_SOM = ((-50, -35), (-50, 0) ) # (50S-35S, 50W-0W) `SOM` region in Le Bars et al. (2016) bll_SMV = ((-80, -50), (-30, 80) ) # (80S-50S, 30W-80E) `WGKP` region in Jüling et al. (2018) bll_TPI1 = ((25, 40), (140, -145)) # (25N-45N, 140E-145W) bll_TPI2 = ((-10, 10), (170, -90)) # (10S-10N, 170E-90W) bll_TPI3 = ((-50, -15), (150, -160)) # (50S-15S, 150E-160W) # 'ocn' # AMO_area = {'nlat':slice(1081,1858), 'nlon':slice( 500,1100)} # North Atlantic (0-60N, 0-80W) Drake_Passage = {'nlat': slice(268, 513), 'nlon': 410} DP_North = {'nlat': 512, 'nlon': 410} global_ocean = {'nlat': slice(0, 2400), 'nlon': slice(0, 3600)} # global ocean Nino12 = { 'nlat': slice(1081, 1181), 'nlon': slice(200, 300) } # Niño 1+2 (0-10S, 90W-80W) Nino34 = {