This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import numpy | |
tkeFile = netCDF4.Dataset('/archive/bls/tikal_mom6_2014.01.17/MOM6z_SIS_025_enstro_newTides/gfdl.ncrc2-intel-prod/history/unpack/19000101.ocean_annual.nc') | |
TKEi = numpy.ma.array( tkeFile.variables['TKE_itidal'][0], dtype='float64') | |
TKEf = numpy.ma.array( tkeFile.variables['TKE_tidal'][0], dtype='float64') | |
staticFile = netCDF4.Dataset('/net2/aja/OWG/ocean_static.nc') | |
area = numpy.ma.array( staticFile.variables['area_t'][:], dtype='float64') | |
depth = numpy.ma.array( staticFile.variables['depth_ocean'][:], dtype='float64') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import necessary modules | |
import netCDF4 | |
import matplotlib.pyplot as plt | |
tFiles = netCDF4.MFDataset('/archive/bls/tikal_201406_mom6_2014.07.01/OM4_SIS_baseline/gfdl.ncrc2-intel-prod/pp/ocean_monthly/ts/monthly/10yr/ocean_monthly.*.temp.nc') | |
print tFiles | |
tType = tFiles.variables['temp'] | |
print tType | |
print tType.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import numpy | |
import matplotlib | |
import matplotlib.pyplot as plt | |
area = netCDF4.Dataset('/net2/aja/OWG/ocean_static.nc').variables['area_t'][:] | |
lat = netCDF4.Dataset('/net2/aja/OWG/ocean_static.nc').variables['geolat_c'][:] | |
T1 = netCDF4.Dataset('/archive/bls/tikal_mom6_2014.01.17/MOM6z_SIS_025_enstro_iTides_1TW/gfdl.ncrc2-intel-prod/pp/ocean_annual/av/annual_20yr/ocean_annual.1900-1919.ann.nc').variables['temp'][0,:] | |
T2 = netCDF4.Dataset('/archive/bls/tikal_mom6_2014.01.17/MOM6z_SIS_025_enstro_rev5channels/gfdl.ncrc2-intel-prod/pp/ocean_annual/av/annual_20yr/ocean_annual.1900-1919.ann.nc').variables['temp'][0,:] | |
zInterface = netCDF4.Dataset('/archive/bls/tikal_mom6_2014.01.17/MOM6z_SIS_025_enstro_iTides_1TW/gfdl.ncrc2-intel-prod/pp/ocean_annual/av/annual_20yr/ocean_annual.1900-1919.ann.nc').variables['e'][0,:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import numpy | |
import matplotlib | |
import matplotlib.pyplot as plt | |
[ny,nx] = netCDF4.Dataset('/archive/gold/datasets/OM4_025/mosaic.v20140610.unpacked/ocean_topog.nc').variables['depth'].shape | |
area = netCDF4.Dataset('/archive/gold/datasets/OM4_025/mosaic.v20140610.unpacked/ocean_hgrid.nc').variables['area'][:].reshape(ny,2,nx,2).sum(axis=-1).sum(axis=1) | |
lat = netCDF4.Dataset('/archive/gold/datasets/OM4_025/mosaic.v20140610.unpacked/ocean_hgrid.nc').variables['y'][1::2,1::2] | |
annualFile = '/archive/bls/tikal_201406_mom6_2014.07.01/OM4_SIS_baseline/gfdl.ncrc2-intel-prod/pp/ocean_annual/av/annual_5yr/ocean_annual.1900-1904.ann.nc' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import numpy | |
import m6plot | |
lon = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['x'][::2,::2] | |
lat = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['y'][::2,::2] | |
area = netCDF4.Dataset('/net2/aja/OWG/ocean_static.nc').variables['area_t'][:] | |
U26 = netCDF4.Dataset('/net2/aja/MOM6.workdir/MOM6/tools/python/tideamp/tidal_amplitude.v20140326.nc').variables['tideamp'][:] | |
U28 = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/INPUT/tidal_amplitude.v20140328.nc').variables['tideamp'][:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import numpy | |
import matplotlib.pyplot as plt | |
rootDir = '/archive/bls/tikal_201403_mom6_2014.04.03/MOM6z_SIS_025_PPMh4/gfdl.ncrc2-intel-prod/' | |
# Read nominal longitudes (to find the section) | |
xh = netCDF4.Dataset(rootDir+'history/unpack/19300101.ocean_annual.nc').variables['xh'][:] | |
# Find the index of longitude=-30.0 | |
iSect = numpy.abs(xh + 30.0).argmin() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import matplotlib.pyplot as plt | |
import numpy | |
from mpl_toolkits.basemap import Basemap | |
lon = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['x'][::2,::2] | |
lat = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['y'][::2,::2] | |
ssh = netCDF4.Dataset('/archive/aja/awg/tikal_201403/MOM6z_SIS_025_c192L48_am4a1_2000climo_bergs/gfdl.ncrc2-intel-prod-openmp/history/unpack/00040301.ocean_daily.nc').variables['ssh'][1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import matplotlib.pyplot as plt | |
import numpy | |
from mpl_toolkits.basemap import Basemap | |
lon = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['x'][::2,::2] | |
lat = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['y'][::2,::2] | |
dailyFiles = '/archive/aja/awg/tikal_201403/CM4_c192L48_am4a1_2000/gfdl.ncrc2-intel-prod-openmp/history/unpack/000[3456]0101.ocean_daily.nc' | |
ssh = netCDF4.MFDataset(dailyFiles).variables['ssh'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import matplotlib.pyplot as plt | |
import numpy | |
from mpl_toolkits.basemap import Basemap | |
import math | |
lon = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['x'][1::2,1::2] | |
lat = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['y'][1::2,1::2] | |
dx = netCDF4.Dataset('/archive/gold/datasets/MOM6z_SIS_025/siena/mosaic.unpacked/ocean_hgrid.nc').variables['dx'][:] | |
dx = dx[1::2,1::2]+numpy.roll(dx,-1,axis=-1)[1::2,1::2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dens_wright_eos(T, S, p): | |
""" | |
Equation of state for sea water given by Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-740. | |
Units: T[degC],S[PSU],p[Pa] | |
Returns density [kg m-3] | |
""" | |
a0 = 7.057924e-4; a1 = 3.480336e-7; a2 = -1.112733e-7 | |
b0 = 5.790749e8; b1 = 3.516535e6; b2 = -4.002714e4; b3 = 2.084372e2; b4 = 5.944068e5; b5 = -9.643486e3 | |
c0 = 1.704853e5; c1 = 7.904722e2; c2 = -7.984422; c3 = 5.140652e-2; c4 = -2.302158e2; c5 = -3.079464 |
OlderNewer