# Specify the field to average
fieldname1 = 'vomece3v'
fieldname2 = 'e3v'

# Specify the years to do the averaging over and the season to average.
init_year = 1997
num_years = 3

# Specify the names of the different files that I want to load from.
gridfile = 'MESH/mesh_mask.nc'

# --------------------------------------------------------------------------- #

# Load the relevant mask.
vmask = np.squeeze(nemo.load_field('vmask', homedir, nemodir, gridfile, 'V'))

# --------------------------------------------------------------------------- #

# Loop over the number of years and months to make the require seasonal
# average.
field = nemo.calc_annual_ratio(fieldname1,
                               fieldname2,
                               vmask,
                               'V',
                               1.0,
                               homedir,
                               nemodir,
                               'd05/V/',
                               prefix='ORCH0083-LIM3_',
                               suffix='_V_d05.nc',
# Specify the names of the different files that I want to load from.
udir = 'TIDY/ARCHIVE/????/d05/U/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Choose whether to save/load KE values.
save_output = 1

# --------------------------------------------------------------------------- #

# Load the grid spacings.
e2u = nemo.load_field('e2u', homedir, nemodir, gridfile, 'T')[2599:2600, :,
                                                              None]

# Load the relevant mask.
umask = np.squeeze(nemo.load_field('umask', homedir, nemodir, gridfile,
                                   'U'))[2599:2600, :, :, None]

# --------------------------------------------------------------------------- #

# Find the number of files in the directory that we want to calculate KE for.
if save_output:
    ufiles = sorted(glob.glob(''.join([homedir, nemodir, udir, '*'])))

# --------------------------------------------------------------------------- #
# If we're not loading the data, then loop over all the available files and
# calculatet the average KE.
Beispiel #3
0
# --------------------------------------------------------------------------- #

# Specify where the input data lives.
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/DRM-ORCH0083-LIM3/EXP00/TIDY/ARCHIVE/'

# Specify the names of the different files that I want to load from.
gridfile = 'MESH/mesh_mask.nc'

# Specify the filename.
filename = 'siconc_DJF_1951-1954.npy'

# --------------------------------------------------------------------------- #

# Load the coordinates.
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile,
                                   'T'))[:, :, 0:1]

# --------------------------------------------------------------------------- #

ice = np.load(''.join([homedir, nemodir, 'POST/', filename]))
ice = nemo.mask_field(ice, tmask)

# --------------------------------------------------------------------------- #

# Set the max mxl that I want to plot.
max_ice = 1.
Beispiel #4
0
plt.register_cmap(name='speed', cmap=cmocean.cm.speed)

# --------------------------------------------------------------------------- #

# Specify where the input data lives.
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/DRM-ORCH0083-LIM3/EXP00/'

# Specify the names of the different files that I want to load from.
filename = 'TIDY/ARCHIVE/1948/U/ORCH0083-LIM3_19481227_U_d05.nc'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamu = np.squeeze(nemo.load_field('glamu', homedir, nemodir, gridfile, 'U'))
gphiu = np.squeeze(nemo.load_field('gphiu', homedir, nemodir, gridfile, 'U'))

# Load the relevant mask.
umask = np.squeeze(nemo.load_field('umask', homedir, nemodir, gridfile,
                                   'U'))[:, :, 0:1]

# Load the field to plot and remask it.
ssu = nemo.load_field('sossussu', homedir, nemodir, filename, 'U')
ssu = nemo.mask_field(ssu, umask)

# --------------------------------------------------------------------------- #

# Create a new figure window.
plt.figure()
Beispiel #5
0
# Specify the years to do the averaging over.
init_year = 1972  # Sets the output file names.
num_years = 1

# Set physical constants.
g = 9.80665  # gravitational acceleration.

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# --------------------------------------------------------------------------- #

# Load the relevant masks.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile,
                                   'T'))[:, :, 0:1]
umask = np.squeeze(nemo.load_field('umask', homedir, nemodir, gridfile,
                                   'U'))[:, :, 0:1]
vmask = np.squeeze(nemo.load_field('vmask', homedir, nemodir, gridfile,
                                   'V'))[:, :, 0:1]

# Load the grid spacings.
e1u = nemo.load_field('e1u', homedir, nemodir, gridfile, 'U')
e2v = nemo.load_field('e2v', homedir, nemodir, gridfile, 'V')

