import numpy as np
import netCDF4 as nc
import matplotlib.pyplot as plt
%matplotlib inline
f=nc.Dataset('/data/eolson/results/MEOPAR/SS36runs/GrahamRuns/oxyTestShort3/SalishSea_1h_20150401_20150401_ptrc_T_20150401-20150410.nc')
f.variables.keys()
dict_keys(['nav_lat', 'nav_lon', 'bounds_nav_lon', 'bounds_nav_lat', 'area', 'deptht', 'deptht_bounds', 'time_centered', 'time_centered_bounds', 'time_counter', 'time_counter_bounds', 'NO3', 'O2', 'NH4', 'DIAT', 'Si', 'PHY', 'bSi'])
f.variables['O2']
<class 'netCDF4._netCDF4.Variable'> float32 O2(time_counter, deptht, y, x) standard_name: dissolved_oxygen_expressed_as_mole_equivalent long_name: Dissolved Oxygen Concentration units: mmol m-3 online_operation: average interval_operation: 40 s interval_write: 1 h cell_methods: time: mean (interval: 40 s) cell_measures: area: area _FillValue: 1e+20 missing_value: 1e+20 coordinates: time_centered nav_lat nav_lon unlimited dimensions: time_counter current shape = (3, 40, 898, 398) filling on
plt.pcolormesh(f.variables['O2'][-1,0,:,:])
plt.colorbar()
<matplotlib.colorbar.Colorbar at 0x7fbed3a6e490>
plt.pcolormesh(f.variables['O2'][-1,:,:,250])
plt.colorbar()
<matplotlib.colorbar.Colorbar at 0x7fbec763a9d0>
plt.pcolormesh(f.variables['NH4'][-1,0,:,:])
plt.colorbar()
<matplotlib.colorbar.Colorbar at 0x7fbec75dcdf0>
f2=nc.Dataset('/data/eolson/results/MEOPAR/SS36runs/GrahamRuns/oxyTestShortOff/SalishSea_1h_20150401_20150401_ptrc_T_20150401-20150410.nc')
f2.variables.keys()
dict_keys(['nav_lat', 'nav_lon', 'bounds_nav_lon', 'bounds_nav_lat', 'area', 'deptht', 'deptht_bounds', 'time_centered', 'time_centered_bounds', 'time_counter', 'time_counter_bounds', 'NO3', 'NH4', 'DIAT', 'Si', 'PHY', 'bSi'])
np.max(np.abs(f2.variables['NO3'][:]-f.variables['NO3'][:]))
0.0
np.max(np.abs(f2.variables['DIAT'][:]-f.variables['DIAT'][:]))
0.0
np.max(np.abs(f2.variables['bSi'][:]-f.variables['bSi'][:]))
0.0
np.max(np.abs(f2.variables['PHY'][:]-f.variables['PHY'][:]))
0.0
np.max(np.abs(f2.variables['NH4'][:]-f.variables['NH4'][:]))
0.0
np.max(np.abs(f2.variables['NH4'][:]))
4.651838
92*24*3600/40
198720.0
0.00024414062/198720
1.228565921900161e-09