Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Matsuno Analytical Wave Solution implemented in Python

Project description

pymaws: Matsuno Analytical Wave Solution implemented in Python

A python module for evaluating the initial conditions used in: The Matsuno baroclinic wave test case (under review for GEOSCI. MODEL DEV.).


pymaws has minimal requirements of:

  • Python 3.4 to 3.7
  • numpy 1.16

The package can be installed using pip:

$ pip install pymaws


The testing procedure tests all the parts of pymaws and should take anywhere from a few seconds upto 20 seconds due to random elements in the tests. To run the tests, use python3 in the command line:

$ python

You should get OK in the last line.

Getting Started

In the python environmnet, start by importing pymaws with the command:

$ from pymaws import *

The main function eval_field was loaded to your environment and a dictionary named Earth that stores the planetary parameters used in this package. (if you want to run eval_field with different parameters , see below)


Let's begin with a regular grid of lat/lon on a 20 second time interval:

$ import numpy as np
$ nlats = 100
$ nlons = 200
$ ntime = 50
$ lats = np.deg2rad(np.linspace(-80, 80, nlats))
$ lons = np.deg2rad(np.linspace(-180, 180, nlons))
$ time = np.linspace(0.0, 20, ntime)

Now, let's evaluate the meridional velocity field of an Eastward propagating Inertia-Gravity (EIG) wave:

$ v = np.zeros((ntime, nlats, nlons))
$ for t in range(ntime):
$     for j in range(nlats):
$         for i in range(nlons):
$             v[t, j, i] = eval_field(lats[j], lons[i], time[t], 
$                                           field='v', wave_type='EIG')

$ v.shape
$ (50, 200, 100)

Note that the default arguments of eval_field are n=1, k=5, amp=1e-5, wave_type='Rossby' and parameters=Earth. This package does not include visualizations of any kind, but you can use matplotlib, e.g.

$ from matplotlib import pyplot as plt
$ plt.contourf(np.rad2deg(lons), np.rad2deg(lats), v[0, :, :])
$ plt.xlim(-36,36)
$ plt.ylim(-30,30)

Meridional velocity at t=0 Meridional velocity at t=0


This version of pymaws does not solve Matsuno equations for n, k < 1,

Planetary Parameters:

The default parameters in pymaws are stored in a dictionary named Earth:

$  {'angular_frequency': 7.29212e-05,
      'gravitational_acceleration': 9.80616,
      'mean_radius': 6371220.0,
      'layer_mean_depth': 30.0}

If you want to use different planetary parameters, just copy the dictionary Earth and replace the appropriate values. For example lets change the layer_mean_depth parameter to 10 meters:

$   Earth_1 = Earth.copy()
$   Earth_1['layer_mean_depth'] = 10.0

When you run eval_field, remember to use the argument parameters=Earth_1.

How to cite pymaws

If you use pymaws in your academic work and publish a paper, we kindly ask that you cite pymaws using the following DOI:


This project is licensed under the MIT License - see the LICENSE file for details


Project details

Release history Release notifications

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pymaws-0.1.0-py3-none-any.whl (10.4 kB) Copy SHA256 hash SHA256 Wheel py3
pymaws-0.1.0.tar.gz (9.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page