# Load the Coriolis parameter.
f = nemo.load_field('ff_f', homedir, nemodir, gridfile, 'Z')

# --------------------------------------------------------------------------- #

# Find the number of files in the directory that we want to the geostrophic wind work for.
Beispiel #6
0
plt.register_cmap(name='deep', cmap=cmocean.cm.deep)

# --------------------------------------------------------------------------- #

# Specify where the input data lives.
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/JRA55ABS-ORCH0083-LIM3/EXP00/'

# Specify the names of the different files that I want to load from.
filename = 'TIDY/ARCHIVE/1952/d01/T/ORCH0083-LIM3_19521231_T_d01.nc'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# --------------------------------------------------------------------------- #

# Load the coordinates.
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask',
                                   homedir, nemodir, gridfile, 'T'))[:, :, 0:1]

# Load the field to plot and remask it.
mxl = nemo.load_field('somxlr103', homedir, nemodir, filename, 'T')
mxl = nemo.mask_field(mxl, tmask)

# --------------------------------------------------------------------------- #

# Set the max mxl that I want to plot.
max_mxl = 100.
Beispiel #7
0
# Specify where the input data lives.
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/DRM-ORCH0083-LIM3/EXP02/'

# Specify the names of the different files that I want to load from.
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# --------------------------------------------------------------------------- #

# Load the zonal grid spaing and latitudes
e1t = np.squeeze(nemo.load_field('e1t', homedir, nemodir, gridfile, 'T'))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile,
                                   'T'))[:, :, 0:1]

# --------------------------------------------------------------------------- #
# Load the field to plot and remask it.
sss = nemo.load_field('vosaline', homedir, nemodir, 'INIT/vosaline.1949.nc',
                      'T')[:, :, 0:1, 0]
sss = nemo.mask_field(sss, tmask)

# Integrate the temperature variance.
nemo_sss_init = (sss * e1t[:, :, None] * tmask).sum(axis=0) / \
                  (e1t[:, :, None] * tmask).sum(axis=0)
Beispiel #8
0
# Specify where the input data lives.
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/DRM-ORCH0083-LIM3/EXP02/'

# Specify the names of the different files that I want to load from.
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile, 'T'))
e3t_0 = np.squeeze(nemo.load_field('e3t_0', homedir, nemodir, gridfile, 'T'))
depth = (e3t_0 * tmask).sum(axis=2)
depth = nemo.mask_field(depth[:, :, None], tmask[:, :, 0:1])

# --------------------------------------------------------------------------- #

# Create a new figure window.
plt.figure(figsize=(8.0, 8.0))

# Specify some things to make the plot look nice.
map = Basemap(projection='spaeqd', boundinglat=-35, lon_0=-150, round='true')
Beispiel #9
0
scale_factor = 1.1

# --------------------------------------------------------------------------- #

# Find the files that I want to rescale the U & V winds in.
ufiles = sorted(glob.glob(''.join([homedir, jra55dir, 'u_10.*'])))
vfiles = sorted(glob.glob(''.join([homedir, jra55dir, 'v_10.*'])))

# --------------------------------------------------------------------------- #

# Specify the number of grid boxes in JRA55.
nx = 640
ny = 320

# Load the lats & lons from the first ufile.
lat = np.repeat(nemo.load_field('latitude', '', '', ufiles[0])[:, None],
                640,
                axis=1).T
lon = np.repeat(nemo.load_field('longitude', '', '', ufiles[0])[:, None],
                320,
                axis=1)

# --------------------------------------------------------------------------- #

# Construct the mask for the wind scaling based upon latitude.
mask = copy.deepcopy(lat)
mask[mask < -70] = 0.
mask[mask > -30] = 0.
mask[mask < 0] = 1.

for j in np.arange(320):
Beispiel #10
0
vdir = 'u-bc337-bl504_links/'

gridfile = 'mesh_mask_eORCA025-GO7.nc'

# Specify the number of grid boxes.
nx = 1440
ny = 1207
nz = 75

# Choose whether to save/load KE values.
save_output = 0

# --------------------------------------------------------------------------- #

