Converting ADCIRC NWS12 to NWS13
At OWI, we have opened-up some of our internal Python to read our WIN/PRE ascii formats, which are referred to as OWI or NWS12 files by the ADCIRC modeling community.
The code is broken up into the following components:
- An owiWinPre Python module: https://gitlab.com/oceanweather/Python-Sub/owiWinPre
- A winpre_to_nws13.py Python script for converting formats NWS12 to NWS13: https://gitlab.com/oceanweather/Python-Scripts/wind/winpre_to_nws13
These components have been assembled into a Docker container image with the Dockerfile and repository available on Gitlab as well. This container image has the required publically available Python dependencies already installed, and running from Docker will execute the winpre_to_nws13.py script.
Using the container image’s convert command
Call with the following:
docker run registry.gitlab.com/oceanweather/docker/docker-nws12-to-nws13 convert {OPTIONS}
Converting multiple NWS12 overlays would look like the following example.
docker run registry.gitlab.com/oceanweather/docker/docker-nws12-to-nws13:latest convert \
-w "201304_1DegNATL.win" \
"201304_TestStormA.win" \
-p "201304_1DegNATL.pre" \
"201304_TestStormA.pre" \
-g Main TestStorm \
-o test_nws13_output.nc
The Gitlab container registry has been populated with my builds of the image.
docker pull registry.gitlab.com/oceanweather/docker/docker-nws12-to-nws13
Available build tags for the image can be found on Gitlab.
Format Converter CLI
usage: [-h] -w WIN [WIN ...] -p PRE [PRE ...] -o OUTPUT
[-g GROUP [GROUP ...]] [-a] [-v]
Convert a series of OWI WIN/PRE files to an ADCIRC NWS13 Netcdf file.
optional arguments:
-h, --help show this help message and exit
-w WIN [WIN ...], --win WIN [WIN ...]
Input WIN file(s)
-p PRE [PRE ...], --pre PRE [PRE ...]
Input PRE file(s)
-o OUTPUT, --output OUTPUT
Output file path
-g GROUP [GROUP ...], --group GROUP [GROUP ...]
Input group name(s)
-a, --append If set, do not clobber the existing file, but append groups to it.
-v, --verbose Verbose log output