YAC 3.21.0
Yet Another Coupler
Loading...
Searching...
No Matches
yac_plot_weights Namespace Reference

Plot interpolation weights from YAC weight files on a map. More...

Functions

 load_weight_file (weightfile)
 Load and validate YAC weight file.
 
 filter_weights_by_index (src_idx, tgt_idx, src_address, tgt_address, weights, src_ids, tgt_ids, src_points, tgt_points)
 Filter interpolation weights to focus on a specific source or target index.
 
 plot_grid (ax, corner_coords, coords, ids, core_mask, color, label_key)
 Plot a grid on the given axis with specified coordinates, IDs, and styling.
 

Variables

 parser
 
 action
 
 default
 
 help
 
 type
 
 nargs
 
 metavar
 
 choices
 
 idx_group = parser.add_mutually_exclusive_group()
 
 args = parser.parse_args()
 
list log_level = [logging.WARNING, logging.INFO, logging.DEBUG][min(args.verbose, 2)]
 
 level
 
 format
 
 src_corners
 
 src_points
 
 src_ids
 
 src_core_mask
 
 tgt_corners
 
 tgt_points
 
 tgt_ids
 
 tgt_core_mask
 
 focus_points = None
 
 src_address
 
 tgt_address
 
 weights
 
 fig
 
 ax
 
 projection
 
 center
 
 radius
 
 coast_res
 

Detailed Description

Plot interpolation weights from YAC weight files on a map.

Function Documentation

◆ filter_weights_by_index()

yac_plot_weights.filter_weights_by_index ( src_idx,
tgt_idx,
src_address,
tgt_address,
weights,
src_ids,
tgt_ids,
src_points,
tgt_points )

Filter interpolation weights to focus on a specific source or target index.

Args: src_idx: Global ID of the source cell/vertex to filter by (or None). This is the value shown as a label when pressing 's', i.e. the .gid/.vid value from the grid file. tgt_idx: Global ID of the target cell/vertex to filter by (or None). See src_idx. src_address: Array of source addresses from the weight file. Each value is global_id + 1 (1-indexed global IDs, not array positions). tgt_address: Array of target addresses from the weight file. Each value is global_id + 1 (1-indexed global IDs, not array positions). weights: Weight values src_ids: Global IDs of source grid points (.gid or .vid from grid file) tgt_ids: Global IDs of target grid points (.gid or .vid from grid file) src_points: Source coordinates, shape (2, n) tgt_points: Target coordinates, shape (2, n)

Returns: Tuple of (filtered_src_address, filtered_tgt_address, filtered_weights, focus_points)

Definition at line 101 of file yac_plot_weights.py.

◆ load_weight_file()

yac_plot_weights.load_weight_file ( weightfile)

Load and validate YAC weight file.

Args: weightfile: Path to weight file

Returns: Tuple of (src_grid_name, tgt_grid_name, src_loc, tgt_loc, src_address, tgt_address, weights, fixed_values) where fixed_values is a list of (value, dst_address_array) tuples, one entry per distinct fixed value (empty list when none are present).

Definition at line 33 of file yac_plot_weights.py.

◆ plot_grid()

yac_plot_weights.plot_grid ( ax,
corner_coords,
coords,
ids,
core_mask,
color,
label_key )

Plot a grid on the given axis with specified coordinates, IDs, and styling.

Core cells are plotted with full opacity; halo cells (core_mask==False) are plotted with a dimmed, dashed style to distinguish them visually.

Args: ax: Matplotlib axis to plot on corner_coords: Corner coordinates of the grid coords: Coordinates of grid points ids: IDs of grid points core_mask: Boolean array, True for core (owned) cells, False for halo color: Color for core cells label_key: Key for labeling

Definition at line 189 of file yac_plot_weights.py.

Variable Documentation

◆ action

yac_plot_weights.action

Definition at line 239 of file yac_plot_weights.py.

◆ args

yac_plot_weights.args = parser.parse_args()

Definition at line 306 of file yac_plot_weights.py.

◆ ax

yac_plot_weights.ax

Definition at line 360 of file yac_plot_weights.py.

◆ center

yac_plot_weights.center

Definition at line 362 of file yac_plot_weights.py.

◆ choices

yac_plot_weights.choices

Definition at line 264 of file yac_plot_weights.py.

◆ coast_res

yac_plot_weights.coast_res

Definition at line 365 of file yac_plot_weights.py.

◆ default

yac_plot_weights.default

Definition at line 240 of file yac_plot_weights.py.

◆ fig

yac_plot_weights.fig

Definition at line 360 of file yac_plot_weights.py.

◆ focus_points

yac_plot_weights.focus_points = None

Definition at line 344 of file yac_plot_weights.py.

◆ format

yac_plot_weights.format

Definition at line 309 of file yac_plot_weights.py.

◆ help

yac_plot_weights.help

Definition at line 241 of file yac_plot_weights.py.

◆ idx_group

yac_plot_weights.idx_group = parser.add_mutually_exclusive_group()

Definition at line 275 of file yac_plot_weights.py.

◆ level

yac_plot_weights.level

Definition at line 309 of file yac_plot_weights.py.

◆ log_level

yac_plot_weights.log_level = [logging.WARNING, logging.INFO, logging.DEBUG][min(args.verbose, 2)]

Definition at line 308 of file yac_plot_weights.py.

◆ metavar

yac_plot_weights.metavar

Definition at line 250 of file yac_plot_weights.py.

◆ nargs

yac_plot_weights.nargs

Definition at line 247 of file yac_plot_weights.py.

◆ parser

yac_plot_weights.parser
Initial value:
1= argparse.ArgumentParser(
2 description="Plot YAC interpolation weights on a map"
3 )

Definition at line 233 of file yac_plot_weights.py.

◆ projection

yac_plot_weights.projection

Definition at line 361 of file yac_plot_weights.py.

◆ radius

yac_plot_weights.radius

Definition at line 364 of file yac_plot_weights.py.

◆ src_address

yac_plot_weights.src_address

Definition at line 347 of file yac_plot_weights.py.

◆ src_core_mask

yac_plot_weights.src_core_mask

Definition at line 331 of file yac_plot_weights.py.

◆ src_corners

yac_plot_weights.src_corners

Definition at line 331 of file yac_plot_weights.py.

◆ src_ids

yac_plot_weights.src_ids

Definition at line 331 of file yac_plot_weights.py.

◆ src_points

yac_plot_weights.src_points

Definition at line 331 of file yac_plot_weights.py.

◆ tgt_address

yac_plot_weights.tgt_address

Definition at line 347 of file yac_plot_weights.py.

◆ tgt_core_mask

yac_plot_weights.tgt_core_mask

Definition at line 338 of file yac_plot_weights.py.

◆ tgt_corners

yac_plot_weights.tgt_corners

Definition at line 338 of file yac_plot_weights.py.

◆ tgt_ids

yac_plot_weights.tgt_ids

Definition at line 338 of file yac_plot_weights.py.

◆ tgt_points

yac_plot_weights.tgt_points

Definition at line 338 of file yac_plot_weights.py.

◆ type

yac_plot_weights.type

Definition at line 246 of file yac_plot_weights.py.

◆ weights

yac_plot_weights.weights

Definition at line 347 of file yac_plot_weights.py.