# Load the grid spacings.
e1t = nemo.load_field('e1t', homedir, nemodir, gridfile, 'T', nx, ny)
e2t = nemo.load_field('e2t', homedir, nemodir, gridfile, 'T', nx, ny)

# Load the relevant mask.
tmask = np.squeeze(
    nemo.load_field('tmask', homedir, nemodir, gridfile, 'T', nx, ny))
umask = np.squeeze(
    nemo.load_field('umask', homedir, nemodir, gridfile, 'U', nx, ny))
vmask = np.squeeze(
    nemo.load_field('vmask', homedir, nemodir, gridfile, 'V', nx, ny))

# Calculate the surface area of the T grid boxes & mask.
area = np.ma.masked_array(e1t * e2t, mask=1.0 - tmask[:, :, 0:1])

# --------------------------------------------------------------------------- #
udir = 'TIDY/ARCHIVE/????/d05/U/'
vdir = 'TIDY/ARCHIVE/????/d05/V/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Choose whether to save/load KE values.
save_output = 1

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))

# Load the grid spacings.
e1t = nemo.load_field('e1t', homedir, nemodir, gridfile, 'T')
e2t = nemo.load_field('e2t', homedir, nemodir, gridfile, 'T')

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile, 'T'))
umask = np.squeeze(nemo.load_field('umask', homedir, nemodir, gridfile, 'U'))
vmask = np.squeeze(nemo.load_field('vmask', homedir, nemodir, gridfile, 'V'))

# Calculate the surface area of the T grid boxes & mask.
area = np.ma.masked_array(e1t * e2t, mask=1.0 - tmask[:, :, 0:1])

# --------------------------------------------------------------------------- #
Beispiel #12
0
udir = 'TIDY/ARCHIVE/1985/d05/U/'
vdir = 'TIDY/ARCHIVE/1985/d05/V/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Choose whether to save/load KE values.
save_output = 0

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile))
depth = np.squeeze(nemo.load_field('nav_lev', homedir, nemodir, gridfile))

# Load the grid spacings.
e1u = nemo.load_field('e1u', homedir, nemodir, gridfile, 'U')
e2v = nemo.load_field('e2u', homedir, nemodir, gridfile, 'V')
e1f = nemo.load_field('e1f', homedir, nemodir, gridfile, 'Z')
e2f = nemo.load_field('e2f', homedir, nemodir, gridfile, 'Z')

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile, 'T'))
umask = np.squeeze(nemo.load_field('umask', homedir, nemodir, gridfile, 'U'))
vmask = np.squeeze(nemo.load_field('vmask', homedir, nemodir, gridfile, 'V'))
fmask = np.squeeze(nemo.load_field('fmask', homedir, nemodir, gridfile, 'Z'))
Beispiel #13
0
nemodir = 'trunk/NEMOGCM/CONFIG/CORE2NYF-ORCH0083-LIM3/EXP00/'

# Specify the names of the different files that I want to load from.
ufilename = 'TIDY/ARCHIVE/1952/d01/U/ORCH0083-LIM3_19521231_U_d01.nc'
vfilename = 'TIDY/ARCHIVE/1952/d01/V/ORCH0083-LIM3_19521231_V_d01.nc'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamf = np.squeeze(nemo.load_field('glamf', homedir, nemodir, gridfile, 'Z'))
gphif = np.squeeze(nemo.load_field('gphif', homedir, nemodir, gridfile, 'Z'))

# Load the grid spacings.
e1u = nemo.load_field('e1u', homedir, nemodir, gridfile, 'U')
e2v = nemo.load_field('e2u', homedir, nemodir, gridfile, 'V')
e1f = nemo.load_field('e1f', homedir, nemodir, gridfile, 'Z')
e2f = nemo.load_field('e2f', homedir, nemodir, gridfile, 'Z')

# Load the relevant mask.
umask = np.squeeze(nemo.load_field('umask', homedir, nemodir, gridfile,
                                   'U'))[:, :, 0:1]
vmask = np.squeeze(nemo.load_field('vmask', homedir, nemodir, gridfile,
                                   'V'))[:, :, 0:1]
fmask = np.squeeze(nemo.load_field('vmask', homedir, nemodir, gridfile,
                                   'Z'))[:, :, 0:1]
