<jupyter_start><jupyter_text>IV- Demo. plot results An example of data evaluation metrics have been produced in the "demo_data_eval.ipynb" notebook. Here, we illustrate the results.<jupyter_code>import xarray as xr
import hvplot.xarray
import numpy
import sys
sys.path.append('..')
from src.mod_plot import *<jupyter_output><empty_output><jupyter_text>Load the reference SSH field<jupyter_code>filename_ssh_reference = '../results/dc_ref_2012-10-22-2012-12-02_sample.nc'
dc_ref_sample = xr.open_dataset(filename_ssh_reference)
dc_ref_sample<jupyter_output><empty_output><jupyter_text>Load the reconstructed SSH field<jupyter_code>filename_ssh_reconstruction_regridded = '../results/ssh_reconstruction_regridded_2012-10-22-2012-12-02_jason1.nc'
dc_reconstruction_regridded = xr.open_dataset(filename_ssh_reconstruction_regridded)
dc_reconstruction_regridded
filename_ssh_reconstruction = '../results/ssh_reconstruction_2012-10-22-2012-12-02_jason1.nc'
dc_reconstruction = xr.open_dataset(filename_ssh_reconstruction)
dc_reconstruction<jupyter_output><empty_output><jupyter_text>Display the reference & reconstructed SSH fields<jupyter_code>ds_concat = xr.concat((dc_ref_sample, dc_reconstruction_regridded), dim='field')
ds_concat['field'] = ["Nature Run", "OI Reconstruction"]
ds_concat
ds_concat.hvplot.image(x='lon', y='lat', cmap='gist_stern', by='field', width=500, height=400, widget_location='bottom', clabel='SSH [m]', subplots=True, clim=(-0.5, 1))<jupyter_output><empty_output><jupyter_text>Display the difference  SSH_reconstruction minus SSH_reference<jupyter_code>(dc_reconstruction_regridded - dc_ref_sample).hvplot.image(x='lon', y='lat', cmap='coolwarm', width=500, height=400, widget_location='bottom', clabel='dSSH[m]')<jupyter_output><empty_output><jupyter_text>Display spatially averaged daily RMSE score (normalized RMSE) Shows the temporal stability of the reconstuction. A score of 1 means a perfect reconstruction, a zero score means strong incoherency between the reconstruction & reference fields<jupyter_code>filename_rmse_t = '../results/rmse_t_ssh_reconstruction_2012-10-22-2012-12-02_jason1.nc'
ds = xr.open_dataset(filename_rmse_t)
ds.rmse_t.hvplot(yaxis='left', title='Spatially averaged daily RMSE', ylim=(0, 1), ylabel='RMSE score')
dc_reconstruction.nobs.hvplot.area(color='grey', title='# obs in OI')<jupyter_output><empty_output><jupyter_text>Display temporally averaged RMSE Highlight the regions of large/low mean reconstruction errors<jupyter_code>filename_rmse_xy = '../results/rmse_xy_ssh_reconstruction_2012-10-22-2012-12-02_jason1.nc'
ds = xr.open_dataset(filename_rmse_xy)
ds.rmse_xy.hvplot(x='lon', y='lat', cmap='Reds', width=500, height=400, clabel='RMSE[m]', title='Temporally averaged RMSE')<jupyter_output><empty_output><jupyter_text>Display PSD score Highlight the average space-time scales that are resolved in the reconstruction. The boundary is delimited by the iso-contour 0.5 (green area in the figure)<jupyter_code>filename_psd = '../results/psd_ssh_reconstruction_2012-10-22-2012-12-02_jason1.nc'
ds = xr.open_dataset(filename_psd)
plot_psd_score(ds)
ds['freq_time'] = 1./ds['freq_time']
ds['freq_lon'] = 1./ds['freq_lon']
ds.hvplot.quadmesh(x='freq_lon', y='freq_time', z='psd_score', cmap='RdYlGn',
                   clim=(0, 1), logx=False, logy=False, title='PSD-score', width=500, height=400, 
                   clabel='PSD score', xlabel='wavelenght (degree)', ylabel='wavelenght (days)')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1251435132032147, 'fraction_numerical': 0.039322617680826635, 'mean_word_length': 8.099216710182768, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '141370', 'license': 'MIT', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1230, 'n_words': 219, 'path': 'notebooks/example_plot_results.ipynb', 'repo_name': 'ocean-data-challenges/ssh-mapping', 'size': '3484'}