Skip to main content

Tools for running and analysing UCLA-ROMS simulations

Project description

ROMS-tools

Overview

A suite of python tools for setting up a ROMS simulation.

Note these tools are for the "UCLA" version of ROMS.

Installation instructions

For now this package must be installed by clone the source code and installing locally.

git clone <repo-URL>
cd roms-tools
pip install .

Check the installation has worked by running the tests (you will need to also install pytest to run these)

pytest

Dependencies required are xarray and netcdf4, plus matplotlib and cartopy for visualising grids.

ROMS-tools should run on any platform that can install the above dependencies.

Usage instructions

To set up all the input files for a new ROMS simulation from scratch, follow these steps in order.

Step 1: Make Grid

The first step is choosing the domain size, location, and resolution. Do this by creating an instance of the Grid class:

from roms_tools import Grid

grid = Grid(
    nx=100,          # number of points in the x-direction (not including 2 boundary cells on either end)
    ny=100,          # number of points in the y-direction (not including 2 boundary cells on either end)
    size_x=1800,     # size of the domain in the x-direction (in km)
    size_y=2400,     # size of the domain in the y-direction (in km)
    center_lon=-21,  # longitude of the center of the domain
    center_lat=61,   # latitude of the center of the domain
    rot=20,          # rotation of the grid's x-direction from lines of constant longitude, with positive values being a counter-clockwise rotation
)

To visualize the grid we have just created, use the .plot method:

grid.plot()

To see the values of the grid variables you can examine the xarray.Dataset object returned by the .ds property

grid.ds
<xarray.Dataset>
Dimensions:    (eta_rho: 3, xi_rho: 3, one: 1)
Dimensions without coordinates: eta_rho, xi_rho, one
Data variables:
    angle      (eta_rho, xi_rho) float64 0.0 0.0 0.0 -1.46e-16 ... 0.0 0.0 0.0
    f0         (eta_rho, xi_rho) float64 4.565e-06 4.565e-06 ... -4.565e-06
    pn         (eta_rho, xi_rho) float64 5e-06 5e-06 5e-06 ... 5e-06 5e-06 5e-06
    lon_rho    (eta_rho, xi_rho) float64 339.1 340.0 340.9 ... 339.1 340.0 340.9
    lat_rho    (eta_rho, xi_rho) float64 1.799 1.799 1.799 ... -1.799 -1.799
    spherical  (one) <U1 'T'
    tra_lon    (one) int64 -20
    tra_lat    (one) int64 0
    rotate     (one) int64 0
Attributes:
    Title:    ROMS grid. Settings: nx: 1 ny: 1  xsize: 0.1 ysize: 0.1 rotate:...
    Date:     2023-11-20
    Type:     ROMS grid produced by roms-tools

Once we are happy with our grid, we can save it as a netCDF file via the .save method:

grid.save('grids/my_new_roms_grid.nc')

The basic grid domain is now ready for use by ROMS.

Steps 2-7:

Coming soon!

Feedback and contributions

If you find a bug, have a feature suggestion, or any other kind of feedback, please start a Discussion.

We also accept contributions in the form of Pull Requests.

See also

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

roms-tools-0.0.2.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

roms_tools-0.0.2-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file roms-tools-0.0.2.tar.gz.

File metadata

  • Download URL: roms-tools-0.0.2.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for roms-tools-0.0.2.tar.gz
Algorithm Hash digest
SHA256 27878a04c998f161d787c5626b91a8cc11de91b7b38a0c93d41ecafc085a37ec
MD5 9077ac61fbeda568ce1a68cd9404892c
BLAKE2b-256 8d8071709ac77d3fd76fe7443bccc1ba73a463fdfff3c9f9cfb9824be3e75790

See more details on using hashes here.

File details

Details for the file roms_tools-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: roms_tools-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for roms_tools-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 744d2ee89858f9165166d38b7306e1cea6799608ebcaa4e0134fd4ec7276d8a9
MD5 73c6b31ea8d944209e1778b66fc64eae
BLAKE2b-256 2df7bd8d0e5b3ba33e747356be70a240533d1dee96c4b3ac7057924aa633c40b

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