Exemplo n.º 1
0
    def hasz(self, v):
        '''
    True if variable has depth dimension (s_rho or s_w)
    '''

        dnames = netcdf.vdim(self.name, v)
        return 's_rho' in dnames or 's_w' in dnames
Exemplo n.º 2
0
  def hasz(self,v):
    '''
    True if variable has depth dimension (s_rho or s_w)
    '''

    dnames=netcdf.vdim(self.name,v)
    return 's_rho' in dnames or 's_w' in dnames
Exemplo n.º 3
0
    def hasz(self, v):
        """
    True if variable has depth dimension (s_rho or s_w)
    """

        dnames = netcdf.vdim(self.name, v)
        return "s_rho" in dnames or "s_w" in dnames
Exemplo n.º 4
0
  def hast(self,v):
    '''
    True if variable has *time* dimension
    '''

    dnames=netcdf.vdim(self.name,v)
    for d in dnames:
      if d.find('time')>=0: return True

    return False
Exemplo n.º 5
0
    def hast(self, v):
        '''
    True if variable has *time* dimension
    '''

        dnames = netcdf.vdim(self.name, v)
        for d in dnames:
            if d.find('time') >= 0: return True

        return False
Exemplo n.º 6
0
    def hast(self, v):
        """
    True if variable has *time* dimension
    """

        dnames = netcdf.vdim(self.name, v)
        for d in dnames:
            if d.find("time") >= 0:
                return True

        return False
Exemplo n.º 7
0
  def var_at(self,v,_3d=True):
    '''
    returns location of the variable in the 2d/3d grid
    Possible values are u,v,r(rho), p(psi)
    If _3d, also checks if at w points
    '''
    dims=netcdf.vdim(self.name,v).keys()

    if _3d and 's_w' in dims: return 'w'
    elif 'xi_u'   in dims or   'eta_u'   in dims: return 'u'
    elif 'xi_v'   in dims or   'eta_v'   in dims: return 'v'
    elif 'xi_psi' in dims and  'eta_psi' in dims: return 'p'
    elif 'xi_rho' in dims and  'eta_rho' in dims: return 'r'

    return False
Exemplo n.º 8
0
    def var_at(self, v, _3d=True):
        '''
    returns location of the variable in the 2d/3d grid
    Possible values are u,v,r(rho), p(psi)
    If _3d, also checks if at w points
    '''
        dims = netcdf.vdim(self.name, v).keys()

        if _3d and 's_w' in dims: return 'w'
        elif 'xi_u' in dims or 'eta_u' in dims: return 'u'
        elif 'xi_v' in dims or 'eta_v' in dims: return 'v'
        elif 'xi_psi' in dims and 'eta_psi' in dims: return 'p'
        elif 'xi_rho' in dims and 'eta_rho' in dims: return 'r'

        return False
Exemplo n.º 9
0
  def vaxes(self,v):
    '''
    returns variables axes as string:
    ex: 'vaxes('temp') is 'tzyx'
    indicating time (t), vertical (z) and horizontal (y,x) dimensions
    '''

    dnames=netcdf.vdim(self.nc,v)
    out=''
    for d in dnames:
      if d.find('time')>=0: out+='t'
      elif d in ('s_rho','s_w'): out+='z'
      if d.startswith('eta_'): out+='y'
      if d.startswith('xi_'): out+='x'

    return out
Exemplo n.º 10
0
Arquivo: roms.py Projeto: bssrdf/okean
  def var_at(self,v):##,_3d=True):
    '''
    returns location of the variable in the 2d/3d grid
    Possible values are u,v,r(rho), p(psi)
    If _3d, also checks if at w points
    '''
    dims=netcdf.vdim(self.nc,v).keys()

    hLoc='r' # r,u,v
    vLoc='r' # r,w

    if 's_w' in dims: vLoc='w'
    if 'xi_u'     in dims or   'eta_u'   in dims: hLoc='u' # or instead of and cos of agrif ...
    elif 'xi_v'   in dims or   'eta_v'   in dims: hLoc='v'
    elif 'xi_psi' in dims and  'eta_psi' in dims: hLoc='p'
    return hLoc,vLoc
Exemplo n.º 11
0
  def vaxes(self,v):
    '''
    returns variables axes as string:
    ex: 'vaxes('temp') is 'tzyx'
    indicating time (t), vertical (z) and horizontal (y,x) dimensions
    '''

    dnames=netcdf.vdim(self.nc,v)
    out=''
    for d in dnames:
      if d.find('time')>=0: out+='t'
      elif d in ('s_rho','s_w'): out+='z'
      if d.startswith('eta_'): out+='y'
      if d.startswith('xi_'): out+='x'

    return out
Exemplo n.º 12
0
  def var_at(self,v):##,_3d=True):
    '''
    returns location of the variable in the 2d/3d grid
    Possible values are u,v,r(rho), p(psi)
    If _3d, also checks if at w points
    '''
    dims=netcdf.vdim(self.nc,v).keys()

    hLoc='r' # r,u,v
    vLoc='r' # r,w

    if 's_w' in dims: vLoc='w'
    if 'xi_u'     in dims or   'eta_u'   in dims: hLoc='u' # or instead of and cos of agrif ...
    elif 'xi_v'   in dims or   'eta_v'   in dims: hLoc='v'
    elif 'xi_psi' in dims and  'eta_psi' in dims: hLoc='p'
    return hLoc,vLoc
Exemplo n.º 13
0
    def var_at(self, v, _3d=True):
        """
    returns location of the variable in the 2d/3d grid
    Possible values are u,v,r(rho), p(psi)
    If _3d, also checks if at w points
    """
        dims = netcdf.vdim(self.name, v).keys()

        if _3d and "s_w" in dims:
            return "w"
        elif "xi_u" in dims or "eta_u" in dims:
            return "u"
        elif "xi_v" in dims or "eta_v" in dims:
            return "v"
        elif "xi_psi" in dims and "eta_psi" in dims:
            return "p"
        elif "xi_rho" in dims and "eta_rho" in dims:
            return "r"

        return False