Beispiel #14
0
# Specify where the input data lives.
homedir = '/Users/mbk'
nemodir = '/Documents/BAS/Ariane/ariane-2.2.8_04/'

# Pick the year to plot.
year = '2010'

# Specify the names of the different files that I want to load from.
filename = 'course/DATA/ORCA025-N401_20000105d05T.nc'
gridfile = 'Fields/mesh_hgr_matt.nc'

# --------------------------------------------------------------------------- #

# Load the coordinates.
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gdept = np.squeeze(nemo.load_field('gdepw_0', homedir, nemodir, gridfile))

# Load the masks.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile, 'T'))

# Load the fields and remask them.
ntemp = np.squeeze(nemo.load_field('votemper', homedir, nemodir, filename,
                                   'T'))
ntemp = nemo.mask_field(ntemp, tmask)

#--------------------------------------------------------------------------- #
# Create a new figure window and title it.
plt.figure(figsize=(12.0, 12.0))
plt.title('Temperature transect at 57N')
Beispiel #15
0
# Specify the field to average.
fieldname = 'siconc'

# Specify the years to do the averaging over and the season to average.
season_to_ave = ('JFM', 'AMJ', 'JAS', 'OND')
init_year = 1960
num_years = 1

# Specify the names of the different files that I want to load from.
gridfile = 'MESH/mesh_mask.nc'

# --------------------------------------------------------------------------- #

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile,
                                   'T'))[:, :, 0:1]

# --------------------------------------------------------------------------- #

# Loop over the number of years and months to make the require seasonal
# average.
for k in season_to_ave:
    field = nemo.calc_seasonal_ave(fieldname,
                                   tmask,
                                   'T',
                                   homedir,
                                   nemodir,
                                   'd01/I/',
                                   prefix='ORCH0083-LIM3_',
                                   suffix='_I_d01.nc',
                                   start_year=init_year,
Beispiel #16
0
# Specify where the input data lives.
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/DRM-ORCH0083-LIM3/EXP01/'

# Pick the year to plot.
year = '1948'

# Specify the names of the different files that I want to load from.
filename = ''.join(['INIT/output.init.', year, '.nc'])
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# --------------------------------------------------------------------------- #

# Load the coordinates.
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask',
                                   homedir, nemodir, gridfile, 'T'))[:, :, 0:1, None]

# Load the field to plot and remask it.
sss = nemo.load_field('vosaline', homedir, nemodir, filename, 'T')[:, :, 0:1]
sss = nemo.mask_field(sss, tmask)

# --------------------------------------------------------------------------- #

# Create a new figure window.
plt.figure(figsize=(8.0, 8.0))
Beispiel #17
0
tdir = 'TIDY/ARCHIVE/195[123456789]/d05/T/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Specify an offset so that the animation can start partway through a run.
no_years = 0.0
offset = 73.0 * no_years

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))
gdept = np.squeeze(nemo.load_field('gdept_1d', homedir, nemodir, gridfile))

# Load the relevant mask.
tmask = np.squeeze(
    nemo.load_field('tmask', homedir, nemodir, gridfile, 'T')[3250:3251, :, :])

# --------------------------------------------------------------------------- #

# Find the number of files in the directory that we want to calculate KE for.
tfiles = sorted(glob.glob(''.join([homedir, nemodir, tdir, '*'])))

# --------------------------------------------------------------------------- #

# Loop over the U/V files and load the surface velocity.
# Specify the names of the different files that I want to load from.
tdir = 'TIDY/ARCHIVE/????/m01/T/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Choose whether to save/load KE values.
save_output = 1

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))

# Load the grid spacings.
e1t = nemo.load_field('e1t', homedir, nemodir, gridfile, 'T')
e2t = nemo.load_field('e2t', homedir, nemodir, gridfile, 'T')

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile, 'T'))

# Calculate the surface area of the T grid boxes & mask.
area = np.ma.masked_array(e1t * e2t, mask=1.0 - tmask[:, :, 0:1])

# --------------------------------------------------------------------------- #

# Find the number of files in the directory that we want to calculate KE for.
Beispiel #19
0
# Register the thermal colormap.
# plt.register_cmap(name='balance', cmap=cmocean.cm.balance)

# --------------------------------------------------------------------------- #

# Specify where the input data lives.
homedir = '/Users/munday/Documents/'
nemodir = 'Data/MIMOC_ML_v2.2_CT_SA/'

