Visualize#

ctdfjorder.visualize.ctd_plot.plot_depth_vs(df: DataFrame, measurement: str, plot_folder: str, plot_type: str = 'scatter')[source]#

Generates a plot of depth vs. specified measurement (salinity, density, temperature).

Parameters:
  • df (pl.DataFrame) – The CTD dataframe containing the data to plot.

  • measurement (str) – The measurement to plot against depth. Options are ‘salinity’, ‘density’, ‘potential_density’, or ‘temperature’.

  • plot_folder (str) – The path to the folder where plots will be saved.

  • plot_type (str, optional) – The type of plot to generate. Options are ‘line’ or ‘scatter’. Defaults to ‘scatter’.

Notes

  • Adds horizontal lines indicating the mixed layer depth (MLD) if present.

  • Allows for both scatter and line plot types.

  • Saves the plot as an image file in the specified folder.

ctdfjorder.visualize.ctd_plot.plot_map(df: DataFrame, mapbox_access_token)[source]#

Generates an interactive map using Plotly and Dash to visualize CTD profiles.

Parameters:
  • df (pl.DataFrame) – The CTD data to plot on the map.

  • mapbox_access_token (str) – The Mapbox access token for rendering the map.

Notes

This function creates a Dash web application with interactive controls for filtering the data by year, month, unique ID, latitude, longitude, and date range. The filtered data is displayed on a Mapbox map.

ctdfjorder.visualize.ctd_plot.plot_original_data(salinity, depths, filename, plot_path)[source]#

Generates a scatter plot of original salinity vs. depth.

Parameters:
  • salinity (array-like) – The salinity data to plot.

  • depths (array-like) – The corresponding depth data.

  • filename (str) – The name of the file being plotted.

  • plot_path (str) – The path to save the plot image.

Returns:

The x and y limits of the plot.

Return type:

tuple

Notes

  • Creates a scatter plot with salinity on the x-axis and depth on the y-axis (inverted).

  • Adds a title, labels, and grid to the plot.

  • Saves the plot as an image file and returns the plot limits.

ctdfjorder.visualize.ctd_plot.plot_predicted_data(salinity, depths, xlim, ylim, filename, plot_path)[source]#

Generates a scatter plot of predicted salinity vs. depth.

Parameters:
  • salinity (array-like) – The predicted salinity data to plot.

  • depths (array-like) – The corresponding depth data.

  • xlim (tuple) – The x-axis limits from the original data plot.

  • ylim (tuple) – The y-axis limits from the original data plot.

  • filename (str) – The name of the file being plotted.

  • plot_path (str) – The path to save the plot image.

Notes

  • Creates a scatter plot with predicted salinity on the x-axis and depth on the y-axis (inverted).

  • Adds a title, labels, and grid to the plot.

  • Uses the same axis limits as the original data plot for comparison.

  • Saves the plot as an image file.