import matplotlib.pylab as plt
import numpy as np
import sys
import xarray as xr
from copy import deepcopy
import ecco_v4_py as ecco

# ### 'c' point: ``SSH``

# In[2]:

data_dir = '/Volumes/ECCO_BASE/ECCO_v4r3/nctiles_monthly/SSH/'
var = 'SSH'
var_type = 'c'
ssh_all_tiles = ecco.load_all_tiles_from_netcdf(data_dir, var, var_type)
ecco.minimal_metadata(ssh_all_tiles)

# ### 'u' point: ``ADVxSNOW``
#
# ``ADVxSNOW`` is the horizontal advective flux of snow in each tile's $x$ direction.

# In[3]:

data_dir = '/Volumes/ECCO_BASE/ECCO_v4r3/nctiles_monthly/ADVxSNOW/'
var = 'ADVxSNOW'
var_type = 'u'
advxsnow_all_tiles = ecco.load_all_tiles_from_netcdf(data_dir, var, var_type)
ecco.minimal_metadata(advxsnow_all_tiles)

# ### 'v' point: ``ADVySNOW``
#
コード例 #2
0
#
# Let's load tile 3 of the 'u' point horizontal velocity in the local $x$ direction variable, ``UVEL``.

# In[12]:

data_dir = '/Volumes/ECCO_BASE/ECCO_v4r3/nctiles_monthly/UVEL/'
var = 'UVEL'
var_type = 'u'
tile_index = 3
uvel_tile_3 = ecco.load_tile_from_netcdf(data_dir, var, var_type, tile_index)

# Let's look at `uvel_tile_3`.  This time let's also remove some of the descriptive NetCDF file *Attributes* using a little routine called `minimal_metadata`.  We've already seen these attributes a number of times.

# In[13]:

ecco.minimal_metadata(uvel_tile_3)

# In[14]:

uvel_tile_3

# `uvel_tile_3` has one *Data variable*, ``UVEL``.  Let's take a look at the ``UVEL`` `DataArary`:

# In[15]:

uvel_tile_3.UVEL

# #### Dimensional coordinates
# As expected, ``UVEL`` uses the **i_g, j** coordinates for its horizontal dimensions. Unlike ``SSH``, ``UVEL`` has three-dimensions in space so we find a **k** coordinate.  The ordering of the three-dimensional ECCO v4 output is **time, tile, k, j, i**.
#
# #### Non-dimensional coordinates
import ecco_v4_py as ecco
import warnings
warnings.filterwarnings('ignore')
get_ipython().magic(u'pylab inline')
pylab.rcParams['figure.figsize'] = (10, 6)


# In[2]:


data_dir='/Volumes/ECCO_BASE/ECCO_v4r3/nctiles_monthly/SSH/'
var = 'SSH'
var_type = 'c'

ssh_all_tiles = ecco.load_all_tiles_from_netcdf(data_dir, var, var_type)
ecco.minimal_metadata(ssh_all_tiles)


# In[3]:


ssh_all_tiles


# Now we'll use the two methods to access the ``SSH`` `DataArray`,

# In[4]:


ssh_A = ssh_all_tiles.SSH
ssh_B = ssh_all_tiles['SSH']