# Specify the names of the different files that I want to load from.
filename = 'MIMOC_ML_v2.2_CT_SA_MLP_month08.nc'

# --------------------------------------------------------------------------- #
gphit = np.expand_dims(
    np.squeeze(nemo.load_field('LATITUDE', homedir, nemodir, filename)), 1)
glamt = np.expand_dims(
    np.squeeze(nemo.load_field('LONGITUDE', homedir, nemodir, filename)), 1)

# Load the coordinates.
gphit = np.expand_dims(
    np.squeeze(nemo.load_field('LATITUDE', homedir, nemodir, filename)), 1)
glamt = np.expand_dims(
    np.squeeze(nemo.load_field('LONGITUDE', homedir, nemodir, filename)), 1)

glamt, gphit = np.meshgrid(glamt, gphit)

# Load the field to plot and remask it.
mxl = nemo.load_field('DEPTH_MIXED_LAYER', homedir, nemodir, filename)
mxlmask = np.isfinite(mxl)
mxl[np.isnan(mxl)] = 0.0
Beispiel #20
0
plt.register_cmap(name='balance', cmap=cmocean.cm.balance)

# --------------------------------------------------------------------------- #

# Specify where the input data lives.
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/DRM-ORCH0083-LIM3/EXP00/'

# Specify the names of the different files that I want to load from.
filename = 'TIDY/ARCHIVE/1948/V/ORCH0083-LIM3_19481227_V_d05.nc'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamv = np.squeeze(nemo.load_field('glamv', homedir, nemodir, gridfile, 'V'))
gphiv = np.squeeze(nemo.load_field('gphiv', homedir, nemodir, gridfile, 'V'))

# Load the relevant mask.
vmask = np.squeeze(nemo.load_field('umask', homedir, nemodir, gridfile,
                                   'V'))[:, :, 0:1]

# Load the field to plot and remask it.
ssv = nemo.load_field('sossvssv', homedir, nemodir, filename, 'V')
ssv = nemo.mask_field(ssv, vmask)

# --------------------------------------------------------------------------- #

# Create a new figure window.
plt.figure()
Beispiel #21
0
# Specify the names of the different files that I want to load from.
idir = 'TIDY/ARCHIVE/????/d01/I/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Choose whether to save/load volumes.
save_output = 1

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))

# Load the grid spacings.
e1t = nemo.load_field('e1t', homedir, nemodir, gridfile, 'T')
e2t = nemo.load_field('e2t', homedir, nemodir, gridfile, 'T')

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile,
                                   'T'))[:, :, 0:1]

# --------------------------------------------------------------------------- #

# Find the number of files in the directory that we want to calculate KE for.
ifiles = sorted(glob.glob(''.join([homedir, nemodir, idir, '*'])))
Beispiel #22
0
# Specify where the input data lives.
homedir = '/home/users/mbu66/'
nemodir = '/group_workspaces/jasmin2/nemo/vol1/ORCA025-N401/means/'

# Pick the year to plot.
year = '2010'

# Specify the names of the different files that I want to load from.
filename = ''.join([nemodir, year, '/ORCA025-N401_2010y01T.nc'])
gridfile = ''.join([homedir, 'examples/data/fields/mesh_hgr_matt.nc'])

# --------------------------------------------------------------------------- #

# Load the coordinates.
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gdept = np.squeeze(nemo.load_field('gdept_0', homedir, nemodir, gridfile))
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile,
                                   'T'))[:, :, 0:1]

# Load the field and remask it.
transect = nemo.load_field('sossheig', homedir, nemodir, filename, 'T')
transect = nemo.mask_field(transect, tmask)

#--------------------------------------------------------------------------- #
# Create a new figure window.
plt.figure(figsize=(12.0, 12.0))

#Define polar projection map and fill background black.
map = Basemap(projection='spaeqd', boundinglat=-10, lon_0=-150, round='true')
Beispiel #23
0
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/CORE2NYF-ORCH0083-LIM3/EXP00/'

# Specify the names of the different files that I want to load from.
sfilename = 'TIDY/ARCHIVE/1952/ORCH0083-LIM3_1952_T_d01.nc'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile,
                                   'T'))[:, :, 0:1]

