Tutorials (4)
Plotting
Once the code has finished running, it will generate and output file that the user can visualize using the python based visualize_output.ipynb notebook. This notebook is located in the examples folder.
The Obliqua output file will be placed in the out folder, unless otherwise specified in the configuration file (default is out). The output file will be named according to the timestep of the simulation specified in the configuration file, (default is 0_obliqua.nc).
When you have identified the relevant output file path, you can use the visualize_output.ipynb notebook to visualize the output. Simply open the notebook and update the following lines to point to the correct output file path.
out_dir = "/path/to/obliqua/out/"
nc_file_path = os.path.join(out_dir, "0_obliqua.nc")The notebook will then load the output file and automatically produce several plots of the results. These plots will be stored in the out_dir directory.
The user can also use the Obliqua.plotting module to generate plots on-the-fly. This is for example useful when troubleshooting. This includes the following functions:
Obliqua.plotting.plot_imagk2_spectrum: Plots the imaginary part of the Love number $k_n$ as a function of the forcing frequency.Obliqua.plotting.plot_imagk2_spectra: Plots the imaginary part of the Love number $k_n$ as a function of the forcing frequency for each segment individually.Obliqua.plotting.save_heat_profile: Plots the tidal power profile as a function of the radius.Obliqua.plotting.plot_segment_heating: Plots the tidal power block as a function of the radius and forcing frequency.Obliqua.plotting.plot_surface_heating: Plots the surface tidal power as a function of latitude and longitude.Obliqua.plotting.plot_relaxation_solution: Plots the $y$-functions as a function of the radius. (Specifically useful for debugging the relaxation models, but can be used for the other models as well).
Obliqua.plotting.plot_imagk2_spectra — Method
plot_imagk2_spectra(σ_range, imag_k2, segments; outpath)Create and save a plot of the segment wise Imk2 Lovenumber as function of forcing frequency.
Arguments
σ_range::Array{prec,1}: Forcing frequency range.imag_k2::Array{precc,1}: k2 Lovenumbers.segments::Vector{String}: Names of segments corresponding to each column of imag_k2.
Keyword Arguments
outpath::Union{Nothing,String}=nothing: If provided, the figure is saved to this path usingsavefig.
Returns
plt: ThePlots.Plotobject.
Obliqua.plotting.plot_imagk2_spectrum — Method
plot_imagk2_spectrum(σ_range, imag_k2; outpath)Create and save a plot of the Imk2 Lovenumber as function of forcing frequency.
Arguments
σ_range::Array{prec,1}: Forcing frequency range.imag_k2::Array{precc,1}: k2 Lovenumbers.
Keyword Arguments
outpath::Union{Nothing,String}=nothing: If provided, the figure is saved to this path usingsavefig.
Returns
plt: ThePlots.Plotobject.
Obliqua.plotting.plot_relaxation_solution — Method
plot_relaxation_solution(y, r; filename="relaxation_solution.png")Create and save a plot of the y-function relaxation solution as function of radius.
Arguments
y::AbstractMatrix: y-function values for each radius and function index.r::AbstractVector: Radius values corresponding to rows of y.
Keyword Arguments
filename::String="relaxation_solution.png": Path to save the figure.
Returns
plt: ThePlots.Plotobject.
Obliqua.plotting.plot_segment_heating — Method
plot_segment_heating(H, k_range, r; mask_floor=0.0, filename="tidal_heating_map.png", title_str="Hansen norm heating")Create and save a heatmap of the tidal heating as function of radius and forcing frequency.
Arguments
H::AbstractMatrix: Tidal heating values for each radius and forcing frequency.k_range::AbstractVector: Forcing frequency range corresponding to columns of H.r::AbstractVector: Radius values corresponding to rows of H.
Keyword Arguments
mask_floor::Float64=0.0: Minimum heating value to plot (for better color scaling).filename::String="tidal_heating_map.png": Path to save the heatmap figure.title_str::String="Hansen norm heating": Title for the heatmap figure.
Returns
plt: ThePlots.Plotobject.
Obliqua.plotting.plot_surface_heating — Method
plot_surface_heating(H, res; filename="tidal_heating_map_surface.png", title_str="Surface heating map")Create and save a heatmap of the surface tidal heating as function of latitude and longitude.
Arguments
H::AbstractMatrix: Surface tidal heating values for each lat-lon grid point.res::Float64: Angular resolution of the lat-lon grid in degrees.
Keyword Arguments
filename::String="tidal_heating_map_surface.png": Path to save the heatmap figure.title_str::String="Surface heating map": Title for the heatmap figure.
Returns
plt: ThePlots.Plotobject.
Obliqua.plotting.save_heat_profile — Method
save_heat_profile(radius, power_prf; filename="heat_profile.png")Create and save a plot of the heat dissipation profile as a function of radius.
Returns
plt: ThePlots.Plotobject.