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.).
Installation
pymaws has minimal requirements of:
- Python 3.4 to 3.7
- numpy 1.16
The package can be installed using pip:
$ pip install pymaws
Testing
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 test_pymaws.py
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)
Example
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
Caveats
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:
License
This project is licensed under the MIT License - see the LICENSE file for details
Authors
- Ofer Shamir - ofer.shamir@mail.huji.ac.il
- Shlomi Ziskin Ziv - shlomiziskin@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymaws-0.1.0.tar.gz.
File metadata
- Download URL: pymaws-0.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdfd371c89ec288b04233b4b2a857899da896f904af60197cc91d96233c7d0dd
|
|
| MD5 |
73dffc85d4f1d861e550b40e5ee57993
|
|
| BLAKE2b-256 |
b1d06f089e33ed1babcbb810d51806a134c8f0e92fd6622072bd25d103eff27c
|
File details
Details for the file pymaws-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pymaws-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95f0511edc9a1f70b7118481325a4ca71a1d3ddafff7358b85b7804cdfbf9e72
|
|
| MD5 |
bd1c59fc06fcdef442a824304887b293
|
|
| BLAKE2b-256 |
8e9194e19d95ef13382fa1476239c8ee2e844e41980e4033f8a928431ade1d24
|