mod_plot module
- mod_plot.compare_psd_score(study_filename, ref_filename)
Compare Power Spectral Density (PSD) scores between a study dataset and a reference dataset.
- Parameters:
study_filename (str) – The filename of the study dataset in NetCDF format.
ref_filename (str) – The filename of the reference dataset in NetCDF format.
- Returns:
panel – A panel containing two subplots comparing PSD scores.
- Return type:
hvplot.core.panel.Panel
Notes
This function compares PSD scores between a study dataset and a reference dataset for the effective resolution. It generates two subplots: one showing the effective resolution of the reference dataset and the other showing the percentage change in effective resolution between the study and reference datasets. The subplots use colormaps to represent the data, and coastlines and grid lines are added for context.
Examples
>>> study_file = "study_data.nc" >>> reference_file = "reference_data.nc" >>> compare_psd_score(study_file, reference_file)
- mod_plot.compare_psd_score_png(study_filename=None, ref_filename=None, output_dir='../results/', boxlon=[-180, 180], boxlat=[-90, 90], var_type='err_var')
Generate PNG plots comparing Power Spectral Density (PSD) scores for effective resolution between a study dataset and a reference dataset.
- Parameters:
study_filename (str) – The filename of the study dataset in NetCDF format.
ref_filename (str) – The filename of the reference dataset in NetCDF format.
- Return type:
None
Notes
This function generates two subplots comparing PSD scores for effective resolution between a study dataset and a reference dataset. The subplots display the effective resolution of the reference dataset and the percentage change in effective resolution between the study and reference datasets. Colormaps are used to represent the data, and coastlines, land features, and grid lines are added to enhance visualization.
Colorbars are added to indicate the color scale for each subplot. The resulting figure is saved as a PNG file.
Examples
>>> study_file = "study_data.nc" >>> reference_file = "reference_data.nc" >>> compare_psd_score_png(study_file, reference_file)
- mod_plot.compare_stat_score_map(study_filename, ref_filename)
Compare statistical score maps between a study dataset and a reference dataset and visualize the differences.
- Parameters:
study_filename (str) – The name of the study NetCDF file.
ref_filename (str) – The name of the reference NetCDF file.
- Returns:
A layout containing Holoviews plots displaying the comparison results.
- Return type:
holoviews.core.layout.Layout
Notes
This function reads data from both the study and reference NetCDF files and generates various comparison plots between the two datasets.
Comparison Plots: 1. Error Variance Maps (Reference and Study) for All Scales. 2. Error Variance Maps (Reference and Study) for 65-500km Scale. 3. Percentage Change in Error Variance (Study vs. Reference) for All Scales. 4. Percentage Change in Error Variance (Study vs. Reference) for 65-500km Scale. 5. Explained Variance Maps (Reference) for All Scales. 6. Explained Variance Maps (Reference) for 65-500km Scale. 7. Gain(+)/Loss(-) in Explained Variance (Study vs. Reference) for All Scales. 8. Gain(+)/Loss(-) in Explained Variance (Study vs. Reference) for 65-500km Scale.
The generated plots are returned as a Holoviews layout for visualization.
Examples
>>> study_file = "study_data.nc" >>> reference_file = "reference_data.nc" >>> comparison_plots = compare_stat_score_map(study_file, reference_file) >>> comparison_plots.show() # Display the comparison plots.
- mod_plot.compare_stat_score_map_png(study_filename=None, ref_filename=None, output_dir='../results/', boxlon=[-180, 180], boxlat=[-90, 90], var_type='err_var')
Generate PNG plots comparing statistical score maps between study and reference datasets.
- Parameters:
study_filename (str) – The filename of the study dataset in NetCDF format.
ref_filename (str) – The filename of the reference dataset in NetCDF format.
- Return type:
None
Notes
This function generates a set of eight subplots comparing statistical score maps between a study dataset and a reference dataset. The comparison includes error variance, percentage change in error variance, and explained variance for both global and 65-500km scales. These subplots are arranged in a 4x2 grid, providing a visual comparison of the datasets. Colormaps are used to represent the data, and coastlines and grid lines are added to enhance visualization.
Colorbars are added to indicate the color scale for each subplot. The function saves the resulting figure as a PNG file.
Examples
>>> study_file = "study_data.nc" >>> reference_file = "reference_data.nc" >>> compare_stat_score_map_png(study_file, reference_file)
- mod_plot.compare_stat_score_map_uv_png(study_filename, ref_filename)
Generate PNG plots comparing statistical score maps for zonal and meridional currents between study and reference datasets.
- Parameters:
study_filename (str) – The filename of the study dataset in NetCDF format.
ref_filename (str) – The filename of the reference dataset in NetCDF format.
- Return type:
None
Notes
This function generates a set of eight subplots comparing statistical score maps for zonal and meridional currents between a study dataset and a reference dataset. The comparison includes error variance, percentage change in error variance, and explained variance for both zonal and meridional currents at all scales. These subplots are arranged in a 4x2 grid, providing a visual comparison of the datasets. Colormaps are used to represent the data, and coastlines and grid lines are added to enhance visualization.
Colorbars are added to indicate the color scale for each subplot. The function saves the resulting figure as a PNG file.
Examples
>>> study_file = "study_data.nc" >>> reference_file = "reference_data.nc" >>> compare_stat_score_map_uv_png(study_file, reference_file)
- mod_plot.movie(ds, name_var, method='DUACS', region='Global', dir_output='../results/', dim_name=['time', 'latitude', 'longitude'], framerate=24, Display=True, clim=None, cmap='Spectral', newmovie=False)
- mod_plot.movie_intercomp(ds_maps_list, methods=['DUACS'], name_var='uv', dir_output='../results/', region='Agulhas', framerate=24, colsize=10, vmin=-0.8, vmax=0.8, cmap='RdBu_r')
- mod_plot.plot_average_psd(psd_output_filename=None, output_dir='../results/')
- mod_plot.plot_effective_resolution(filename)
Generate and display a quadmesh plot of effective resolution.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
- Returns:
Quadmesh plot of effective resolution.
- Return type:
holoviews quadmesh
- mod_plot.plot_effective_resolution_png(filename, region='glob', box_lonlat=None, change_lon=True, max_resol=500)
Generate and save a PNG image of effective resolution.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
region (str, optional) – Region name for the image, by default ‘glob’.
box_lonlat (dict, optional) – Dictionary containing ‘lon_min’, ‘lon_max’, ‘lat_min’, and ‘lat_max’ values, defining the bounding box for the image.
- Return type:
None
- mod_plot.plot_polarization(filename)
Generate and display polarization plots of rotary spectrum for current data.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
- Returns:
Layout containing quadmesh plots for polarization of the rotary spectrum.
- Return type:
holoviews layout
- mod_plot.plot_psd_scores(filename)
Generate and display plots related to Power Spectral Density (PSD) scores.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
- Returns:
Layout containing line plots for PSD scores and related metrics.
- Return type:
holoviews layout
- mod_plot.plot_psd_scores_currents(filename)
Generate and display plots related to Power Spectral Density (PSD) scores for current data.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
- Returns:
Layout containing quadmesh plots for various PSD-related metrics for current data.
- Return type:
holoviews layout
- mod_plot.plot_psd_scores_currents_1D(filename)
Generate and display 1D line plots of Power Spectral Density (PSD) scores for current data.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
- Returns:
Layout containing line plots for various PSD-related metrics for current data.
- Return type:
holoviews layout
- mod_plot.plot_psd_scores_currents_png(filename, region='glob')
Plot various spectral and coherence maps for zonal and meridional currents as PNG files.
- Parameters:
filename (str) – The name of the input NetCDF file.
region (str, optional) – The region to plot (‘glob’ for global, or specify a region name).
- Return type:
None
- mod_plot.plot_stat_by_regimes(stat_output_filename)
Generate and display statistical summary by geographical regions.
- Parameters:
stat_output_filename (str) – Path to the input NetCDF file containing statistical data.
- Returns:
DataFrame containing the statistical summary by regions and variables.
- Return type:
pandas DataFrame
- mod_plot.plot_stat_score_map(filename)
Generate and display error and explained variance maps.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
- Returns:
Layout containing quadmesh plots for error and explained variance maps.
- Return type:
holoviews layout
- mod_plot.plot_stat_score_map_png(filename, region='glob', box_lonlat=None, change_lon=True)
Plot statistical score maps for zonal and meridional currents and save them as PNG files.
- Parameters:
filename (str) – The name of the input NetCDF file.
region (str, optional) – The region to plot (‘glob’ for global, or specify a region name).
box_lonlat (dict, optional) – A dictionary with ‘lon_min’, ‘lon_max’, ‘lat_min’, and ‘lat_max’ keys defining a bounding box for the plot.
- Return type:
None
Notes
This function reads data from the input NetCDF file, creates statistical score maps for zonal and meridional currents, and saves the resulting plots as PNG files.
If a bounding box is provided, the function restricts the plot to the specified region.
The function saves two sets of plots: error variance maps and explained variance maps, both for two different scales.
Error Variance Maps: - The first set of plots displays the error variance for zonal and meridional currents at two different scales (All scale and 65-500km).
Explained Variance Maps: - The second set of plots displays the explained variance for zonal and meridional currents at two different scales (All scale and 65-500km).
The PNG files are saved in the ‘../figures/’ directory with informative filenames based on the method used.
Examples
>>> plot_stat_score_map_png("ocean_data.nc", region='global') >>> plot_stat_score_map_png("ocean_data.nc", region='Pacific', box_lonlat={'lon_min': 120, 'lon_max': 240, 'lat_min': -30, 'lat_max': 30})
- mod_plot.plot_stat_score_map_uv(filename)
Generate and display quadmesh plots of variance and explained variance for zonal and meridional currents.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
- Returns:
Layout containing quadmesh plots for variance and explained variance of zonal and meridional currents.
- Return type:
holoviews layout
- mod_plot.plot_stat_score_map_uv_png(filename, region='glob', box_lonlat=None)
Plot zonal and meridional current variance and explained variance maps as PNG files.
- Parameters:
filename (str) – The name of the input NetCDF file.
region (str, optional) – The region to plot (‘glob’ for global, or specify a region name).
box_lonlat (dict, optional) – A dictionary with ‘lon_min’, ‘lon_max’, ‘lat_min’, and ‘lat_max’ keys defining a bounding box for the plot.
- Return type:
None
- mod_plot.plot_stat_score_timeseries(filename)
Generate and display timeseries of error and explained variance.
- Parameters:
filename (str) – Path to the input NetCDF file containing required data.
- Returns:
Layout containing line plots for error and explained variance timeseries.
- Return type:
holoviews layout
- mod_plot.plot_stat_uv_by_regimes(stat_output_filename)
Generate and display statistical summary of velocity components by geographical regions.
- Parameters:
stat_output_filename (str) – Path to the input NetCDF file containing statistical data.
- Returns:
DataFrame containing the statistical summary by regions and velocity components.
- Return type:
pandas DataFrame
- mod_plot.plot_temporal_rmse(rmse_filename=None, output_dir='../results/', var_type='sla', linestyle=None)