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:

To easily install the module just do:

sudo pip install swantools

alternatively, download the source code and install with:

sudo 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:


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:


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

Some useful functions are also provided, for example:


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 hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page