<jupyter_start><jupyter_text>Different depth of salinity comparisons at South arm and North arm between RBR observation and model nowcast results<jupyter_code>from __future__ import division, print_function
from scipy.io import loadmat
from glob import glob
from salishsea_tools import (
    nc_tools,
    viz_tools,
    stormtools,
    tidetools,
)
from salishsea_tools.nowcast import figures

import scipy.io as sio
import matplotlib.pyplot as plt
import netCDF4 as nc
import numpy as np
import datetime
import os
%matplotlib inline
title_font = {
    'fontname': 'Bitstream Vera Sans', 'size': '15', 'color': 'black',
    'weight': 'medium'
}
axis_font = {'fontname': 'Bitstream Vera Sans', 'size': '13'}
rbr = sio.loadmat('/ocean/jieliu/research/meopar/surface current/rbr.mat')
value = rbr['a']
arm_station = {'south_arm': {'lat': 49.1292, 'lon': -123.2119},\
               'north_arm': {'lat': 49.2512, 'lon': -123.2633}}<jupyter_output><empty_output><jupyter_text>16-Sep-2014 model result(south arm)<jupyter_code>tracers = nc.Dataset('/ocean/jieliu/research/meopar\
/surface current/SalishSea_1h_20140916_20140916_grid_T.nc')
PNW_coastline = sio.loadmat('/ocean/rich/more/mmapbase/bcgeo/PNW.mat')
bathy = nc.Dataset('/ocean/jieliu/research/meopar/\
/nemo-forcing/grid/bathy_meter_SalishSea2.nc')
bathyy, X, Y = tidetools.get_SS2_bathy_data()
bbox_args = dict(boxstyle='square', facecolor='white', alpha=0.7)
[x1, y1] = tidetools.find_closest_model_point(arm_station['south_arm']['lon'] , \
     arm_station['south_arm']['lat'],X,Y,bathyy)
salinity = tracers.variables['vosaline']
timesteps = tracers.variables['time_counter']
depth = tracers.variables['deptht']
fig, axs = plt.subplots(1, 2, figsize=(15, 8))
figures.plot_map(axs[1], bathy, PNW_coastline)
bbox_args = dict(boxstyle='square', facecolor='white', alpha=0.7)

axs[0].plot(value [1:215,1],-value [1:215, 0],'DarkGreen', label='RBR 9:48 am[local time]')
axs[0].plot(salinity[16, 0:4, x1, y1], -depth[0:4],'DodgerBlue', label='model 9 am[local time]')
axs[0].plot(salinity[17, 0:4, x1, y1], -depth[0:4],'MediumBlue', label='model 10 am[local time]')
axs[0].set_title('16-Sep-2014 salinity ', **title_font)
axs[0].set_yticklabels(['9','8','7','6','5',
        '4','3','2','1','0'])
axs[0].set_xlabel('salinity', **axis_font)
axs[0].set_ylabel('depth [m]', **axis_font)
axs[0].legend(loc=3)
axs[0].grid()


axs[1].plot(arm_station['south_arm']['lon'] ,
     arm_station['south_arm']['lat'], color='purple',
            marker='D', markersize=10, markeredgewidth=2)
axs[1].annotate ('South Arm',(arm_station['south_arm']['lon'] + 0.1,\
    arm_station['south_arm']['lat']+ 0.1 ),fontsize=15, color='black', bbox=bbox_args )<jupyter_output><empty_output><jupyter_text>2-Oct-2014 model result(south arm)<jupyter_code>tracers = nc.Dataset('/ocean/jieliu/research/meopar\
/surface current/SalishSea_1h_20140927_20141003_grid_T.nc')
salinity = tracers.variables['vosaline']
timesteps = tracers.variables['time_counter']
depth = tracers.variables['deptht']
fig, axs = plt.subplots(1, 2, figsize=(15, 8))
figures.plot_map(axs[1], bathy, PNW_coastline)

axs[0].plot(value [215:380,1],-value [215:380, 0],'DarkGreen', label='RBR 15:16 pm[local time]')
axs[0].plot(salinity[142, 0:4, x1, y1], -depth[0:4],'DodgerBlue', label='model 15 pm[local time]')
axs[0].plot(salinity[143, 0:4, x1, y1], -depth[0:4],'MediumBlue', label='model 16 pm[local time]')
axs[0].set_title('2-Oct-2014 salinity ', **title_font)
axs[0].set_yticklabels(['16','14','12','10','8',
        '6','4','2','0'])
axs[0].set_xlabel('salinity', **axis_font)
axs[0].set_ylabel('depth [m]', **axis_font)
axs[0].legend(loc=3)
axs[0].grid()
axs[1].plot(arm_station['south_arm']['lon'] ,
     arm_station['south_arm']['lat'], color='purple',
            marker='D', markersize=10, markeredgewidth=2)
axs[1].annotate ('South Arm',(arm_station['south_arm']['lon'] + 0.1,\
    arm_station['south_arm']['lat']+ 0.1 ),fontsize=15, color='black', bbox=bbox_args )<jupyter_output><empty_output><jupyter_text>14-Oct-2014 model result(south arm)<jupyter_code>tracers = nc.Dataset('/ocean/jieliu/research/meopar/salinity_comparison/\
daily salinity file/SalishSea_1h_20141011_20141017_grid_T.nc')
salinity = tracers.variables['vosaline']
timesteps = tracers.variables['time_counter']
depth = tracers.variables['deptht']
fig, axs = plt.subplots(1, 2, figsize=(15, 8))
figures.plot_map(axs[1], bathy, PNW_coastline)

