original_docstring: 
      compute the total amount of ECOM variable 'var' at a specified time step
      
docstring: compute the total amount of ECOM variable 'var' at a specified time step
docstring_tokens: compute the total amount of ECOM variable ' var ' at a specified time step
code: def ctotal(url,var,tind):
      '''
      compute the total amount of ECOM variable 'var' at a specified time step
      '''
      nc = netCDF4.Dataset(url)
      ncv = nc.variables
      lon = ncv['lon'][:]
      lat = ncv['lat'][:]
      dx = ncv['h1'][:]
      dy = ncv['h2'][:]
      h = ncv['depth'][:]
      sigma = ncv['zpos'][:]
      dz = -diff(sigma)
      # get all but bottom layer (bottom is dummy layer in ECOM)
      c = ncv[var][tind,0:-1,:,:]
      # multiply 3D array of C by dz, then sum in the vertical to get 2D array
      ctot = sum(rollaxis(c,0,3)*dz,axis=2)
      c2d = ma.masked_where(h==-99999.,ctot)
      ctot = sum((c2d*h*dx*dy).ravel())
      return ctot
code_tokens: def ctotal ( url , var , tind ) : nc = netCDF4 . Dataset ( url ) ncv = nc . variables lon = ncv [ 'lon' ] [ : ] lat = ncv [ 'lat' ] [ : ] dx = ncv [ 'h1' ] [ : ] dy = ncv [ 'h2' ] [ : ] h = ncv [ 'depth' ] [ : ] sigma = ncv [ 'zpos' ] [ : ] dz = - diff ( sigma ) c = ncv [ var ] [ tind , 0 : - 1 , : , : ] ctot = sum ( rollaxis ( c , 0 , 3 ) * dz , axis = 2 ) c2d = ma . masked_where ( h == - 99999. , ctot ) ctot = sum ( ( c2d * h * dx * dy ) . ravel ( ) ) return ctot
short_docstring: compute the total amount of ECOM variable 'var' at a specified time step
short_docstring_tokens: compute the total amount of ECOM variable ' var ' at a specified time step
comment: '''
      compute the total amount of ECOM variable 'var' at a specified time step
      '''$SEP$# get all but bottom layer (bottom is dummy layer in ECOM)$SEP$# multiply 3D array of C by dz, then sum in the vertical to get 2D array