# Load the salinity fields and remask them.
sss2 = nemo.load_field('sosalsqu', homedir, nemodir, sfilename, 'T')
sss2 = nemo.mask_field(sss2, tmask)
sss = nemo.load_field('sosaline', homedir, nemodir, sfilename, 'T')
sss = nemo.mask_field(sss, tmask)

# --------------------------------------------------------------------------- #

# Calculate the temperature variance.
Beispiel #24
0
# Specify the number of grid boxes.
nx = 1440
ny = 1207
nz = 75

# make output dir
nemo.mkdir(homedir+nemodir+'figs/')
nemo.mkdir(homedir+nemodir+'post/')

# Choose whether to save/load tacc values.
save_output = 1

# --------------------------------------------------------------------------- #

# Load the grid spacings.
e2u = nemo.load_field('e2u', homedir, nemodir, gridfile, 'U')[885:886, 315:421, None]

# Load the relevant mask.
umask = np.squeeze(nemo.load_field('umask',homedir, nemodir, gridfile, 'U'))[885:886, 315:421, None]

# --------------------------------------------------------------------------- #

if save_output:
    # Find the number of files in the directory that we want to calculate KE for.
    # ufiles = sorted(glob.glob(''.join([homedir, nemodir, udir, 'nemo_bl504o_1m_20??????-20??????_grid-U.nc'])))
    ufiles = sorted(glob.glob(''.join([homedir, nemodir, udir, '*_grid-U.nc'])))

    #for CORE
    # ufiles = sorted(glob.glob(''.join([homedir, nemodir, udir, '*_????????_grid_U.nc'])))

# Specify the names of the different files that I want to load from.
udir = 'TIDY/ARCHIVE/m01/U/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Choose whether to save/load volumes.
save_output = 1

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamu = np.squeeze(nemo.load_field('glamu', homedir, nemodir, gridfile, 'U'))
gphiu = np.squeeze(nemo.load_field('gphiu', homedir, nemodir, gridfile, 'U'))

# Load the grid spacings.
e1u = nemo.load_field('e1u', homedir, nemodir, gridfile, 'U')
e2u = nemo.load_field('e2u', homedir, nemodir, gridfile, 'U')

# Load the relevant mask.
umask = np.squeeze(nemo.load_field('umask', homedir, nemodir, gridfile,
                                   'U'))[:, :, 0:1]

# --------------------------------------------------------------------------- #

