<jupyter_start><jupyter_text>Table of Contents1&nbsp;&nbsp;Imports2&nbsp;&nbsp;Data, Interpolate RPN onto OPS grid3&nbsp;&nbsp;OPS Grid (where we want the values)4&nbsp;&nbsp;Make a water mask (here based on the temperature)5&nbsp;&nbsp;Set up the fields to be interpolated and mask them6&nbsp;&nbsp;Run Interpolation and Time it  Imports<jupyter_code>import numpy as np
from scipy import interpolate
import xarray as xr<jupyter_output><empty_output><jupyter_text>Data, Interpolate RPN onto OPS grid<jupyter_code>rpndata = xr.open_dataset('./2014110206_007.nc')
opsdata = xr.open_dataset('ops_y2014m11d02.nc')<jupyter_output><empty_output><jupyter_text>OPS Grid (where we want the values)<jupyter_code>xnew = opsdata['nav_lon'][:]
ynew = opsdata['nav_lat'][:]<jupyter_output><empty_output><jupyter_text>Make a water mask (here based on the temperature)<jupyter_code>TT = rpndata['TT'][0, 0]
mymask = TT > 282 - 273.15<jupyter_output><empty_output><jupyter_text>Set up the fields to be interpolated and mask them<jupyter_code>allx = np.array(rpndata['nav_lon'])
ally = np.array(rpndata['nav_lat'])
allfield = np.array(rpndata['PN'][0, 0])
inx = allx[mymask]
iny = ally[mymask]
points = np.array((inx, iny)).T
field = allfield[mymask]<jupyter_output><empty_output><jupyter_text>Run Interpolation and Time it<jupyter_code>%%time
field_on_ops = interpolate.griddata(points, field, (xnew, ynew))<jupyter_output>CPU times: user 896 ms, sys: 43.8 ms, total: 940 ms
Wall time: 944 ms
{'fraction_non_alphanumeric': 0.12745762711864406, 'fraction_numerical': 0.03457627118644068, 'mean_word_length': 8.401273885350319, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '24758', 'license': 'Apache-2.0', 'n_tokens_mistral': 598, 'n_tokens_neox': 561, 'n_words': 125, 'path': 'notebooks/MOHID/MaskedInterpolationUsingGriddata.ipynb', 'repo_name': 'SalishSeaCast/analysis-susan', 'size': '1475'}