# DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.plotting.awt import Plot_AWT_Validation, Plot_AWTs, \ Plot_AWTs_Dates, Plot_AWT_PCs_3D, Plot_AWT_PCs, Plot_EOFs_SST # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # Load SST AWT KMA and PCA xds_PCA = db.Load_SST_PCA() xds_KMA = db.Load_SST_KMA() # Plot 6 EOFs Plot_EOFs_SST(xds_PCA, 6) # Plot 6 PCs 2D Plot_AWT_PCs(xds_PCA, xds_KMA, n=6) # load PCs simulated with copula
# DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.estela import Predictor from teslakit.util.time_operations import xds_common_dates_daily as xcd_daily from teslakit.plotting.waves import Plot_Waves_DWTs # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # load waves families (full data) xds_wvs_fams = db.Load_WAVES_fams() # load predictor pred = Predictor(db.paths.site.ESTELA.pred_slp) pred.Load() # DWTs bmus xds_DWTs = pred.KMA xds_BMUS = xr.Dataset( {'bmus': (('time', ), xds_DWTs['sorted_bmus_storms'].values[:])},
import numpy as np import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.storms import Extract_Circle # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # wave point longitude and latitude pnt_lon = 167.5 pnt_lat = 9.75 # radius for TCs selection (º) r1 = 14 r2 = 4 # MDA number of cases num_sel_mda = 1000
sys.path.insert(0, op.join(os.path.abspath(''), '..', '..')) # teslakit from teslakit.database import Database from teslakit.io.matlab import ReadMatfile from teslakit.rbf import RBF_Interpolation from teslakit.util.time_operations import DateConverter_Mat2Py ## Database and Site parameters # %% # -------------------------------------- # Teslakit database p_data = r'/Users/anacrueda/Documents/Proyectos/TESLA/Teslakit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # %% # -------------------------------------- # load data and set parameters # wave data reconstructed a 30m water depth p_hist = r'/Users/anacrueda/Documents/Proyectos/SERDP/results_files/Historicos/' p_dataset = op.join( p_hist, 'Reconstr_Hs_Tp_Dir_Level_NOtransectRoi_Historical_2016_p6_in30m_snell_sep.mat' )
import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.plotting.wts import Plot_Probs_WT_WT # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') MJO_ncs = 8 DWT_ncs = 36 # MJO, DWTs historical data xds_MJO_hist, xds_DWT_hist = db.Load_MJO_DWTs_Plots_hist() MJO_phase = xds_MJO_hist.phase.values[:] DWT_bmus = xds_DWT_hist.bmus.values[:] Plot_Probs_WT_WT( MJO_phase, DWT_bmus, MJO_ncs, DWT_ncs, wt_colors=False, ttl='MJO Phases / DWT bmus (Historical)')
# DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.estela import Predictor from teslakit.plotting.estela import Plot_ESTELA # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # estela predictor xds_est = db.Load_ESTELA_data() # plot ESTELA (basemap) Plot_ESTELA( xds_est.pnt_longitude, xds_est.pnt_latitude, xds_est.F_y1993to2012 * xds_est.mask_e95, xds_est.D_y1993to2012 * xds_est.mask_e95, lon1=110, lon2=290,
import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.estela import Predictor # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('TESTNEW') # -------------------------------------- # load SLP ESTELA predictor and waves data pred = Predictor(db.paths.site.ESTELA.pred_slp) pred.Load() xds_WAVES = db.Load_ESTELA_waves() # KMA REGRESSION GUIDED parameters kma_date_ini = '1979-01-22' kma_date_end = '2011-01-22'
# common import os import os.path as op import sys # pip import numpy as np import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('ROI') # -------------------------------------- # load TCs mda simulations tcs_sims = db.Load_TCs_r2_mda_Simulations() print(tcs_sims)
import numpy as np import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.alr import ALR_WRP # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('ROI') # alr test p_alrw = db.paths.site.SST.alrw #p_alrw = db.paths.site.MJO.alrw #p_alrw = db.paths.site.ESTELA.alrw # ALR wrap ALRW = ALR_WRP(p_alrw) # show model report #ALRW.Report_Fit(terms_fit=True, summary=True)
# common import os import os.path as op import sys # pip import numpy as np import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.plotting.wts import Plot_Probs_WT_WT # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # load simulation data(hourly) data = db.Load_SIM_hourly() print(data)
import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.plotting.wts import Plot_Probs_WT_WT # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # Load AWTs (SST) and DWTs (ESTELA SLP) n_clusters_AWT = 6 n_clusters_DWT = 42 # Plot AWTs/DWTs Probs - historical AWT_hist, DWT_hist = db.Load_AWTs_DWTs_Plots_hist() AWT_bmus = AWT_hist.bmus.values[:] DWT_bmus = DWT_hist.bmus.values[:] print(np.unique(AWT_bmus))
# DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.plotting.storms import Plot_Params_Hist_vs_Sim_scatter, \ Plot_Params_Hist_vs_Sim_histogram, Plot_Params_MDA_vs_Sim_scatter # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # Load storms parameters real and syntethic _,xds_TCs_r2_params = db.Load_TCs_r2() xds_TCs_r2_sim_params = db.Load_TCs_r2_sim_params() xds_TCs_r2_MDA_params = db.Load_TCs_r2_mda_params() # Plot storms tracks and storm parametrized inside radius Plot_Params_Hist_vs_Sim_scatter(xds_TCs_r2_params, xds_TCs_r2_sim_params) # Plot storms tracks and storm parametrized inside radius
import numpy as np import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.storms import Extract_Circle # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # -------------------------------------- # load data and set parameters xds_wmo = db.Load_TCs_noaa() # noaa Allstorms.ibtracs_wmo # wave point longitude and latitude pnt_lon = 167.5 pnt_lat = 9.75 # radius for TCs selection (º) r1 = 14 r2 = 4
import numpy as np import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.statistical import CopulaSimulation # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # -------------------------------------- # load data and set parameters _, xds_TCs_r2_params = db.Load_TCs_r2() # TCs parameters inside radius 2 # TCs random generation and MDA parameters num_sim_rnd = 100000 num_sel_mda = 1000 # -------------------------------------- # Probabilistic simulation Historical TCs
import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.plotting.storms import Plot_TCs_TracksParams, \ Plot_Historical_TCs_Tracks, Plot_Historical_TCs_Tracks_Category # -------------------------------------- # Teslakit database p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('KWAJALEIN') # Load storms extracted at 4 degree radius xds_tracks_r1, xds_params_r1 = db.Load_TCs_r1() xds_tracks_r2, xds_params_r2 = db.Load_TCs_r2() # Plot storms tracks and storm parametrized inside radius Plot_TCs_TracksParams(xds_tracks_r2, xds_params_r2) # Plot storm tracks world map (requires basemap) lon1, lon2 = 90, 270 lat1, lat2 = -20, 70 pnt_lon, pnt_lat = 167.5, 9.75
import numpy as np import xarray as xr # DEV: override installed teslakit import sys sys.path.insert(0, op.join(op.dirname(__file__), '..', '..', '..')) # teslakit from teslakit.database import Database from teslakit.waves import GetDistribution # -------------------------------------- # Test data storage p_data = r'/Users/nico/Projects/TESLA-kit/TeslaKit/data' db = Database(p_data) # set site db.SetSite('ROI') # waves partitions data WVS_pts = db.Load_WAVES_partitions() print(WVS_pts) # wave families sectors fams_sectors = [(210, 22.5), (22.5, 135)] # calculate waves families WVS_fams = GetDistribution(WVS_pts, fams_sectors) print(WVS_fams)