bdschism package
Subpackages
Submodules
bdschism.analyze_dt module
- bdschism.analyze_dt.load_data(ncfile, time_step=None)[source]
Load time step and mesh data from a SCHISM NetCDF file.
- Parameters:
ncfile (str) – Path to the NetCDF file.
time_step (int or None) – Specific time index to select. If None, load all.
- Returns:
Time step values, x-coordinates, y-coordinates.
- Return type:
tuple of (np.ndarray, np.ndarray, np.ndarray)
bdschism.barrier_status module
bdschism.calc_ndoi module
bdschism.ccf_gate_height module
bdschism.combine_hotstart module
bdschism.combine_nc module
- bdschism.combine_nc.combine_nc(input_files, outfile)[source]
Combines multiple NetCDF files (e.g., out2d_1.nc, out2d_2.nc, etc.) into a single NetCDF file along the time dimension.
- bdschism.combine_nc.combine_uv3d(start_num, end_num, outfile, tmp_out_dir='./outputs.tropic/uv3d')[source]
- bdschism.combine_nc.compare_dataarray_all_axes(validate_da, check_da, atol=1e-06, rtol=1e-06)[source]
Check two DataArrays match on dims, coords, shape, and values.
bdschism.config_cli module
bdschism.create_sflux_links module
bdschism.diff_gr3 module
bdschism.gen_elev2d module
bdschism.generate_realtime_elev2d module
bdschism.generate_visit_filelist module
- bdschism.generate_visit_filelist.visit_list(output_dir, var, start, end, filename)[source]
Generate a file containing a list of SCHISM output files to be visualized on VisIt.
- Parameters:
output_dir (str) – Outputs directory containing SCHISM output files.
var (str) – variable name for SCHISM output files (e.g., horizontalVelX).
start (int) – Starting index for the file list.
end (int) – Ending index for the file list.
filename (str) – Filename for the list of SCHISM output files.
bdschism.hotstart_date module
bdschism.hotstart_from_hotstart module
bdschism.hotstart_nudging_data module
bdschism.nc_metadata module
bdschism.parse_cu module
bdschism.plot_input_boundaries module
bdschism.port_boundary module
bdschism.profile_plot module
bdschism.read_dss module
bdschism.run_sequence module
bdschism.runtime_hotstart module
bdschism.set_mode module
bdschism.set_nudging module
bdschism.settings module
- bdschism.settings.create_link(source, symlink, config_log=False)[source]
Create a link between a source file and a target path based on system-specific link styles.
This function creates a symbolic link, junction, or copies the file, depending on the system settings. The link style is determined dynamically from get_settings(), which specifies the preferred linking method for the operating system.
- Parameters:
source (str) – The path to the source file that will be linked.
symlink (str) – The target path where the link (or copy) will be created.
config_log (bool, optional) – If True, log the configuration source being used.
- Raises:
ValueError – If the link style retrieved from get_settings() is unsupported.
Notes
If a symbolic link already exists at symlink, it is removed before creating a new one.
On Windows, the function supports creating junction links (mklink), symbolic links, or copying the file instead.
On Unix-based systems, it defaults to using symbolic links.
Examples
Create a symbolic link on Unix-like systems or an appropriate alternative on Windows:
>>> create_link("/path/to/source.txt", "/path/to/symlink.txt")
- bdschism.settings.get_output_from_interpolate_variables(varname, config_log=False)[source]
Get the output filename for the interpolate_variables function.
- Parameters:
varname (str) – The variable name for which to retrieve the output filename (e.g., ‘uv3d’).
config_log (bool, optional) – If True, log the configuration source being used.
- Returns:
The output filename for the interpolate_variables utility.
- Return type:
str
- bdschism.settings.get_settings(config_log: bool = False)[source]
Load and return application settings from a configuration file.
This function retrieves configuration settings using a hierarchy of possible sources: 1. A package-level default configuration file (bds_config.yaml within the package). 2. A project-level configuration file (bds_config.yaml in the current working directory). 3. An environment-specific configuration file, if BDS_CONFIG is set and points to a valid file.
The function uses Dynaconf to load settings, ensuring that the highest-priority configuration (environment variable, project-level, or package default) is used.
- Returns:
A Dynaconf object containing the loaded configuration settings.
- Return type:
Dynaconf
Notes
The package-level configuration file provides default settings.
If a project-level configuration file exists in the current directory, it overrides the package default.
If an environment variable BDS_CONFIG is set and points to a valid file, it takes the highest precedence.
The function logs the configuration source being used.
Examples
Load settings from the highest-priority available configuration file:
>>> settings = get_settings() Using configuration from: /path/to/highest-priority-config.yaml current env development
Access settings:
>>> settings.some_setting 'some_value'
- bdschism.settings.interpolate_variables(config_log=False)[source]
interpolate SCHISM variables from background grid to foreground grid for elevation, tracers, or uv3D
- Parameters:
config_log (bool, optional) – If True, log the configuration source being used.
- Raises:
ValueError – If the link style retrieved from get_settings() is unsupported.
Notes
interpolate_variables8 is the version of interpolate_variables associated with SCHISM 5.11
Examples
Interpolate SCHISM variables on Unix-like systems or an appropriate alternative on Windows:
>>> interpolate_variables()
bdschism.smscg_log_2_schism_th module
bdschism.synthetic_copy module
bdschism.synthetic_sflux module
bdschism.three_point_linear_norm module
bdschism.tide module
- bdschism.tide.gen_constituents_tree()[source]
This function generates the constituent trees of Choice of constituents and Rayleigh comparison pairs It returns a list of root nodes for subtide, diurnal, semidiurnal and terdiurnal, and a list of shallow water constituents that have multiple parents. It is implementation from Table 1 to Table 5 in “MANUAL FOR TIDAL HEIGHTS ANALYSIS AND PREDICTION” by M.G.G. Foreman (1996).
- bdschism.tide.get_astro_constituent_names(astro_group, record_length_hours=0)[source]
Recursivly Retrieves the names of all constituents in the astro_group that can be analyazed by the specified record_length_hours.
Args: astro_group: list of root nodes for the main constituent groups (slow, diurnal, semidiurnal, terdiurnal). record_length_hours: the length of the record in hours, used to determine which constituents can be analyzed.
Returns: A sorted list of constituent names that can be analyzed with the given record length.
- bdschism.tide.get_constituents(record_length_hours=0)[source]
Retrieves the names of all constituents in the astro_group and shallow_group that can be analyazed by the specified record_length_hours.
- Parameters:
astro_group – list of root nodes for the main constituent groups (slow, diurnal, semidiurnal, terdiurnal).
shallow_group – list of nodes for shallow water constituents that have multiple parents.
record_length_hours – the length of the record in hours, used to determine which constituents can be analyzed.
Returns: A sorted list of constituent names that can be analyzed with the given record length.
bdschism.uv3d module
bdschism.x2_buildpoints module
bdschism.x2_time_series module
bdschism.zone_utils module
Created on Fri May 5 09:45:12 2023
@author: qshu