bluemath_tk.teslakit.numerical_models.swan package
Subpackages
Submodules
bluemath_tk.teslakit.numerical_models.swan.geo module
- bluemath_tk.teslakit.numerical_models.swan.geo.gc_distance(lat1, lon1, lat2, lon2)[source]
Calculate great circle distance and azimuth (exact. parsed ml)
- bluemath_tk.teslakit.numerical_models.swan.geo.shoot(lon, lat, azimuth, maxdist=None)[source]
Shooter Function Original javascript on http://williams.best.vwh.net/gccalc.htm Translated to python by Thomas Lecocq
bluemath_tk.teslakit.numerical_models.swan.io module
- class bluemath_tk.teslakit.numerical_models.swan.io.SwanIO(swan_proj)[source]
Bases:
objectSWAN numerical model input/output
- class bluemath_tk.teslakit.numerical_models.swan.io.SwanIO_NONSTAT(swan_proj)[source]
Bases:
SwanIOSWAN numerical model input/output - NON STATIONARY cases
- build_case(case_id, waves_event, storm_track=None, make_waves=True, make_winds=True, waves_bnd=['N', 'E', 'W', 'S'])[source]
Build SWAN NONSTAT case input files for given wave dataset
case_id - SWAN case index (int)
waves_event - waves event time series (pandas.Dataframe) also contains level, tide and wind (not storm track) variables [n x 8] (hs, per, dir, spr, U10, V10, level, tide)
storm_track - None / storm track time series (pandas.Dataframe) storm_track generated winds have priority over waves_event winds [n x 6] (move, vf, lon, lat, pn, p0)
- get_t0_dt(p_input)[source]
gets output points time_ini and delta_time (min) from SWAN input.swn file
- make_input(p_file, id_run, time, make_waves=True, make_winds=True, wvs_bnd=['N', 'E', 'W', 'S'])[source]
Writes input.swn file from waves event for non-stationary execution
p_file - input.swn file path time - event time at swan iso format
make_waves - activates waves input files generation (at waves_bnd) make_winds - activates wind input files generation
more info: http://swanmodel.sourceforge.net/online_doc/swanuse/node23.html
- make_vortex_files(p_case, storm_track)[source]
Generate event wind mesh files (swan compatible)
uses wave_event storm path data over SWAN computational grid needs SPHERICAL COORDINATES
- make_wave_files(p_case, waves_event, time, bnd)[source]
Generate event wave files (swan compatible)
- make_wind_files(p_case, waves_event)[source]
Generate event wind mesh files (swan compatible)
uses wave_event U10 and V10 values at the entire SWAN comp. grid
- class bluemath_tk.teslakit.numerical_models.swan.io.SwanIO_STAT(swan_proj)[source]
Bases:
SwanIOSWAN numerical model input/output - STATIONARY cases
- build_case(case_id, waves_ss, bnd=['N', 'E', 'W', 'S'])[source]
Build SWAN STAT case input files for given wave sea state (hs, per, dir, spr)
ix_case - SWAN case index (int) waves_ss - wave sea state (hs, per, dir, spr) bnd - wave sea state active boundaries
- make_input(p_file, id_run, ws, bnd)[source]
Writes input.swn file from waves sea state for stationary execution
p_file - input.swn file path ws - wave sea state (hs, per, dr, spr) bnd - wave sea state active boundaries
more info: http://swanmodel.sourceforge.net/online_doc/swanuse/node23.html
bluemath_tk.teslakit.numerical_models.swan.storms module
- bluemath_tk.teslakit.numerical_models.swan.storms.track_from_parameters(pmin, vmean, delta, gamma, x0, y0, x1, R, date_ini, hours, great_circle=False)[source]
Calculates storm track variables from storm track parameters
pmin, vmean, delta, gamma - storm track parameters x0, y0 - site coordinates (longitude, latitude) x1 - enter point in computational grid R - radius (º) date_ini - initial date ‘yyyy-mm-dd HH:SS’ hours - number of hours to generate great_circle - True for using great circle lon,lat calculation
bluemath_tk.teslakit.numerical_models.swan.temp_plots module
- bluemath_tk.teslakit.numerical_models.swan.temp_plots.aux_quiver(X, Y, var, vdir)[source]
interpolates var and plots quiver with var_dir. Requires open figure
var - variable module vdir - variable direction (º clockwise relative to North)
- bluemath_tk.teslakit.numerical_models.swan.temp_plots.plot_output_nonstat(xds_out, var_name, p_export, quiver=False, np_shore=array([], dtype=float64))[source]
Plots non-stationary SWAN execution output for selected var, for every case
xds_out - swan output (xarray.Dataset) var_name - ‘Hsig’, ‘Tm02’, ‘Tpsmoo’ p_export - path for exporting figures
opt. args quiver - True for adding directional quiver plot np_shore - shoreline, np.array x = np_shore[:,0] y = np.shore[:,1]
- bluemath_tk.teslakit.numerical_models.swan.temp_plots.plot_output_points(xds_out, p_export)[source]
Plots SWAN execution output table points time series
xds_out - swan points output (xarray.Dataset) p_export - path for exporting figures
- bluemath_tk.teslakit.numerical_models.swan.temp_plots.plot_points_times(xds_out_case, p_export_case)[source]
Plots non-stationary SWAN points output for selected case
xds_out_case - swan case output (xarray.Dataset) p_export_case - path for exporting figures
- bluemath_tk.teslakit.numerical_models.swan.temp_plots.plot_storm_track(lon0, lon1, lat0, lat1, pd_storm, p_export, np_shore=array([], dtype=float64))[source]
Plots SWAN execution output table points time series
lon0, lon1 - longitude axes limits (lon0, lon1) lat0, lat1 - latitude axes limits (lat0, lat1) pd_storm - storm track pandas.DataFrame (x0, y0, R as metadata) p_export - path for exporting figure
opt. args np_shore - shoreline, np.array x = np_shore[:,0] y = np.shore[:,1]
- bluemath_tk.teslakit.numerical_models.swan.temp_plots.plot_var_times(xds_out_case, var_name, p_export_case, quiver=False, np_shore=array([], dtype=float64), cmap='jet')[source]
Plots non-stationary SWAN execution output for selected var and case
xds_out_case - swan output (xarray.Dataset) var_name - ‘Hsig’, ‘Tm02’, ‘Tpsmoo’ p_export - path for exporting figures
opt. args quiver - True for adding directional quiver plot np_shore - shoreline, np.array x = np_shore[:,0] y = np.shore[:,1] cmap - matplotlib colormap
bluemath_tk.teslakit.numerical_models.swan.wrap module
- class bluemath_tk.teslakit.numerical_models.swan.wrap.SwanMesh[source]
Bases:
objectSWAN numerical model mesh
- class bluemath_tk.teslakit.numerical_models.swan.wrap.SwanProject(p_proj, n_proj)[source]
Bases:
objectSWAN numerical model project parameters, grids and information
- class bluemath_tk.teslakit.numerical_models.swan.wrap.SwanWrap(swan_proj, swan_io)[source]
Bases:
objectSWAN numerical model wrap for multi-case handling
- extract_output(mesh=None)[source]
exctract output from all cases
return xarray.Dataset (uses new dim “case” to join output)
- class bluemath_tk.teslakit.numerical_models.swan.wrap.SwanWrap_NONSTAT(swan_proj)[source]
Bases:
SwanWrapSWAN numerical model wrap for NON STATIONARY multi-case handling
- build_cases(waves_event_list, storm_track_list=None, make_waves=True, make_winds=True)[source]
generates all files needed for swan non-stationary multi-case execution
waves_event_list - list waves events time series (pandas.DataFrame) also contains level, tide and wind (not storm track) variables [n x 8] (hs, per, dir, spr, U10, V10, level, tide)
storm_track_list - list of storm tracks time series (pandas.DataFrame) storm_track generated winds have priority over waves_event winds [n x 6] (move, vf, lon, lat, pn, p0)
Module contents
Module attrs