Skip to main content

Swan Utilities

Project description

# swantools

This repository gathers some useful functions and tools to be used alongside SWAN wave model.

For downloading, installing and using SWAN, please see: http://swanmodel.sourceforge.net/

To easily install the module just do:

```bash
sudo pip install swantools
```

alternatively, download the source code and install with:

```bash
sudo setup.py install
```

Nowadays, there is a I/O class which can handle TABLE, SPECOUT and BLOCK outputs. In the future, it will be possible to write spectral boundary conditions, TPAR files and initial conditions.

For example, to use the I/O structure for reading a TABLE with HEAD option do:

```python

import swantools

rw = swantools.SwanIO()

table = rw.read_swantable('file.txt')
```
This will return a pandas DataFrame with the model data.

Reading spectral (.spc) files become very easy:

```python

lon,lat,nfreqs,freqs,ndirs,dirs,spectra = rw.read_swanspc('file.txt','19990101.00000')
```

Some useful functions are also provided, for example:

```python

lat = np.arange(-40,-10,0.25)
lon = np.arange(-60,-40,0.25)
plats = np.array([-15.65,-25.25,-12.45])
plons = np.array([-35.20,-55.27,-30.10])

indx,dists = nearest_point(lon,lat,plons,plats)
```

Much more will be added in the future.

Enjoy !

Project details


Download files

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

Source Distribution

swantools-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file swantools-0.1.1.tar.gz.

File metadata

  • Download URL: swantools-0.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for swantools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eafc6c97458b92094a9d3dcd43810044c4a722f0f082a4f0042dd433d237ec8d
MD5 4e995543f7bd411a8c99a45a86e9223f
BLAKE2b-256 5bf3ad1792906880f80745f3ce5c9ff714a978366fff7024f79c07d113bdcebf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page