# Find the number of files in the directory that we want to calculate KE for.
ufiles = sorted(glob.glob(''.join([homedir, nemodir, udir, '*'])))
Beispiel #26
0
# --------------------------------------------------------------------------- #
# --------------------------------------------------------------------------- #
# Loop over months in the year .
for i in range(1, 13):
    # Specify the names of the different files that I want to load from.
    filename = ''.join(
        [nemodir, year, '/ORCA025-N401_2010m',
         str(i).zfill(2), 'T.nc'])
    gridfile = ''.join([homedir, 'examples/data/fields/mesh_hgr_matt.nc'])

    # --------------------------------------------------------------------------- #

    # Load the coordinates.
    gphit = np.squeeze(
        nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))
    glamt = np.squeeze(
        nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
    gdept = np.squeeze(nemo.load_field('gdept_0', homedir, nemodir, gridfile))

    # Load the mask
    tmask_1 = np.squeeze(
        nemo.load_field('tmask', homedir, nemodir, gridfile, 'T'))

    # Load the field and remask it.
    ntemp = np.squeeze(
        nemo.load_field('vosaline', homedir, nemodir, filename, 'T'))
    ntemp = nemo.mask_field(ntemp, tmask_1)

    # --------------------------------------------------------------------------- #
    # Create a new figure window.
Beispiel #27
0
# Import required modules.
import numpy as np

# --------------------------------------------------------------------------- #

# Specify where the input data lives.
homedir = '/nerc/n01/n01/munday/ORCHESTRA/'
nemodir = 'trunk/NEMOGCM/CONFIG/VOLCHECK/EXP05/'

# Specify the names of the different files that I want to load from.
tfilename = 'OUTPUTS/ORCH0083-LIM3_1h_19480101_19480101_grid_T_1948010101-1948010101.nc'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# --------------------------------------------------------------------------- #

e1t = nemo.load_field('e1t', homedir, nemodir, gridfile, 'T')
e2t = nemo.load_field('e2t', homedir, nemodir, gridfile, 'T')
e3t_0 = np.squeeze(nemo.load_field('e3t_0', homedir, nemodir, gridfile, 'T'))

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask', homedir, nemodir, gridfile, 'T'))

# Mask the e3's.
e3t_0 = nemo.mask_field(e3t_0, tmask)

# --------------------------------------------------------------------------- #

e3t = np.squeeze(nemo.load_field('e3t', homedir, nemodir, tfilename, 'T'))
e3t = nemo.mask_field(e3t, tmask)

# --------------------------------------------------------------------------- #
# Specify the names of the different files that I want to load from.
vdir = 'TIDY/ARCHIVE/1987/m01/V/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Choose whether to save/load KE values.
save_output = 1

# --------------------------------------------------------------------------- #

# Load the relevant mask.
vmask = np.squeeze(nemo.load_field('vmask', homedir, nemodir, gridfile, 'V'))

# Load the grid spacings.
e2v = nemo.load_field('e2v', homedir, nemodir, gridfile, 'V')
e2v = nemo.mask_field(e2v, vmask[:, :, 0:1])

# --------------------------------------------------------------------------- #

# Find the number of files in the directory that we want to calculate KE for.
if save_output:
    vfiles = sorted(glob.glob(''.join([homedir, nemodir, vdir, '*'])))

# --------------------------------------------------------------------------- #
# If we're not loading the data, then loop over all the available files and
# calculatet the average KE.
Beispiel #29
0
# Specify the names of the different files that I want to load from.
tdir = 'TIDY/ARCHIVE/????/d01/T/'
gridfile = 'TIDY/ARCHIVE/MESH/mesh_mask.nc'

# Specify the number of grid boxes.
nx = 4320
ny = 2000
nz = 75

# Choose whether to save/load volumes.
save_output = 1

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('glamt', homedir, nemodir, gridfile, 'T'))
gphit = np.squeeze(nemo.load_field('gphit', homedir, nemodir, gridfile, 'T'))

# Load the grid spacings.
e1t = nemo.load_field('e1t', homedir, nemodir, gridfile, 'T')
e2t = nemo.load_field('e2t', homedir, nemodir, gridfile, 'T')

# Load the relevant mask.
tmask = np.squeeze(nemo.load_field('tmask',
                                   homedir, nemodir, gridfile, 'T'))[:, :, 0:1]

# --------------------------------------------------------------------------- #

# Find the number of files in the directory that we want to calculate KE for.
tfiles = sorted(glob.glob(''.join([homedir, nemodir, tdir, '*'])))
Beispiel #30
0
# Load the longitudes and latitudes for the target mesh (NEMO).

# Specify where the input data lives.
homedir = '/Users/munday/Documents/Projects/ORCHESTRA/NEMO/'
nemodir = 'trunk/NEMOGCM/CONFIG/DRM-ORCH0083-LIM3/EXP00/'

# Specify the names of the different files that I want to load from.
gridfile = 'INPUTS/EN4.1.1_75L_monthly_19952014_reg1d_C_0_TEOS-10.nc'

# Specify the number of grid boxes.
nemogrid = {'nx': 360, 'ny': 180, 'nz': 75}

# --------------------------------------------------------------------------- #

# Load the coordinates.
glamt = np.squeeze(nemo.load_field('nav_lon', homedir, nemodir,
                                   gridfile)) - 180.
gphit = np.squeeze(nemo.load_field('nav_lat', homedir, nemodir, gridfile))
glamt, gphit = np.meshgrid(glamt[:, None], gphit[:, None])
glamt = glamt.T
gphit = gphit.T
gdept_0 = np.squeeze(nemo.load_field('deptht', homedir, nemodir, gridfile))

# --------------------------------------------------------------------------- #
# ECCO is masked with NaNs, so use a nearest neighbour interpolation to flood
# fill them.

# Construct a mask that is TRUE in LAND.
mask = np.squeeze(field[:, :, :, 0:1].copy())
mask[~np.isnan(mask)] = 0.0  # Ocean is 0.0.
mask[np.isnan(mask)] = 1.0  # Land is 1.0.
mask = mask.astype(bool)