axs[0].plot(value [423:570,1],-value [423:570, 0],'DarkGreen', label='RBR 11:42 am[local time]')
axs[0].plot(salinity[90, 0:4, x1, y1], -depth[0:4],'DodgerBlue', label='model 11 am[local time]')
axs[0].plot(salinity[91, 0:4, x1, y1], -depth[0:4],'MediumBlue', label='model 12 am[local time]')
axs[0].set_title('14-Oct-2014 salinity ', **title_font)
axs[0].set_yticklabels(['16','14','12','10','8',
        '6','4','2','0'])
axs[0].set_xlabel('salinity', **axis_font)
axs[0].set_ylabel('depth [m]', **axis_font)
axs[0].legend(loc=3)
axs[0].grid()


axs[1].plot(arm_station['south_arm']['lon'] ,
     arm_station['south_arm']['lat'], color='purple',
            marker='D', markersize=10, markeredgewidth=2) 
axs[1].annotate ('South Arm',(arm_station['south_arm']['lon'] + 0.1,\
    arm_station['south_arm']['lat']+ 0.1 ),fontsize=15, color='black', bbox=bbox_args )<jupyter_output><empty_output><jupyter_text>29-Oct-2014 model result(south arm)<jupyter_code>tracers = nc.Dataset('/ocean/jieliu/research/meopar/salinity_comparison/\
daily salinity file/SalishSea_1h_20141029_20141029_grid_T.nc')
salinity = tracers.variables['vosaline']
timesteps = tracers.variables['time_counter']
depth = tracers.variables['deptht']
fig, axs = plt.subplots(1, 2, figsize=(15, 8))
figures.plot_map(axs[1], bathy, PNW_coastline)

axs[0].plot(value [570:859,1],-value [570:859, 0],'DarkGreen', label='RBR 12:52 am[local time]')
axs[0].plot(salinity[19, 0:4, x1, y1], -depth[0:4],'DodgerBlue', label='model 12 am[local time]')
axs[0].plot(salinity[20, 0:4, x1, y1], -depth[0:4],'MediumBlue', label='model 13 pm[local time]')
axs[0].set_title('29-Oct-2014 salinity ', **title_font)
axs[0].set_yticklabels(['12','10','8',
        '6','4','2','0'])
axs[0].set_xlabel('salinity', **axis_font)
axs[0].set_ylabel('depth [m]', **axis_font)
axs[0].legend(loc=3)
axs[0].grid()

axs[1].plot(arm_station['south_arm']['lon'] ,
     arm_station['south_arm']['lat'], color='purple',
            marker='D', markersize=10, markeredgewidth=2)
axs[1].annotate ('South Arm',(arm_station['south_arm']['lon'] + 0.1,\
    arm_station['south_arm']['lat']+ 0.1 ),fontsize=15, color='black', bbox=bbox_args )<jupyter_output><empty_output><jupyter_text>30-Sep-2014 model result<jupyter_code>tracers = nc.Dataset('/ocean/jieliu/research/meopar/salinity_comparison/\
daily salinity file/SalishSea_1h_20141029_20141029_grid_T.nc')
salinity = tracers.variables['vosaline']
timesteps = tracers.variables['time_counter']
depth = tracers.variables['deptht']
[x2, y2] = tidetools.find_closest_model_point(arm_station['north_arm']['lon'],
                                              arm_station['north_arm']['lat'],X,Y,bathyy)
fig, axs = plt.subplots(1, 2, figsize=(15, 8))
figures.plot_map(axs[1], bathy, PNW_coastline)

axs[0].plot(value [859:965,1],-value [859:965, 0],'DarkGreen', label='RBR 10:36 am[local time]')
axs[0].plot(salinity[17, 0:6, x2, y2], -depth[0:6],'DodgerBlue', label='model 10 am[local time]')
axs[0].plot(salinity[18, 0:6, x2, y2], -depth[0:6],'MediumBlue', label='model 11 am[local time]')
axs[0].set_title('30-Sep-2014 salinity ', **title_font)
axs[0].set_yticklabels(['9','8','7','6','5',
        '4','3','2','1','0'])
axs[0].set_xlabel('salinity', **axis_font)
axs[0].set_ylabel('depth [m]', **axis_font)
axs[0].legend(loc=3)
axs[0].grid()

axs[1].plot(arm_station['north_arm']['lon'] ,
     arm_station['north_arm']['lat'], color='purple',
            marker='D', markersize=10, markeredgewidth=2)
axs[1].annotate ('North Arm',(arm_station['north_arm']['lon'] + 0.1,\
    arm_station['north_arm']['lat']+ 0.1 ),fontsize=15, color='black', bbox=bbox_args )<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20759618953358902, 'fraction_numerical': 0.06928120747247309, 'mean_word_length': 6.863813229571984, 'pattern_counts': {'":': 0, '<': 25, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '602987', 'license': 'Apache-2.0', 'n_tokens_mistral': 3624, 'n_tokens_neox': 3277, 'n_words': 499, 'path': 'jie/RBR-Model comparison.ipynb', 'repo_name': 'SalishSeaCast/analysis', 'size': '8083'}