Skip to content
jay-hennen edited this page Mar 8, 2019 · 1 revision

Below is the ncdump of a data file we will be working with.

netcdf staggered_sine_channel {
dimensions:
        eta_psi = 24 ;
        xi_rho = 5 ;
        xi_psi = 4 ;
        eta_rho = 25 ;
variables:
        double lon_rho(xi_rho, eta_rho) ;
        double lon_v(xi_psi, eta_rho) ;
        double lon_u(xi_rho, eta_psi) ;
        double lat_v(xi_psi, eta_rho) ;
        double lat_rho(xi_rho, eta_rho) ;
        double lat_psi(xi_psi, eta_psi) ;
        double lat_u(xi_rho, eta_psi) ;
        double lon_psi(xi_psi, eta_psi) ;
        double u_psi(xi_psi, eta_psi) ;
                u_psi:units = "m/s" ;
        double u_rho(xi_rho, eta_rho) ;
                u_rho:units = "m/s" ;
        double u(xi_rho, eta_psi) ;
                u:units = "m/s" ;
        double v(xi_psi, eta_rho) ;
                v:units = "m/s" ;
        double v_psi(xi_psi, eta_psi) ;
                v_psi:units = "m/s" ;
        double v_rho(xi_rho, eta_rho) ;
                v_rho:units = "m/s" ;

// global attributes:
                :grid_type = "sgrid" ;
}

Create GridCurrent from a netCDF file:

  import numpy as np
  import netCDF4 as nc4
  from datetime import datetime, timedelta
  from gnome.environment import GridCurrent

  fn = ('my_current_file.nc')
  current = GridCurrent.from_netCDF(filename = fn)
Clone this wiki locally