Python package for working with ADCIRC input and output files.
Project description
AdcircPy
A Python interface for handling inputs and outputs for the ADCIRC hydrodynamic model.
Basic Installation:
You can install this software through conda or through pip.
The dependecies of Python packages installed through pip must be satisfied by the operating system (for example, the headers for HDF5 for use with netCDF4). Therefore, the recommended method of installation is through conda.
It is recommended that this package is used on Linux, but Windows should work as well. Not tested in MacOS, but should also work as well.
Method 1 describes the steps to install thorugh conda, while method 2 describes the steps to perform a pip only install.
Method 1: Conda (the easy way!)
Windows:
Install Anaconda for Windows
Using the Anaconda Command Prompt, navigate to the directory where the AdcircPy has been downloaded and run the following command:
conda env create -f conda-windows-x86_64.yml
After the installation of the dependecies is done, you should activate the AdcircPy environment by running:
conda activate AdcircPy
Finally, you can install the package by issuing the command:
python setup.py install
This will install the AdcircPy on your conda environment. Remember to alwasy activate the AdcircPy enviroment by running the command
conda activate AdcircPy
Linux:
Same as Windows but use conda-linux-x86_64.yml instead.
Method 2: Pip-only (for the hardcore purist)
pyproj needs to be installed prior the installation on pip by running:
pip install git+https://github.com/jswhit/pyproj.git@master
Now you can install the package through pip by executing:
pip install AdcircPy
If the package fails to install through pip, check if you have the correct headers installed in your operating system. Using conda is highly recommended.
NOTE: If you are developer and would like to debug the package, you may install this package on developer mode by doing:
pip install -e .
Usage
This package is an API to handle input and output files for the ADCIRC hydrodynamic model.
Create a new directory where you plan to start your project and create a new file with the following content:
from AdcircPy import AdcircPy
If it's the first time running AdircPy on this user account, the TPXO database will be cached to disk.
Now you can load an Adcirc mesh or an output file by doing:
mesh = AdcircPy.read_mesh('/path/to/fort.14')
output = AdcircPy.read_output('/path/to/outputfile.nc')
The most basic you can do with this software is create plots:
import matplotlib.pyplot as plt
mesh.make_plot()
output.make_plot()
plt.show()
Example of fort.15 generation:
Tidal only run:
from AdcircPy import AdcircPy
from datetime import datetime, timedelta
Mesh = AdcircPy.read_mesh(fort14='/path/to/fort.14',
fort13='/path/to/fort.13')
start_date = datetime.now()
end_date = start_date+timedelta(days=5)
tidalRun = Mesh.TidalRun(start_date, end_date)
tidalRun.dump('/directory/to/dump')
Generation of a Best Track Meteorological run:
from datetime import datetime, timedelta
from AdcircPy import AdcircPy
storm_id = 'AL182012'
spinup_date = datetime(2012, 10, 11, 0)
start_time = spinup_date + timedelta(days=15)
end_time = spinup_date + timedelta(days=19.25)
Mesh = AdcircPy.read_mesh(fort14='/path/to/fort.14',
fort13='/path/to/fort.13')
BestTrackRun = Mesh.BestTrackRun('AL182012', start_time, end_time, spinup_date=spinup_date)
BestTrackRun.dump('/directory/to/dump')
Example where global outputs are requested:
from AdcircPy import AdcircPy
from AdcircPy import ElevationGlobalOutput as EGO
from datetime import datetime, timedelta
Mesh = AdcircPy.read_mesh(fort14='/path/to/fort.14',
fort13='/path/to/fort.13')
start_date = datetime.now()
end_date = start_date+timedelta(days=5)
tidalRun = Mesh.TidalRun(start_date, end_date,
ElevationGlobalOutput=EGO(sampling_frequency=timedelta(minutes=15)))
tidalRun.dump('/directory/to/dump')
See the "examples" directory for more examples where the Elevation stations outputs are requested.
Please report bugs to jreniel@gmail.com
pyproj, netCDF, scipy and gdal should be sourced from conda-forge.
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
File details
Details for the file AdcircPy-0.9.0.tar.gz
.
File metadata
- Download URL: AdcircPy-0.9.0.tar.gz
- Upload date:
- Size: 104.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9994548146ef2cfacd5297ca697f68e21382e20bfd72301782508725c7b5bda8 |
|
MD5 | bddc2e5d1a66bfb1fa191f7e1b30c4b9 |
|
BLAKE2b-256 | 0206c9d7eeb361e96e57fce98f86de59aa1d9378a66cc79279a3a51c744999fd |
File details
Details for the file AdcircPy-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: AdcircPy-0.9.0-py3-none-any.whl
- Upload date:
- Size: 148.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a539f739b6b055ab280edb7addf00037902d1c9a7f92655c8ac8ecbe099de435 |
|
MD5 | e671d12487e2526bc3926f5675271149 |
|
BLAKE2b-256 | 6c402d94dea71789106a64ee86381da7312062cc28da8f9edf5965ff39f08d9f |