Romstools

Romstools is a toolbox that contains a variety of programs useful for Regional Ocean Model (ROMS) developers. Our goal with this and other toolboxes available on Github is to provide everything required to setup, run, and analyse the ROMS model (ROMS – http://myroms.org/). Currently, the following tools are included but split into separate packages/folders that can be used indepdentely.

Fork me on GitHub

  • CreateObsFileIS4DVAR – Generate observation file from SST required to run IS4DVAR assimilation with ROMS
  • VolumeFlux – volume flux calculations for transects between (x,y) grid points
  • Model2roms – automatically create BRY, INIT ,and CLIM files required to run ROMS using the model2roms toolbox – https://github.com/trondkr/model2roms
  • Tools – a selection of useful scripts that can come in handy when working with NetCDF files and ROMS
  • CreateForcing-Atmos-Tides-Rivers – programs that create atmospheric, river, and tidal forcing for your ROMS model.

General requirements

  • Python installation with numpy, basemap, and matplotlib
  • Python netCDF4 interface – http://code.google.com/p/netcdf4-python/
  • In some cases a Fortran compiler combined with F2PY (part of numpy) is required to create python modules
  • A full Python distribution package such as Anaconda or
    Enthought is reccomended
  • Fortran NetCDF interface (required to compile CreateForcing-Atmos-Tides-Rivers)
  • To run interaxctively on Hexagon (HPC) remember to: module unload xtpe-interlagos

Tools

The tools section contains various programs to calculate long term averages, and trends based on a number of input
files that typically cover a long time period. For example, if you want to analyse the modeled multi-year averages
of short wave fluxes for the North Sea you can do so by running the createAveragesOnHexagon.py script.
The script first calculates the averages on the supercomputer before downloading the resulting NetCDF4 files to
local computer. Finally, you can plot the results stored in the NetCDF4 file by running createMaps.py. The result
will look something like this:
http://www.trondkristiansen.com/wp-content/gallery/romstools/longtermmean_shflux_time_depth_surface.jpg alt=”” style=”width:50%”>

Generate observation file for IS4DVAR

This is a set of scripts that automatically downloads Sea Surface Temperature (SST) data for your grid for the time period you are interested in and stored the data as an observation file. This file requires a special format and is read by ROMS when assimilating SST data using the Incremental Strong constraint 4DVAR assimilation technique. The SST data are downloaded using openDAP from the CoRTAD SST archive (http://www.nodc.noaa.gov/sog/Cortad/).

Volume flux calculations

To calculate the fluxes you run the script calculateFluxes.py either as a standalone python program or executed
as a job-script. If you run the program on a super-computer (e.g. Hexagon) you may want to run the script as a job
and use the script runJob.sh to queue your job (Hexagon: qsub runJob.sh).

This toolbox is a mixture of Fortrand and Python tools where the core programs are taken from the excellent pyroms
toolbox also available on github: https://github.com/kshedstrom/pyroms. However, to avoid having to install the
entire toolbox to calculate the fluxes, this smaller toolbox was created.

Calculated volume fluxes for various sections in the North Sea between 1993-2009

Define transects and depth ranges

You can define a list of transects you want the volume transport calculated for in the function
defineTransects(). The output from running is a comma separated value file containing the positive,
negative, and net transport through the transect. You can also caluclate the transport for the e.g. just the upper
500 meters of the water column by defining the minimum and maximum depths:

minDepth=0
maxDepth=500

Requirements

This toolbox still requires you to have a Fortran compiler to compile the Fortran programs and generate Python modules.
On Hexagon this is done by loading the gnu modules (for Fortran compiler compatible with Python and numpy). In the
terminal window type:

module swap PrgEnv-pgi PrgEnv-gnu
module unload notur
f2py --verbose  -c -m iso iso.f90
f2py --verbose  -c -m obs_interp obs_interp.f

This should provide you with two python modules (obs_interp.so and iso.so) which you can try to import to python with:

Python 2.7.2 (default, Mar 22 2012, 12:32:11)
[GCC 4.6.1 20110627 (Cray Inc.)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import iso
>>> print iso.__doc__

Create forcing for Atmosphere – Tides – Rivers

This toolset contains necessary files to create forcing files for the atmosphere, tides, and river forcing.

Tides

Get the toolbox and move into folder “`northsea_forcing_tides“`, edit the file “`make_tides.sh“` so that the following variables are correct according to your setup:

syear=1990; eyear=2014
gridfile=/work/users/trondk/KINO/GRID/kino_norseas_800m_grid.nc
tpxodir=/work/shared/norkyst/NorKyst-800m_Forcing/Tpxo_AtlanticOcean

Next compile and run with “`./make_tides.sh“`

Atmospheric forcing (ERA Interim)

Move into folder “`northsea_forcing_atmos“`, edit the file “`make_atmos.sh“` so that the following variables are correct according to your setup:

years="2009 2010 2011 2012"
gridfile=/work/users/trondk/KINO/GRID/kino_norseas_800m_grid.nc

Next compile and run with “`./make_atmos.sh“`

River forcing

Move into folder “`northsea_forcing_rivers“`, edit the file “`make_rivers.sh“` so that the following variables are correct according to your setup:

years="2009 2010 2011 2012"
gridfile=/work/users/trondk/KINO/GRID/kino_norseas_800m_grid.nc

Next compile and run with “`./make_atmos.sh“` or use the batch job script “`qsub runMakeAtmos.sh“`

Contact

  • me (at) trondkristiansen.com

License

The MIT License (MIT)

Copyright © 2015 Trond Kristiansen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

One thought on “Romstools

  1. Dear Sir,
    I am able to run your flux calculation python code. But my timestep is not progressing as the first time is repeating in output text file. My roms average file is for one year with 12 timestep (monthly record is there). Can you please suggest me the necessary changes (like “currentDate”) for this the code.
    Thanking you.

Leave a Reply

Your email address will not be published. Required fields are marked *