Skip to main content

State Estimation and Analysis in PYthon

Project description

State Estimation and Analysis in PYthon (SEAPY)

Tools for working with ocean models and data.

SEAPY requires: numpy, scipy, netCDF4, basemap, joblib, and numpy_groupies


Install from Conda-Forge

Install from conda-forge with the Conda package manager:

$ conda install -c conda-forge seapy

You should also consider making conda-forge your default channel. See the conda-forge tips and tricks page.

The Conda-Forge SEAPY feedstock is maintained by Filipe Fernandes, ocefpaf. As of August 2019 there are binary packages on all the platforms that Conda-Forge supports: Python 3.6 and 3.7 on Linux, Windows and Mac OSX (all 64-bit).

To remove seapy:

$ conda remove seapy

Install from PyPI

Install from PyPI with PIP:

$ pip install seapy-ocean

Note that on PyPI (but nowhere else) the package name is seapy-ocean to avoid a name clash with another package. The module name is still seapy.

SEAPY packages on PyPI have been built and uploaded by Mark Hadfield, hadfieldnz. There is a source distribution that should build with no problems on Linux (and Mac OSX, but we haven't tested it) and a binary distribution for Windows (64-bit).

In a Conda environment, it is quite possible to install with PIP, but dependency handling and updating will be cleaner if you use the Conda package.

To remove seapy-ocean

$ pip uninstall seapy-ocean

Install from source code on

The SEAPY source code is maintained by Brian Powell, (powellb)[]. Releases are made on the master branch

Install from with PIP:

$ pip install git+git://

OR clone a copy of the source and install in editable mode, eg:

$ git clone
$ pip install -e seapy

With an editable-mode installation, changes you make to your copy of the source code will take effect when you import the module.


If you've installed from source in editable mode so that you can change and test the source code, then you should consider forking your own copy of the repository. This allows you to keep your changes under revision control and potentially contribute them to the project. Forking on is a lightweight process that won't complicate your workflow significantly and keeps the relationship between your work and the original project clear, so it is strongly advised to do it early. However he immutable and unique nature of Git commits means that you can create and populate a fork later if you want to, as long as you have saved your work somewhere in Git format. To create a fork you will need a user account.

This beginner's guide to contributing to a GitHub project has some good suggestions about contributing to an existing project. The convention in the existing SEAPY forks is to reserve the branch name "master" for the master branch in Brian Powell's repository (or copies thereof) and to use a branch matching your user name for your own work.


Many of the time-saving features are in generating fields for running the ROMS model.

  1. To load the meta information about a model (ROMS, HYCOM, MITgcm, POM, SODA), load an output file (history, average, climatology, grid, etc.) via:

     >> mygrid = seapy.model.asgrid(filename)
     >> mygrid
     C-Grid: 32x194x294
     >> print(mygrid)
     32x194x294: C-Grid with S-level
     Available: I,J,_isroms,_nc,angle,cgrid,cs_r,depth_rho,depth_u,depth_v,dm,dn,eta_rho,eta_u,eta_v,f,filename,h,hc,lat_rho,lat_u,lat_v,lm,ln,lon_rho,lon_u,lon_v,mask_rho,mask_u,mask_v,n,name,pm,pn,s_rho,shape,spatial_dims,tcline,theta_b,theta_s,thick_rho,thick_u,thick_v,vstretching,vtransform,xi_rho,xi_u,xi_v
  2. Most methods available in SEAPY require a grid, which can be specified as a "filename" or as a grid object.

  3. Find out how to download global HYCOM data that will span my grid from 1/1/2015 through 5/1/2015:

     >> seapy.model.hycom.load_history("", start_time=datetime(2015,1,1),
                                      grid=mygrid, load_data=False)
     ncks -v water_temp,salinity,surf_el,water_v,water_u -d time,352,352 -d lat,1204,1309 -d lon,2438,2603

This will display the 'ncks' command necessary to download the data. If you want to have SEAPY download it (not recommended due to server-speed), use 'load_data=True'.

  1. Once you have HYCOM data, interpolate it to your grid

     >> seapy.roms.interp.to_clim("", "",
                       dest_grid=mygrid, nx=1/6, ny=1/6,
                       vmap={"surf_el":"zeta", "water_temp":"temp",
                       "water_u":"u", "water_v":"v", "salinity":"salt"})
  2. Generate boundary conditions from the climatology

     >> seapy.roms.boundary.from_roms("", "")
  3. Generate initial conditions from the climatology

     >> seapy.roms.initial.from_roms("", "")
  4. You now have what you need to run your model

  5. To set up data assimilation, download the raw observations (e.g.,,, ). You can then process the data:

     >> dt = 400/86400       # time-step of the model in days
     >> aviso_gen = seapy.roms.obsgen.aviso_sla_map(mygrid, dt)
     >> aviso_gen.batch_files(seapy.list_files('.','aviso.*nc'), '')
     >> argo_gen = seapy.roms.obsgen.argo_ctd(mygrid, dt)
     >> obs = argo_gen.convert_file("")
     >> obs.to_netcdf("")
  6. Put all of the processed observations files together into a file for a given assimilation window

     >> seapy.roms.obs.merge_files(seapy.list_files('.*roms_[0-9]'), '', np.arange([0, 10.1, 5]))

There are many more things that can be done, but these show some of the power available via simple commands.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for seapy-ocean, version 0.4.4
Filename, size File type Python version Upload date Hashes
Filename, size seapy_ocean-0.4.4-cp37-cp37m-win_amd64.whl (1.1 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size seapy-ocean-0.4.4.tar.gz (868.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page